# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
15475 |
2015-07-12T08:14:53 Z |
progressive |
통로 위의 개미 (kriii3_X) |
C++14 |
|
29 ms |
1104 KB |
#include<cstdio>
#include<algorithm>
using namespace std;
pair<long long,long long> arix[1010];
int order[1010];
int tp=0;
int L,Q;
void update(int t)
{
t%=2*L;
for(int i=0;i<tp;i++)
{
arix[i].first+=arix[i].second*t;
while(arix[i].first<0 || arix[i].first>L)
{
if(arix[i].first<0)
{
arix[i].first*=-1;
arix[i].second*=-1;
}
else
{
arix[i].first=2*L-arix[i].first;
arix[i].second*=-1;
}
}
}
sort(arix,arix+tp);
return;
}
int main()
{
scanf("%d%d",&L,&Q);
int pt=0;
for(int i=0;i<Q;i++)
{
int t;
scanf("%d",&t);
update(t-pt);
pt=t;
int tt;
scanf("%d",&tt);
if(tt==1)
{
int x,d;
scanf("%d%d",&x,&d);
arix[tp]=make_pair(x,d);
for(int i=0;i<tp;i++)
if(arix[i].first<x)
order[tp]++;
for(int i=0;i<tp;i++)
if(order[i]>=order[tp]) order[i]++;
tp++;
}
else
{
int c;
scanf("%d",&c);
printf("%lld\n",arix[order[c-1]].first);
}
}
return 0;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
19 ms |
1104 KB |
Output is correct |
2 |
Correct |
24 ms |
1104 KB |
Output is correct |
3 |
Correct |
20 ms |
1104 KB |
Output is correct |
4 |
Correct |
25 ms |
1104 KB |
Output is correct |
5 |
Correct |
20 ms |
1104 KB |
Output is correct |
6 |
Correct |
21 ms |
1104 KB |
Output is correct |
7 |
Correct |
19 ms |
1104 KB |
Output is correct |
8 |
Correct |
19 ms |
1104 KB |
Output is correct |
9 |
Correct |
20 ms |
1104 KB |
Output is correct |
10 |
Correct |
17 ms |
1104 KB |
Output is correct |
11 |
Correct |
11 ms |
1104 KB |
Output is correct |
12 |
Correct |
16 ms |
1104 KB |
Output is correct |
13 |
Correct |
6 ms |
1104 KB |
Output is correct |
14 |
Correct |
7 ms |
1104 KB |
Output is correct |
15 |
Correct |
11 ms |
1104 KB |
Output is correct |
16 |
Correct |
29 ms |
1104 KB |
Output is correct |
17 |
Correct |
28 ms |
1104 KB |
Output is correct |
18 |
Correct |
18 ms |
1104 KB |
Output is correct |
19 |
Correct |
11 ms |
1104 KB |
Output is correct |
20 |
Correct |
21 ms |
1104 KB |
Output is correct |
21 |
Incorrect |
6 ms |
1104 KB |
Output isn't correct |
22 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Halted |
0 ms |
0 KB |
- |