답안 #1112199

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
1112199 2024-11-13T19:15:52 Z ortsac 운세 보기 2 (JOI14_fortune_telling2) C++17
4 / 100
3000 ms 2384 KB
#include <bits/stdc++.h>

using namespace std;

#define int long long
#define pii pair<long long, long long>
#define fr first
#define se second

const int MAXN = 1e5 + 10;
int v[MAXN];

int32_t main() {
    int n, k;
    cin >> n >> k;
    vector<pii> c(n);
    for (int i = 0; i < n; i++) {
        cin >> c[i].fr >> c[i].se;
    }
    for (int i = 1; i <= k; i++) {
        cin >> v[i];
    }
    int ans = 0;
    for (int i = 0; i < n; i++) {
        bool curr = 0;
        for (int j = 1; j <= k; j++) {
            if (!curr) {
                if (c[i].fr <= v[j]) {
                    curr = 1;
                }
            } else {
                if (c[i].se <= v[j]) {
                    curr = 0;
                }
            }
        }
        if (curr) ans += c[i].se;
        else ans += c[i].fr;
    }
    cout << ans << "\n";
}
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 336 KB Output is correct
2 Correct 2 ms 336 KB Output is correct
3 Correct 4 ms 336 KB Output is correct
4 Correct 3 ms 336 KB Output is correct
5 Correct 3 ms 336 KB Output is correct
6 Correct 3 ms 336 KB Output is correct
7 Correct 3 ms 336 KB Output is correct
8 Correct 2 ms 336 KB Output is correct
9 Correct 2 ms 336 KB Output is correct
10 Correct 2 ms 336 KB Output is correct
11 Correct 3 ms 336 KB Output is correct
12 Correct 2 ms 504 KB Output is correct
13 Correct 2 ms 336 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 336 KB Output is correct
2 Correct 2 ms 336 KB Output is correct
3 Correct 4 ms 336 KB Output is correct
4 Correct 3 ms 336 KB Output is correct
5 Correct 3 ms 336 KB Output is correct
6 Correct 3 ms 336 KB Output is correct
7 Correct 3 ms 336 KB Output is correct
8 Correct 2 ms 336 KB Output is correct
9 Correct 2 ms 336 KB Output is correct
10 Correct 2 ms 336 KB Output is correct
11 Correct 3 ms 336 KB Output is correct
12 Correct 2 ms 504 KB Output is correct
13 Correct 2 ms 336 KB Output is correct
14 Correct 252 ms 592 KB Output is correct
15 Correct 956 ms 908 KB Output is correct
16 Correct 2150 ms 1140 KB Output is correct
17 Execution timed out 3056 ms 2384 KB Time limit exceeded
18 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 336 KB Output is correct
2 Correct 2 ms 336 KB Output is correct
3 Correct 4 ms 336 KB Output is correct
4 Correct 3 ms 336 KB Output is correct
5 Correct 3 ms 336 KB Output is correct
6 Correct 3 ms 336 KB Output is correct
7 Correct 3 ms 336 KB Output is correct
8 Correct 2 ms 336 KB Output is correct
9 Correct 2 ms 336 KB Output is correct
10 Correct 2 ms 336 KB Output is correct
11 Correct 3 ms 336 KB Output is correct
12 Correct 2 ms 504 KB Output is correct
13 Correct 2 ms 336 KB Output is correct
14 Correct 252 ms 592 KB Output is correct
15 Correct 956 ms 908 KB Output is correct
16 Correct 2150 ms 1140 KB Output is correct
17 Execution timed out 3056 ms 2384 KB Time limit exceeded
18 Halted 0 ms 0 KB -