제출 #1171002

#제출 시각아이디문제언어결과실행 시간메모리
1171002laure함박 스테이크 (JOI20_hamburg)C++20
2 / 100
62 ms6472 KiB
#include<bits/stdc++.h> #define int long long using namespace std; using pii=pair<pair<int,int>,pair<int,int>>; signed main() { ios::sync_with_stdio(0); cin.tie(0); cout.tie(0); int n,k,num=1; cin>>n>>k; map<int,pii>m; vector<pii>v(n); for(int i=0;i<n;i++)cin>>v[i].first.first>>v[i].second.first>>v[i].first.second>>v[i].second.second; sort(v.begin(),v.end()); m[1]=v[0]; for(int i=1;i<n;i++) { pii x=v[i]; bool b=0; for(int j=1;j<=num;j++) { if(x.first.first<=m[j].first.first&&x.first.second>=m[j].first.second) { if(x.second.first<=m[j].second.first&&x.second.second>=m[j].second.second){b=1;break;} if(x.second.first>=m[j].second.first&&x.second.first<=m[j].second.second){m[j].second.first=x.second.first;b=1;} if(x.second.second>=m[j].second.first&&x.second.second<=m[j].second.second){m[j].second.second=x.second.second;b=1;} } if(x.first.first>=m[j].first.first&&x.first.first<=m[j].first.second) { if(x.second.first<=m[j].second.first&&x.second.second>=m[j].second.second){m[j].first.first=x.first.first;b=1;break;} if(x.second.first>=m[j].second.first&&x.second.first<=m[j].second.second){m[j].first.first=x.first.first;m[j].second.first=x.second.first;b=1;} if(x.second.second>=m[j].second.first&&x.second.second<=m[j].second.second){m[j].first.first=x.first.first;m[j].second.second=x.second.second;b=1;} } if(x.first.second>=m[j].first.first&&x.first.second<=m[j].first.second) { if(x.second.first<=m[j].second.first&&x.second.second>=m[j].second.second){m[j].first.second=x.first.second;b=1;break;} if(x.second.first>=m[j].second.first&&x.second.first<=m[j].second.second){m[j].first.second=x.first.second;m[j].second.first=x.second.first;b=1;} if(x.second.second>=m[j].second.first&&x.second.second<=m[j].second.second){m[j].first.second=x.first.second;m[j].second.second=x.second.second;b=1;} } if(b)break; } if(!b) { num++; m[num]=x; } } for(int i=1;i<=min(num,k);i++) { cout<<m[i].first.first<<" "<<m[i].second.first<<'\n'; } for(int i=k-num;i>0;i--)cout<<m[1].first.first<<" "<<m[1].second.first<<'\n'; }
#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...