Submission #519220

#TimeUsernameProblemLanguageResultExecution timeMemory
519220amunduzbaevFortune Telling 2 (JOI14_fortune_telling2)C++14
4 / 100
3024 ms1528 KiB
#include "bits/stdc++.h" using namespace std; #define ar array signed main(){ ios::sync_with_stdio(0); cin.tie(0); int n, k; cin>>n>>k; vector<ar<int, 2>> a(n); for(int i=0;i<n;i++) cin>>a[i][0]>>a[i][1]; vector<int> t(n); for(int i=0;i<k;i++){ int x; cin>>x; for(int j=0;j<n;j++){ if(a[j][t[j]] <= x) t[j] ^= 1; } } long long res = 0; for(int i=0;i<n;i++) res += a[i][t[i]]; cout<<res<<"\n"; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...