Submission #971788

#TimeUsernameProblemLanguageResultExecution timeMemory
971788AiperiiiFortune Telling 2 (JOI14_fortune_telling2)C++14
4 / 100
3024 ms2156 KiB
#include <bits/stdc++.h> #define int long long #define ff first #define ss second #define pb push_back #define all(x) x.begin(),x.end() using namespace std; signed main(){ ios_base::sync_with_stdio(); cin.tie(0);cout.tie(0); int n,m; cin>>n>>m; vector <int> c(m),cnt(n); vector <vector <int> > a(2,vector <int> (n)); for(int i=0;i<n;i++)cin>>a[0][i]>>a[1][i]; for(int i=0;i<m;i++)cin>>c[i]; for(int i=0;i<m;i++){ for(int j=0;j<n;j++){ if(a[cnt[j]%2][j]<=c[i]){ cnt[j]++; } } } int ans=0; for(int i=0;i<n;i++){ ans+=a[cnt[i]%2][i]; } cout<<ans<<"\n"; } /* 5 3 4 6 9 1 8 8 4 2 3 7 8 2 9 */
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...