結果

問題 No.466 ジオラマ
ユーザー kmjp
提出日時 2016-12-16 00:28:11
言語 C++11(廃止可能性あり)
(gcc 13.3.0)
結果
RE  
実行時間 -
コード長 1,775 bytes
コンパイル時間 1,333 ms
コンパイル使用メモリ 160,256 KB
実行使用メモリ 6,824 KB
最終ジャッジ日時 2024-11-30 09:08:46
合計ジャッジ時間 17,672 ms
ジャッジサーバーID
(参考情報)
judge1 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 1 RE * 3
other AC * 23 WA * 13 RE * 47
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
using namespace std;
typedef signed long long ll;

#undef _P
#define _P(...) (void)printf(__VA_ARGS__)
#define FOR(x,to) for(x=0;x<(to);x++)
#define FORR(x,arr) for(auto& x:arr)
#define ITR(x,c) for(__typeof(c.begin()) x=c.begin();x!=c.end();x++)
#define ALL(a) (a.begin()),(a.end())
#define ZERO(a) memset(a,0,sizeof(a))
#define MINUS(a) memset(a,0xff,sizeof(a))
//-------------------------------------------------------

int A,B,C,D;

void solve() {
	int i,j,k,l,r,x,y; string s;
	
	cin>>A>>B>>C>>D;
	if(A==C && B==C) {
		if(A==1) return _P("2 0\n");
		if(D<C) return _P("-1\n");
		_P("%d %d\n",C,C);
		FOR(i,A) _P("%d %d\n",i,(i+1)%A);
		return;
	}
	if(A==C) {
		if(A==1) {
			if(D<B-1) return _P("-1\n");
			_P("%d %d\n",B,B-1);
			x=1,y=2;
			FOR(i,B-A-1) _P("%d %d\n",x++,y++);
			_P("%d %d\n",x,0);
		}
		else {
			if(D<B) return _P("-1\n");
			_P("%d %d\n",B,B);
			x=1,y=2;
			FOR(i,B-A-1) _P("%d %d\n",x++,y++);
			_P("%d %d\n",x++,0), y++;
			FOR(i,A) {
				if(i==0) _P("0 %d\n",x);
				else if(i==A-1) _P("%d 0\n",x);
				else _P("%d %d\n",x++,y++);
			}
		}
		return;
	}
	if(B==C) {
		if(B==1) {
			if(D<A-1) return _P("-1\n");
			_P("%d %d\n",A,A-1);
			x=0,y=2;
			FOR(i,A-B-1) _P("%d %d\n",x,y), x=y++;
			_P("%d %d\n",x,1);
		}
		else {
			if(D<A) return _P("-1\n");
			_P("%d %d\n",A,A);
			x=0,y=2;
			FOR(i,A-B-1) _P("%d %d\n",x,y), x=y++;
			_P("%d %d\n",x++,1), y++;
			FOR(i,B) {
				if(i==0) _P("1 %d\n",x);
				else if(i==B-1) _P("%d 1\n",x);
				else _P("%d %d\n",x++,y++);
			}
		}
		return;
	}
	assert(0);
	
}


int main(int argc,char** argv){
	string s;int i;
	if(argc==1) ios::sync_with_stdio(false), cin.tie(0);
	FOR(i,argc-1) s+=argv[i+1],s+='\n';
	FOR(i,s.size()) ungetc(s[s.size()-1-i],stdin);
	solve(); return 0;
}
0