# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
74354 | 2018-08-31T11:01:37 Z | khsoo01 | The Ant and The Bitcoin (FXCUP2_ant) | C++11 | 50 ms | 12220 KB |
#include<bits/stdc++.h> #define X first #define Y second using namespace std; typedef long long ll; ll n, l, t, x, d[100005]; pair<ll, ll> a[100005]; bool f[100005]; int main() { scanf("%lld%lld%lld",&n,&l,&t); for(ll i=1;i<=n;i++) { char T[2]; a[i].Y = i; scanf("%lld%s",&a[i].X,T); if(T[0] == 'L') f[i] = true; } scanf("%lld",&x); sort(a+1, a+1+n); for(ll i=1;i<=n;i++) { d[i] = a[i].Y; a[i].Y = (d[i] == x); if(f[d[i]]) a[i].X -= t; else a[i].X += t; a[i].X = (a[i].X % (2*l) + 2*l) % (2*l); if(a[i].X >= l) a[i].X = 2*l - a[i].X; } sort(a+1, a+1+n); for(ll i=1;i<=n;i++) { if(a[i].Y) {printf("%lld\n",d[i]); return 0;} } }
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 2 ms | 376 KB | Output is correct |
2 | Correct | 2 ms | 376 KB | Output is correct |
3 | Correct | 2 ms | 416 KB | Output is correct |
4 | Correct | 2 ms | 420 KB | Output is correct |
5 | Correct | 2 ms | 420 KB | Output is correct |
6 | Correct | 3 ms | 428 KB | Output is correct |
7 | Correct | 3 ms | 460 KB | Output is correct |
8 | Correct | 3 ms | 624 KB | Output is correct |
9 | Correct | 3 ms | 624 KB | Output is correct |
10 | Correct | 3 ms | 636 KB | Output is correct |
11 | Correct | 2 ms | 680 KB | Output is correct |
12 | Correct | 3 ms | 696 KB | Output is correct |
13 | Correct | 50 ms | 4180 KB | Output is correct |
14 | Correct | 44 ms | 5360 KB | Output is correct |
15 | Correct | 38 ms | 5936 KB | Output is correct |
16 | Correct | 48 ms | 7504 KB | Output is correct |
17 | Correct | 48 ms | 8740 KB | Output is correct |
18 | Correct | 48 ms | 9780 KB | Output is correct |
19 | Correct | 45 ms | 11052 KB | Output is correct |
20 | Correct | 48 ms | 12220 KB | Output is correct |