# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
710462 | groshi | Hotel (CEOI11_hot) | C++17 | 4098 ms | 32156 KiB |
This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#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)
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |