Submission #218055

# Submission time Handle Problem Language Result Execution time Memory
218055 2020-03-31T18:57:54 Z andreiomd Fortune Telling 2 (JOI14_fortune_telling2) C++11
4 / 100
9 ms 768 KB
#include <bits/stdc++.h>

using namespace std;

const int NMAX = 2e5 + 5;

int N, K;

int A[NMAX], B[NMAX], T[NMAX];

static inline void Read ()
{
    ios_base :: sync_with_stdio(false);
    cin.tie(NULL);

    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];

    return;
}

static inline void Brute ()
{
    for(int i = 1; i <= K; ++i)
    {
        for(int j = 1; j <= N; ++j)
            if(A[j] <= T[i])
                swap(A[j], B[j]);
    }

    long long Sum = 0;

    for(int i = 1; i <= N; ++i)
        Sum += 1LL * A[i];

    cout << Sum << '\n';

    return;
}

static inline void Solve ()
{
    if(N <= 1e3 && K <=  1e3)
        Brute();

    return;
}

int main()
{
    Read();

    Solve();

    return 0;
}
# Verdict Execution time Memory Grader output
1 Correct 6 ms 384 KB Output is correct
2 Correct 6 ms 384 KB Output is correct
3 Correct 8 ms 384 KB Output is correct
4 Correct 8 ms 384 KB Output is correct
5 Correct 8 ms 384 KB Output is correct
6 Correct 8 ms 384 KB Output is correct
7 Correct 8 ms 384 KB Output is correct
8 Correct 6 ms 384 KB Output is correct
9 Correct 6 ms 384 KB Output is correct
10 Correct 6 ms 384 KB Output is correct
11 Correct 8 ms 384 KB Output is correct
12 Correct 7 ms 384 KB Output is correct
13 Correct 8 ms 384 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 6 ms 384 KB Output is correct
2 Correct 6 ms 384 KB Output is correct
3 Correct 8 ms 384 KB Output is correct
4 Correct 8 ms 384 KB Output is correct
5 Correct 8 ms 384 KB Output is correct
6 Correct 8 ms 384 KB Output is correct
7 Correct 8 ms 384 KB Output is correct
8 Correct 6 ms 384 KB Output is correct
9 Correct 6 ms 384 KB Output is correct
10 Correct 6 ms 384 KB Output is correct
11 Correct 8 ms 384 KB Output is correct
12 Correct 7 ms 384 KB Output is correct
13 Correct 8 ms 384 KB Output is correct
14 Incorrect 9 ms 768 KB Output isn't correct
15 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 6 ms 384 KB Output is correct
2 Correct 6 ms 384 KB Output is correct
3 Correct 8 ms 384 KB Output is correct
4 Correct 8 ms 384 KB Output is correct
5 Correct 8 ms 384 KB Output is correct
6 Correct 8 ms 384 KB Output is correct
7 Correct 8 ms 384 KB Output is correct
8 Correct 6 ms 384 KB Output is correct
9 Correct 6 ms 384 KB Output is correct
10 Correct 6 ms 384 KB Output is correct
11 Correct 8 ms 384 KB Output is correct
12 Correct 7 ms 384 KB Output is correct
13 Correct 8 ms 384 KB Output is correct
14 Incorrect 9 ms 768 KB Output isn't correct
15 Halted 0 ms 0 KB -