Submission #710462

#TimeUsernameProblemLanguageResultExecution timeMemory
710462groshiHotel (CEOI11_hot)C++17
40 / 100
4098 ms32156 KiB
#include<iostream> #define int long long using namespace std; int t[600000][2]; int mam[600000][2]; int32_t main() { cin.tie(0); cout.tie(0); ios_base::sync_with_stdio(0); int n,m,o,x,y,z; cin>>n>>m>>o; for(int i=1;i<=n;i++) { cin>>x>>y; t[i][0]=x; t[i][1]=y; } for(int i=1;i<=m;i++) { cin>>x>>y; mam[i][0]=x; mam[i][1]=y; } int wynik=0; for(int i=1;i<=o;i++) { int maxx=0; int gdzie1=0; int gdzie2=0; for(int a=1;a<=m;a++) { if(mam[a][0]==-1) continue; int maxx1=0; int gdzie=0; for(int b=1;b<=n;b++) { if(mam[a][1]>t[b][1]) continue; if(t[b][0]==-1) continue; if(mam[a][0]-t[b][0]>maxx1) { gdzie=b; maxx1=mam[a][0]-t[b][0]; } } if(maxx1>maxx) { maxx=maxx1; gdzie1=gdzie; gdzie2=a; } } wynik+=maxx; t[gdzie1][0]=-1; mam[gdzie2][0]=-1; } cout<<wynik; return 0; }

Compilation message (stderr)

hot.cpp: In function 'int32_t main()':
hot.cpp:11:19: warning: unused variable 'z' [-Wunused-variable]
   11 |     int n,m,o,x,y,z;
      |                   ^
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...