제출 #1305073

#제출 시각아이디문제언어결과실행 시간메모리
1305073lsjo운세 보기 2 (JOI14_fortune_telling2)C++20
4 / 100
3094 ms920 KiB
#include <bits/stdc++.h>
using namespace std;
#pragma gcc optimise("ofast,unroll-loops")
#pragma gcc target("avx")
#define int long long

int a[40005], b[40005];
bool nums[40005];

signed main() {
    cin.tie(0);
    cin.sync_with_stdio(0);

    int n, k; cin >> n >> k;
    int total=0;
    for (int i = 0; i < n; i++) {
        cin >> a[i] >> b[i];
        total+=a[i];
    }

    for (int i = 0; i < k; i++) {
        int t; cin >> t;
        for (int j = 0; j < n; j++) {
            if (a[j] <= t) {
                swap(a[j],b[j]);
                total = total+a[j]-b[j];
            }
        }
    }

    cout << total << "\n";

}
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...