답안 #212712

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
212712 2020-03-24T07:28:40 Z username 함박 스테이크 (JOI20_hamburg) C++14
컴파일 오류
0 ms 0 KB
#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,1e9L,1e9L};
			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

hamburg.cpp:26:6: warning: ISO C++ forbids declaration of 'main' with no type [-Wreturn-type]
   26 | main(){
      |      ^
hamburg.cpp: In function 'int main()':
hamburg.cpp:35:26: error: narrowing conversion of '1.0e+9l' from 'long double' to 'int' [-Wnarrowing]
   35 |    nd un=nd{1,1,1e9L,1e9L};
      |                          ^
hamburg.cpp:35:26: error: narrowing conversion of '1.0e+9l' from 'long double' to 'int' [-Wnarrowing]