# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
15557 |
2015-07-12T12:46:48 Z |
cki86201 |
통로 위의 개미 (kriii3_X) |
C++ |
|
6 ms |
1092 KB |
#define _CRT_SECURE_NO_WARNINGS
#include<stdio.h>
#include<math.h>
#include<algorithm>
typedef long long ll;
ll re(ll x, ll y){
return (x % y + y) % y;
}
int L, Q;
int W[1002], cw, tW[1002];
int main(){
scanf("%d%d", &L, &Q);
int i;
for (i = 1; i <= Q; i++){
ll t;
scanf("%lld", &t);
int p;
scanf("%d", &p);
if (p == 1){
int a, b;
scanf("%d%d", &a, &b);
ll w = (b == 1 ? a : 2 * L - a) - t;
w = re(w, 2 * L);
W[++cw] = w;
}
else{
int a;
scanf("%d", &a);
int j;
int cnt = 0;
for (j = 1; j <= cw; j++){
if (abs(L - W[j]) > abs(L - W[a]))cnt++;
}
for (j = 1; j <= cw; j++){
int tmp = (int)((W[j] + t) % (2 * L));
if (tmp < L)tW[j] = tmp;
else tW[j] = 2 * L - tmp;
}
std::sort(tW + 1, tW + 1 + cw);
printf("%d\n", tW[cw - cnt]);
}
}
return 0;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
6 ms |
1092 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Halted |
0 ms |
0 KB |
- |