# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
103982 | 2019-04-03T13:41:22 Z | igba | 운세 보기 2 (JOI14_fortune_telling2) | C++17 | 3000 ms | 2168 KB |
#include <bits/stdc++.h> using namespace std; const int MAXN = 2 * 100100, MAXK = 2 * 100100; int n, k, a[MAXN], b[MAXN], t[MAXK]; long long ans = 0; int main() { scanf("%d %d", &n, &k); for(int i = 1; i <= n; ++i) scanf("%d %d", &a[i], &b[i]); for(int i = 1; i <= k; ++i) scanf("%d", &t[i]); for(int i = 1, swaps, j; i <= n; ++i) { for(j = k, swaps = 0; j >= 1; --j) if(max(a[i], b[i]) <= t[j]) swaps++; else if(min(a[i], b[i]) <= t[j]) { swaps += (a[i] < b[i]); break; } ans += (swaps % 2 ? b[i] : a[i]); } printf("%lld\n", ans); }
Compilation message
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 2 ms | 256 KB | Output is correct |
2 | Correct | 3 ms | 384 KB | Output is correct |
3 | Correct | 3 ms | 384 KB | Output is correct |
4 | Correct | 3 ms | 384 KB | Output is correct |
5 | Correct | 3 ms | 384 KB | Output is correct |
6 | Correct | 3 ms | 384 KB | Output is correct |
7 | Correct | 5 ms | 384 KB | Output is correct |
8 | Correct | 4 ms | 384 KB | Output is correct |
9 | Correct | 3 ms | 384 KB | Output is correct |
10 | Correct | 3 ms | 384 KB | Output is correct |
11 | Correct | 5 ms | 384 KB | Output is correct |
12 | Correct | 5 ms | 384 KB | Output is correct |
13 | Correct | 6 ms | 384 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 2 ms | 256 KB | Output is correct |
2 | Correct | 3 ms | 384 KB | Output is correct |
3 | Correct | 3 ms | 384 KB | Output is correct |
4 | Correct | 3 ms | 384 KB | Output is correct |
5 | Correct | 3 ms | 384 KB | Output is correct |
6 | Correct | 3 ms | 384 KB | Output is correct |
7 | Correct | 5 ms | 384 KB | Output is correct |
8 | Correct | 4 ms | 384 KB | Output is correct |
9 | Correct | 3 ms | 384 KB | Output is correct |
10 | Correct | 3 ms | 384 KB | Output is correct |
11 | Correct | 5 ms | 384 KB | Output is correct |
12 | Correct | 5 ms | 384 KB | Output is correct |
13 | Correct | 6 ms | 384 KB | Output is correct |
14 | Correct | 12 ms | 768 KB | Output is correct |
15 | Correct | 14 ms | 1164 KB | Output is correct |
16 | Correct | 19 ms | 1536 KB | Output is correct |
17 | Correct | 27 ms | 1968 KB | Output is correct |
18 | Correct | 30 ms | 2040 KB | Output is correct |
19 | Correct | 25 ms | 2044 KB | Output is correct |
20 | Correct | 39 ms | 2012 KB | Output is correct |
21 | Correct | 25 ms | 2008 KB | Output is correct |
22 | Correct | 17 ms | 1536 KB | Output is correct |
23 | Correct | 17 ms | 1536 KB | Output is correct |
24 | Correct | 17 ms | 1536 KB | Output is correct |
25 | Correct | 20 ms | 1536 KB | Output is correct |
26 | Correct | 2362 ms | 1872 KB | Output is correct |
27 | Correct | 2734 ms | 2168 KB | Output is correct |
28 | Correct | 2156 ms | 2168 KB | Output is correct |
29 | Execution timed out | 3035 ms | 2048 KB | Time limit exceeded |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 2 ms | 256 KB | Output is correct |
2 | Correct | 3 ms | 384 KB | Output is correct |
3 | Correct | 3 ms | 384 KB | Output is correct |
4 | Correct | 3 ms | 384 KB | Output is correct |
5 | Correct | 3 ms | 384 KB | Output is correct |
6 | Correct | 3 ms | 384 KB | Output is correct |
7 | Correct | 5 ms | 384 KB | Output is correct |
8 | Correct | 4 ms | 384 KB | Output is correct |
9 | Correct | 3 ms | 384 KB | Output is correct |
10 | Correct | 3 ms | 384 KB | Output is correct |
11 | Correct | 5 ms | 384 KB | Output is correct |
12 | Correct | 5 ms | 384 KB | Output is correct |
13 | Correct | 6 ms | 384 KB | Output is correct |
14 | Correct | 12 ms | 768 KB | Output is correct |
15 | Correct | 14 ms | 1164 KB | Output is correct |
16 | Correct | 19 ms | 1536 KB | Output is correct |
17 | Correct | 27 ms | 1968 KB | Output is correct |
18 | Correct | 30 ms | 2040 KB | Output is correct |
19 | Correct | 25 ms | 2044 KB | Output is correct |
20 | Correct | 39 ms | 2012 KB | Output is correct |
21 | Correct | 25 ms | 2008 KB | Output is correct |
22 | Correct | 17 ms | 1536 KB | Output is correct |
23 | Correct | 17 ms | 1536 KB | Output is correct |
24 | Correct | 17 ms | 1536 KB | Output is correct |
25 | Correct | 20 ms | 1536 KB | Output is correct |
26 | Correct | 2362 ms | 1872 KB | Output is correct |
27 | Correct | 2734 ms | 2168 KB | Output is correct |
28 | Correct | 2156 ms | 2168 KB | Output is correct |
29 | Execution timed out | 3035 ms | 2048 KB | Time limit exceeded |