답안 #1084925

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
1084925 2024-09-07T08:36:22 Z pemguimn 운세 보기 2 (JOI14_fortune_telling2) C++14
4 / 100
3000 ms 2264 KB
#include <bits/stdc++.h>

using namespace std;

const int N = 2e5 + 5;
int n, k, a[N], b[N], t[N], sufmax[N];

int main(){
    ios_base::sync_with_stdio(0); cin.tie(0);

    cin >> n >> k;
    for(int i = 1; i <= n; i++) cin >> a[i] >> b[i];
    for(int i = 1; i <= k; i++) cin >> t[i];

    for(int i = k; i >= 1; i--) sufmax[i] = max(sufmax[i + 1], t[i]);

    long long ans = 0;

    for(int i = 1; i <= n; i++){
        int pos = -1, cnt = 0;
        for(int j = k; j >= 1; j--){
            if(t[j] >= min(a[i], b[i]) && t[j] < max(a[i], b[i])){
                pos = j;
            }
            if(t[j] >= max(a[i], b[i])) cnt++;
            if(pos != -1) break;
        }
        if(pos != -1){
            if(cnt & 1) ans += min(a[i], b[i]);
            else ans += max(a[i], b[i]);
        } else{
            if(cnt & 1) ans += b[i];
            else ans += a[i];
        }
    }

    cout << ans << '\n';
    return 0;
}

# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 344 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Correct 0 ms 348 KB Output is correct
4 Correct 1 ms 348 KB Output is correct
5 Correct 1 ms 348 KB Output is correct
6 Correct 1 ms 348 KB Output is correct
7 Correct 1 ms 348 KB Output is correct
8 Correct 1 ms 348 KB Output is correct
9 Correct 0 ms 348 KB Output is correct
10 Correct 1 ms 348 KB Output is correct
11 Correct 2 ms 348 KB Output is correct
12 Correct 1 ms 348 KB Output is correct
13 Correct 3 ms 348 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 344 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Correct 0 ms 348 KB Output is correct
4 Correct 1 ms 348 KB Output is correct
5 Correct 1 ms 348 KB Output is correct
6 Correct 1 ms 348 KB Output is correct
7 Correct 1 ms 348 KB Output is correct
8 Correct 1 ms 348 KB Output is correct
9 Correct 0 ms 348 KB Output is correct
10 Correct 1 ms 348 KB Output is correct
11 Correct 2 ms 348 KB Output is correct
12 Correct 1 ms 348 KB Output is correct
13 Correct 3 ms 348 KB Output is correct
14 Correct 3 ms 860 KB Output is correct
15 Correct 5 ms 1116 KB Output is correct
16 Correct 8 ms 1668 KB Output is correct
17 Correct 11 ms 2136 KB Output is correct
18 Correct 11 ms 2140 KB Output is correct
19 Correct 9 ms 2132 KB Output is correct
20 Correct 18 ms 2264 KB Output is correct
21 Correct 9 ms 2060 KB Output is correct
22 Correct 6 ms 1628 KB Output is correct
23 Correct 7 ms 1708 KB Output is correct
24 Correct 7 ms 1628 KB Output is correct
25 Correct 7 ms 1812 KB Output is correct
26 Correct 1810 ms 2068 KB Output is correct
27 Correct 2237 ms 2248 KB Output is correct
28 Correct 1595 ms 2256 KB Output is correct
29 Execution timed out 3020 ms 2140 KB Time limit exceeded
30 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 344 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Correct 0 ms 348 KB Output is correct
4 Correct 1 ms 348 KB Output is correct
5 Correct 1 ms 348 KB Output is correct
6 Correct 1 ms 348 KB Output is correct
7 Correct 1 ms 348 KB Output is correct
8 Correct 1 ms 348 KB Output is correct
9 Correct 0 ms 348 KB Output is correct
10 Correct 1 ms 348 KB Output is correct
11 Correct 2 ms 348 KB Output is correct
12 Correct 1 ms 348 KB Output is correct
13 Correct 3 ms 348 KB Output is correct
14 Correct 3 ms 860 KB Output is correct
15 Correct 5 ms 1116 KB Output is correct
16 Correct 8 ms 1668 KB Output is correct
17 Correct 11 ms 2136 KB Output is correct
18 Correct 11 ms 2140 KB Output is correct
19 Correct 9 ms 2132 KB Output is correct
20 Correct 18 ms 2264 KB Output is correct
21 Correct 9 ms 2060 KB Output is correct
22 Correct 6 ms 1628 KB Output is correct
23 Correct 7 ms 1708 KB Output is correct
24 Correct 7 ms 1628 KB Output is correct
25 Correct 7 ms 1812 KB Output is correct
26 Correct 1810 ms 2068 KB Output is correct
27 Correct 2237 ms 2248 KB Output is correct
28 Correct 1595 ms 2256 KB Output is correct
29 Execution timed out 3020 ms 2140 KB Time limit exceeded
30 Halted 0 ms 0 KB -