# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
289948 | mhy908 | Hamburg Steak (JOI20_hamburg) | C++14 | 3086 ms | 6292 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 <bits/stdc++.h>
#define eb emplace_back
#define mp make_pair
#define F first
#define S second
#define all(x) x.begin(), x.end()
using namespace std;
typedef long long LL;
typedef pair<int, int> pii;
const int inf=1e9;
int n, k;
pair<pii, pii> rct[200010], ans[5];
vector<int> vc;
int main(){
srand(time(NULL));
scanf("%d %d", &n, &k);
for(int i=1; i<=n; i++)scanf("%d %d %d %d", &rct[i].F.F, &rct[i].F.S, &rct[i].S.F, &rct[i].S.S);
for(int i=1; i<=n; i++)vc.eb(i);
while(1){
vector<int> n, y;
for(int i=1; i<=k; i++)ans[i]=mp(mp(1, 1), mp(inf, inf));
for(auto i:vc){
bool flg2=false;
for(int j=1; j<=k; j++){
int sx=max(rct[i].F.F, ans[j].F.F);
int sy=max(rct[i].F.S, ans[j].F.S);
int ex=min(rct[i].S.F, ans[j].S.F);
int ey=min(rct[i].S.S, ans[j].S.S);
if(sx<=ex&&sy<=ey){
ans[j]=mp(mp(sx, sy), mp(ex, ey));
flg2=true;
break;
}
}
if(!flg2)n.eb(i);
else y.eb(i);
}
if(!n.size())break;
vc.clear();
for(auto i:n)vc.eb(i);
for(auto i:y)vc.eb(i);
}
for(int i=1; i<=k; i++)printf("%d %d\n", ans[i].F.F, ans[i].F.S);
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... |