답안 #47688

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
47688 2018-05-06T09:46:57 Z qoo2p5 운세 보기 2 (JOI14_fortune_telling2) C++17
4 / 100
2000 ms 2256 KB
#include <bits/stdc++.h>

using namespace std;

typedef long long ll;

const int INF = (int) 1e9 + 1e6 + 123;
const ll LINF = (ll) 1e18 + 1e9 + 123;

#define rep(i, s, t) for (auto i = (s); i < (t); ++(i))
#define per(i, s, t) for (auto i = (s); i >= (t); --(i))
#define sz(x) ((int)(x).size())
#define mp make_pair
#define pb push_back
#define all(x) (x).begin(), (x).end()

bool mini(auto &x, const auto &y) {
    if (y < x) {
        x = y;
        return 1;
    }
    return 0;
}

bool maxi(auto &x, const auto &y) {
    if (y > x) {
        x = y;
        return 1;
    }
    return 0;
}

void run();

int main() {
    ios::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
    run();
    return 0;
}

const int N = (int) 2e5 + 123;

int n, k;
int a[N], b[N];

void run() {
    cin >> n >> k;
    rep(i, 0, n) {
        cin >> a[i] >> b[i];
    }
    while (k--) {
        int t;
        cin >> t;
        rep(i, 0, n) {
            if (a[i] <= t) {
                swap(a[i], b[i]);
            }
        }
    }
    ll ans = 0;
    rep(i, 0, n) {
        ans += a[i];
    }
    cout << ans << "\n";
}
# 결과 실행 시간 메모리 Grader output
1 Correct 3 ms 376 KB Output is correct
2 Correct 4 ms 448 KB Output is correct
3 Correct 6 ms 448 KB Output is correct
4 Correct 6 ms 492 KB Output is correct
5 Correct 7 ms 492 KB Output is correct
6 Correct 5 ms 620 KB Output is correct
7 Correct 6 ms 620 KB Output is correct
8 Correct 5 ms 620 KB Output is correct
9 Correct 3 ms 620 KB Output is correct
10 Correct 3 ms 704 KB Output is correct
11 Correct 7 ms 704 KB Output is correct
12 Correct 7 ms 704 KB Output is correct
13 Correct 6 ms 704 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 371 ms 728 KB Output is correct
2 Correct 1429 ms 1404 KB Output is correct
3 Execution timed out 2078 ms 2256 KB Time limit exceeded
4 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Execution timed out 2080 ms 2256 KB Time limit exceeded
2 Halted 0 ms 0 KB -