Submission #212715

#TimeUsernameProblemLanguageResultExecution timeMemory
212715usernameHamburg Steak (JOI20_hamburg)C++14
6 / 100
3081 ms3600 KiB
#include<bits/stdc++.h> using namespace std; typedef pair<int,int> pii; #define REP(i,j,k) for(int i=j;i<k;++i) #define pb push_back #define f first #define s second #define endl '\n' #define IOS cin.tie(0),cout.tie(0),ios_base::sync_with_stdio(false) struct nd{ int l,d,r,u; }; const int maxn=2e5+9; int n,p; nd a[maxn]; pii res[5]; bitset<maxn>vis; mt19937 rd(time(0)); nd merge(nd x,nd y){ return nd{max(x.l,y.l),max(x.d,y.d),min(x.r,y.r),min(x.u,y.u)}; } main(){ IOS; cin>>n>>p; REP(i,0,n)cin>>a[i].l>>a[i].d>>a[i].r>>a[i].u; while(1){ shuffle(a,a+n,rd); vis.reset(); int c=0; REP(k,0,p){ nd un=nd{1,1,1000000000,1000000000}; REP(i,0,n){ if(vis[i])continue; nd tt=merge(un,a[i]); if(tt.d<=tt.u&&tt.l<=tt.r){ ++c; vis[i]=1; un=tt; } } res[k]={un.l,un.d}; } if(c==n){ REP(i,0,p)cout<<res[i].f<<" "<<res[i].s<<endl; return 0; } } }

Compilation message (stderr)

hamburg.cpp:26:6: warning: ISO C++ forbids declaration of 'main' with no type [-Wreturn-type]
   26 | main(){
      |      ^
#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...