Submission #289948

#TimeUsernameProblemLanguageResultExecution timeMemory
289948mhy908Hamburg Steak (JOI20_hamburg)C++14
21 / 100
3086 ms6292 KiB
#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)

hamburg.cpp: In function 'int main()':
hamburg.cpp:18:10: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
   18 |     scanf("%d %d", &n, &k);
      |     ~~~~~^~~~~~~~~~~~~~~~~
hamburg.cpp:19:33: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
   19 |     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);
      |                            ~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
#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...