# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
28126 | Shocking Hot (#71) | The Ant and The Bitcoin (FXCUP2_ant) | C++14 | 0 ms | 4460 KiB |
This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#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];
scanf("%lld%s",&a[i].X,T);
if(T[0] == 'L') f[i] = true;
a[i].Y = i;
}
scanf("%lld",&x);
sort(a+1, a+1+n);
for(ll i=1;i<=n;i++) {
d[i] = a[i].Y;
a[i].Y = (a[i].Y == x);
if(f[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 (stderr)
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |