Submission #411607

#TimeUsernameProblemLanguageResultExecution timeMemory
411607MasterTasterFortune Telling 2 (JOI14_fortune_telling2)C++14
4 / 100
3057 ms1216 KiB
#include <bits/stdc++.h> #define pb push_back #define ll long long #define pii pair<int, int> #define xx first #define yy second #define MAXN 40010 using namespace std; int n, k; bool koji[MAXN]; ll a[MAXN], b[MAXN], ress; int main(){ ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0); cin>>n>>k; for (int i=0; i<n; i++) cin>>a[i]>>b[i]; while (k--) { int t; cin>>t; for (int i=0; i<n; i++) { if (koji[i]==0) { if (a[i]<=t) koji[i]=1; } else { if (b[i]<=t) koji[i]=0; } } } for (int i=0; i<n; i++) if (koji[i]==0) ress+=a[i]; else ress+=b[i]; cout<<ress; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...