Submission #410851

# Submission time Handle Problem Language Result Execution time Memory
410851 2021-05-23T20:20:47 Z iliccmarko Fortune Telling 2 (JOI14_fortune_telling2) C++14
4 / 100
3000 ms 1416 KB
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define endl "\n"
#define INF 1000000000
#define LINF 10000000000000000LL
#define pb push_back
#define all(x) x.begin(), x.end()
#define len(s) (int)s.size()
#define test_case { int t; cin>>t; while(t--)solve(); }
#define single_case solve();
#define line cerr<<"----------"<<endl;
#define ios { ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL); cerr.tie(NULL); }
#define mod 1000000007LL
const int N = 2e5 + 50;
int a[N], b[N], n;



int main()
{
    ios
    cin>>n;
    int k;
    cin>>k;
    for(int i = 0;i<n;i++) cin>>a[i]>>b[i];
    while(k--)
    {
        int x;
        cin>>x;
        for(int i = 0;i<n;i++) if(a[i]<=x) swap(a[i], b[i]);
    }

    ll ans = 0;
    for(int i = 0;i<n;++i) ans += (ll)a[i];

    cout<<ans;



    return 0;
}
# Verdict Execution time Memory Grader output
1 Correct 1 ms 448 KB Output is correct
2 Correct 3 ms 332 KB Output is correct
3 Correct 4 ms 332 KB Output is correct
4 Correct 4 ms 332 KB Output is correct
5 Correct 6 ms 332 KB Output is correct
6 Correct 4 ms 332 KB Output is correct
7 Correct 5 ms 332 KB Output is correct
8 Correct 3 ms 332 KB Output is correct
9 Correct 2 ms 336 KB Output is correct
10 Correct 2 ms 332 KB Output is correct
11 Correct 4 ms 332 KB Output is correct
12 Correct 4 ms 332 KB Output is correct
13 Correct 5 ms 332 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 448 KB Output is correct
2 Correct 3 ms 332 KB Output is correct
3 Correct 4 ms 332 KB Output is correct
4 Correct 4 ms 332 KB Output is correct
5 Correct 6 ms 332 KB Output is correct
6 Correct 4 ms 332 KB Output is correct
7 Correct 5 ms 332 KB Output is correct
8 Correct 3 ms 332 KB Output is correct
9 Correct 2 ms 336 KB Output is correct
10 Correct 2 ms 332 KB Output is correct
11 Correct 4 ms 332 KB Output is correct
12 Correct 4 ms 332 KB Output is correct
13 Correct 5 ms 332 KB Output is correct
14 Correct 347 ms 680 KB Output is correct
15 Correct 1358 ms 1052 KB Output is correct
16 Execution timed out 3035 ms 1416 KB Time limit exceeded
17 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 448 KB Output is correct
2 Correct 3 ms 332 KB Output is correct
3 Correct 4 ms 332 KB Output is correct
4 Correct 4 ms 332 KB Output is correct
5 Correct 6 ms 332 KB Output is correct
6 Correct 4 ms 332 KB Output is correct
7 Correct 5 ms 332 KB Output is correct
8 Correct 3 ms 332 KB Output is correct
9 Correct 2 ms 336 KB Output is correct
10 Correct 2 ms 332 KB Output is correct
11 Correct 4 ms 332 KB Output is correct
12 Correct 4 ms 332 KB Output is correct
13 Correct 5 ms 332 KB Output is correct
14 Correct 347 ms 680 KB Output is correct
15 Correct 1358 ms 1052 KB Output is correct
16 Execution timed out 3035 ms 1416 KB Time limit exceeded
17 Halted 0 ms 0 KB -