Submission #15371

#TimeUsernameProblemLanguageResultExecution timeMemory
15371gs13068통로 위의 개미 (kriii3_X)C++98
30 / 85
256 ms1104 KiB
#include<cstdio> #include<algorithm> long long a[1111]; int an; int p[1111]; long long d[1111]; int main() { long long t; int i,j,n,m,x,y,tt; scanf("%d%d",&n,&m); while(m--) { scanf("%lld%d",&t,&tt); for(i=0;i<an;i++) { d[i]=(a[i]+t+n+n)%(n+n); if(d[i]>n)d[i]=n+n-d[i]; } std::sort(d,d+an); if(tt==1) { scanf("%d%d",&x,&y); for(i=0;i<an;i++)if(d[i]>x)break; for(j=0;j<an;j++)if(p[j]>=i)p[j]++; p[an]=i; if(y<0)x=n+n-x; a[an]=(x-t)%(n+n); an++; } else { scanf("%d",&x); printf("%lld\n",d[p[x-1]]); } } }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...