Submission #1173817

#TimeUsernameProblemLanguageResultExecution timeMemory
1173817chikien2009Fortune Telling 2 (JOI14_fortune_telling2)C++20
4 / 100
3 ms328 KiB
#include <bits/stdc++.h>

using namespace std;

void setup()
{
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
}

int n, k, t, a[1000], b[1000];
long long res = 0;

int main()
{
    setup();

    cin >> n >> k;
    for (int i = 0; i < n; ++i)
    {
        cin >> a[i] >> b[i];
    }
    while (k--)
    {
        cin >> t;
        for (int i = 0; i < n; ++i)
        {
            if (a[i] <= t)
            {
                swap(a[i], b[i]);
            }
        }
    }
    for (int i = 0; i < n; ++i)
    {
        res += a[i];
    }
    cout << res;
    return 0;
}
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...