# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
15371 |
2015-07-12T06:51:53 Z |
gs13068 |
통로 위의 개미 (kriii3_X) |
C++ |
|
256 ms |
1104 KB |
#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 time |
Memory |
Grader output |
1 |
Correct |
28 ms |
1104 KB |
Output is correct |
2 |
Correct |
29 ms |
1104 KB |
Output is correct |
3 |
Correct |
25 ms |
1104 KB |
Output is correct |
4 |
Correct |
32 ms |
1104 KB |
Output is correct |
5 |
Correct |
27 ms |
1104 KB |
Output is correct |
6 |
Correct |
27 ms |
1104 KB |
Output is correct |
7 |
Correct |
27 ms |
1104 KB |
Output is correct |
8 |
Correct |
27 ms |
1104 KB |
Output is correct |
9 |
Correct |
27 ms |
1104 KB |
Output is correct |
10 |
Correct |
25 ms |
1104 KB |
Output is correct |
11 |
Correct |
14 ms |
1104 KB |
Output is correct |
12 |
Correct |
21 ms |
1104 KB |
Output is correct |
13 |
Correct |
9 ms |
1104 KB |
Output is correct |
14 |
Correct |
11 ms |
1104 KB |
Output is correct |
15 |
Correct |
15 ms |
1104 KB |
Output is correct |
16 |
Correct |
35 ms |
1104 KB |
Output is correct |
17 |
Correct |
33 ms |
1104 KB |
Output is correct |
18 |
Correct |
25 ms |
1104 KB |
Output is correct |
19 |
Correct |
13 ms |
1104 KB |
Output is correct |
20 |
Correct |
26 ms |
1104 KB |
Output is correct |
21 |
Correct |
7 ms |
1104 KB |
Output is correct |
22 |
Correct |
6 ms |
1104 KB |
Output is correct |
23 |
Correct |
26 ms |
1104 KB |
Output is correct |
24 |
Correct |
30 ms |
1104 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Runtime error |
256 ms |
1104 KB |
SIGSEGV Segmentation fault |
2 |
Halted |
0 ms |
0 KB |
- |