提交记录 12801


用户 题目 状态 得分 用时 内存 语言 代码长度
winlere noip17f. 【NOIP2017】列队 Accepted 100 306.224 ms 58684 KB C++11 926 B
提交时间 评测时间
2020-06-03 20:15:10 2020-08-01 02:59:02
//@winlere
#include<iostream>
#include<cstdio>
#include<cstring>
#include<algorithm>
#include<vector>
#define mid ((l+r)>>1)
using namespace std;  typedef long long ll;
const int maxn=3e5+5,maxm=6e6+5;
int n,m,q,rt[maxn],ls[maxm],rs[maxm],seg[maxm],cnt;
ll id[maxn<<1];
vector<ll> e[maxn];
int que(const int&k,const int&l,const int&r,int&pos){
      if(!pos)pos=++cnt,seg[pos]=r-l+1;
      --seg[pos];
      if(l==r)return l;
      int g=ls[pos]?seg[ls[pos]]:mid-l+1;
      return g>=k?que(k,l,mid,ls[pos]):que(k-g,mid+1,r,rs[pos]);
}
int main(){
      ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
      cin>>n>>m>>q;
      for(int t=1;t<=n;++t) id[t]=1ll*t*m;
      for(int t=n+1,N=n+q,M=m+q,x,y,ans;q--;cout<<id[t++]<<'\n'){
	    cin>>x>>y;
	    if(y==m) id[t]=id[ans=que(x,1,N,rt[0])];
	    else id[t]=(ans=que(y,1,M,rt[x]))<m?(x-1ll)*m+ans:e[x][ans-m], e[x].push_back(id[que(x,1,N,rt[0])]);
      }
      return 0;
}

CompilationN/AN/ACompile OKScore: N/A

Testcase #11.347 ms7 MB + 28 KBAcceptedScore: 5

Testcase #21.351 ms7 MB + 24 KBAcceptedScore: 5

Testcase #31.334 ms7 MB + 24 KBAcceptedScore: 5

Testcase #41.352 ms7 MB + 32 KBAcceptedScore: 5

Testcase #51.344 ms7 MB + 28 KBAcceptedScore: 5

Testcase #61.356 ms7 MB + 32 KBAcceptedScore: 5

Testcase #71.488 ms7 MB + 592 KBAcceptedScore: 5

Testcase #81.487 ms7 MB + 592 KBAcceptedScore: 5

Testcase #91.505 ms7 MB + 648 KBAcceptedScore: 5

Testcase #101.502 ms7 MB + 604 KBAcceptedScore: 5

Testcase #1149.276 ms14 MB + 956 KBAcceptedScore: 5

Testcase #1248.829 ms14 MB + 916 KBAcceptedScore: 5

Testcase #13193.09 ms32 MB + 272 KBAcceptedScore: 5

Testcase #14179.506 ms31 MB + 192 KBAcceptedScore: 5

Testcase #15183.89 ms33 MB + 952 KBAcceptedScore: 5

Testcase #16194.808 ms34 MB + 808 KBAcceptedScore: 5

Testcase #1777.589 ms24 MB + 32 KBAcceptedScore: 5

Testcase #1873.053 ms23 MB + 244 KBAcceptedScore: 5

Testcase #19304.091 ms57 MB + 316 KBAcceptedScore: 5

Testcase #20306.224 ms57 MB + 304 KBAcceptedScore: 5


Judge Duck Online | 评测鸭在线
Server Time: 2024-12-05 10:42:35 | Loaded in 1 ms | Server Status
个人娱乐项目,仅供学习交流使用 | 捐赠