| # | Time | Username | Problem | Language | Result | Execution time | Memory | 
|---|---|---|---|---|---|---|---|
| 28188 | 대회할수있으려나 (#71) | The Ant and The Bitcoin (FXCUP2_ant) | C++98 | 0 ms | 6712 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>
using namespace std;
struct info
{
    int pos, idx, newidx;
    char dir;
};
bool cmp1(info a, info b) {return a.pos < b.pos;}
bool cmp2(info a, info b) {return a.idx < b.idx;}
info arr[200009];
pair<int, int> res[200009];
int main()
{
    int n,l,t;
    scanf("%d %d %d",&n,&l,&t);
    for(int i=1; i<=n; i++) {
        scanf("%d %c", &arr[i].pos, &arr[i].dir);
        arr[i].idx = i;
    }
    sort(arr+1, arr+n+1, cmp1);
    for(int i=1; i<=n; i++) arr[arr[i].idx].newidx = i;
    sort(arr+1, arr+n+1, cmp2);
    for(int i=1; i<=n; i++) {
        int pos = arr[i].pos;
        char dir = arr[i].dir;
        if(dir == 'L') pos -= t;
        if(dir == 'R') pos += t;
        if(pos < 0) pos = -pos;
        if(pos / l % 2) res[i].first = l - pos%l;
        else res[i].first = pos%l;
    }
    int bit, bitRes;
    scanf("%d",&bit);
    bitRes = res[bit].first;
    sort(res+1, res+n+1);
    for(int i=1; i<=n; i++) if(bitRes == res[i].first) return !printf("%d", arr[i].newidx);
    return 0;
}
Compilation message (stderr)
| # | Verdict | Execution time | Memory | Grader output | 
|---|---|---|---|---|
| Fetching results... | ||||
