# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
28132 | 2017-07-15T11:56:53 Z | tlwpdus 팬클럽 회장(#1197, kdh9949) | 개미와 비트코인 (FXCUP2_ant) | C++14 | 46 ms | 5536 KB |
#include <bits/stdc++.h> using namespace std; typedef long long ll; typedef pair<ll, ll> pll; int n, k, p[100010]; ll l, t, bx; pll ix[100010], x[100010]; int main(){ scanf("%d%lld%lld", &n, &l, &t); for(int i = 1; i <= n; i++){ char buf[3]; ll cx; scanf("%lld%s", &cx, buf); ix[i] = {cx, i}; if(buf[0] == 'R'){ cx += t; cx %= 2 * l; if(cx > l) cx = 2 * l - cx; } else{ cx = l - cx; cx += t; cx %= 2 * l; if(cx > l) cx = 2 * l - cx; cx = l - cx; } x[i] = {cx, i}; } scanf("%d", &k); sort(ix + 1, ix + n + 1); sort(x + 1, x + n + 1); for(int i = 1; i <= n; i++){ if(x[i].second == k){ k = i; break; } } printf("%d\n", ix[k].second); }
Compilation message
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 0 ms | 5536 KB | Output is correct |
2 | Correct | 0 ms | 5536 KB | Output is correct |
3 | Correct | 0 ms | 5536 KB | Output is correct |
4 | Correct | 0 ms | 5536 KB | Output is correct |
5 | Correct | 0 ms | 5536 KB | Output is correct |
6 | Correct | 0 ms | 5536 KB | Output is correct |
7 | Correct | 0 ms | 5536 KB | Output is correct |
8 | Correct | 0 ms | 5536 KB | Output is correct |
9 | Correct | 0 ms | 5536 KB | Output is correct |
10 | Correct | 0 ms | 5536 KB | Output is correct |
11 | Correct | 0 ms | 5536 KB | Output is correct |
12 | Correct | 0 ms | 5536 KB | Output is correct |
13 | Correct | 43 ms | 5536 KB | Output is correct |
14 | Correct | 36 ms | 5536 KB | Output is correct |
15 | Correct | 39 ms | 5536 KB | Output is correct |
16 | Correct | 39 ms | 5536 KB | Output is correct |
17 | Correct | 43 ms | 5536 KB | Output is correct |
18 | Correct | 46 ms | 5536 KB | Output is correct |
19 | Correct | 43 ms | 5536 KB | Output is correct |
20 | Correct | 43 ms | 5536 KB | Output is correct |