# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
52219 | 2018-06-25T05:12:54 Z | 윤교준(#1348) | 운세 보기 2 (JOI14_fortune_telling2) | C++11 | 2000 ms | 752 KB |
#include <bits/stdc++.h> using namespace std; typedef long long ll; const int MAXN = 200005; const int MAXK = 200005; int A[MAXN], B[MAXN]; int C[MAXK]; bitset<MAXN> chk; ll Ans; int N, K; 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", &C[i]); for(int i = 1; i <= K; i++) { int c = C[i]; for(int j = 1; j <= N; j++) { if(!chk[j] && A[j] <= c) chk[j] = !chk[j]; else if(chk[j] && B[j] <= c) chk[j] = !chk[j]; } } for(int i = 1; i <= N; i++) Ans += chk[i] ? B[i] : A[i]; printf("%lld\n", Ans); return 0; }
Compilation message
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 3 ms | 376 KB | Output is correct |
2 | Correct | 7 ms | 376 KB | Output is correct |
3 | Correct | 14 ms | 428 KB | Output is correct |
4 | Correct | 12 ms | 480 KB | Output is correct |
5 | Correct | 12 ms | 536 KB | Output is correct |
6 | Correct | 12 ms | 672 KB | Output is correct |
7 | Correct | 12 ms | 672 KB | Output is correct |
8 | Correct | 12 ms | 724 KB | Output is correct |
9 | Correct | 4 ms | 724 KB | Output is correct |
10 | Correct | 5 ms | 724 KB | Output is correct |
11 | Correct | 12 ms | 724 KB | Output is correct |
12 | Correct | 12 ms | 724 KB | Output is correct |
13 | Correct | 12 ms | 724 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 3 ms | 376 KB | Output is correct |
2 | Correct | 7 ms | 376 KB | Output is correct |
3 | Correct | 14 ms | 428 KB | Output is correct |
4 | Correct | 12 ms | 480 KB | Output is correct |
5 | Correct | 12 ms | 536 KB | Output is correct |
6 | Correct | 12 ms | 672 KB | Output is correct |
7 | Correct | 12 ms | 672 KB | Output is correct |
8 | Correct | 12 ms | 724 KB | Output is correct |
9 | Correct | 4 ms | 724 KB | Output is correct |
10 | Correct | 5 ms | 724 KB | Output is correct |
11 | Correct | 12 ms | 724 KB | Output is correct |
12 | Correct | 12 ms | 724 KB | Output is correct |
13 | Correct | 12 ms | 724 KB | Output is correct |
14 | Correct | 937 ms | 752 KB | Output is correct |
15 | Execution timed out | 2055 ms | 752 KB | Time limit exceeded |
16 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 3 ms | 376 KB | Output is correct |
2 | Correct | 7 ms | 376 KB | Output is correct |
3 | Correct | 14 ms | 428 KB | Output is correct |
4 | Correct | 12 ms | 480 KB | Output is correct |
5 | Correct | 12 ms | 536 KB | Output is correct |
6 | Correct | 12 ms | 672 KB | Output is correct |
7 | Correct | 12 ms | 672 KB | Output is correct |
8 | Correct | 12 ms | 724 KB | Output is correct |
9 | Correct | 4 ms | 724 KB | Output is correct |
10 | Correct | 5 ms | 724 KB | Output is correct |
11 | Correct | 12 ms | 724 KB | Output is correct |
12 | Correct | 12 ms | 724 KB | Output is correct |
13 | Correct | 12 ms | 724 KB | Output is correct |
14 | Correct | 937 ms | 752 KB | Output is correct |
15 | Execution timed out | 2055 ms | 752 KB | Time limit exceeded |
16 | Halted | 0 ms | 0 KB | - |