結果

問題 No.466 ジオラマ
ユーザー 👑 kmjpkmjp
提出日時 2016-12-16 00:28:11
言語 C++11
(gcc 11.4.0)
結果
RE  
実行時間 -
コード長 1,775 bytes
コンパイル時間 1,587 ms
コンパイル使用メモリ 159,840 KB
実行使用メモリ 6,948 KB
最終ジャッジ日時 2024-05-07 15:25:07
合計ジャッジ時間 16,216 ms
ジャッジサーバーID
(参考情報)
judge2 / judge5
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 RE -
testcase_01 RE -
testcase_02 RE -
testcase_03 AC 2 ms
6,944 KB
testcase_04 RE -
testcase_05 RE -
testcase_06 RE -
testcase_07 RE -
testcase_08 RE -
testcase_09 RE -
testcase_10 RE -
testcase_11 RE -
testcase_12 RE -
testcase_13 RE -
testcase_14 RE -
testcase_15 RE -
testcase_16 RE -
testcase_17 RE -
testcase_18 RE -
testcase_19 RE -
testcase_20 RE -
testcase_21 RE -
testcase_22 RE -
testcase_23 RE -
testcase_24 RE -
testcase_25 RE -
testcase_26 RE -
testcase_27 RE -
testcase_28 RE -
testcase_29 RE -
testcase_30 RE -
testcase_31 RE -
testcase_32 WA -
testcase_33 WA -
testcase_34 RE -
testcase_35 RE -
testcase_36 WA -
testcase_37 AC 2 ms
6,944 KB
testcase_38 WA -
testcase_39 AC 1 ms
6,940 KB
testcase_40 WA -
testcase_41 AC 2 ms
6,944 KB
testcase_42 WA -
testcase_43 AC 1 ms
6,944 KB
testcase_44 WA -
testcase_45 AC 2 ms
6,940 KB
testcase_46 WA -
testcase_47 AC 1 ms
6,940 KB
testcase_48 WA -
testcase_49 AC 1 ms
6,940 KB
testcase_50 WA -
testcase_51 AC 2 ms
6,944 KB
testcase_52 WA -
testcase_53 AC 2 ms
6,940 KB
testcase_54 WA -
testcase_55 AC 1 ms
6,940 KB
testcase_56 AC 2 ms
6,940 KB
testcase_57 AC 1 ms
6,940 KB
testcase_58 AC 1 ms
6,944 KB
testcase_59 AC 1 ms
6,940 KB
testcase_60 AC 2 ms
6,940 KB
testcase_61 AC 2 ms
6,940 KB
testcase_62 AC 2 ms
6,940 KB
testcase_63 AC 2 ms
6,940 KB
testcase_64 AC 2 ms
6,944 KB
testcase_65 AC 1 ms
6,940 KB
testcase_66 RE -
testcase_67 RE -
testcase_68 RE -
testcase_69 RE -
testcase_70 RE -
testcase_71 RE -
testcase_72 RE -
testcase_73 RE -
testcase_74 RE -
testcase_75 RE -
testcase_76 RE -
testcase_77 RE -
testcase_78 RE -
testcase_79 RE -
testcase_80 RE -
testcase_81 RE -
testcase_82 WA -
testcase_83 AC 1 ms
6,940 KB
testcase_84 AC 3 ms
6,944 KB
testcase_85 RE -
testcase_86 AC 2 ms
6,940 KB
権限があれば一括ダウンロードができます

ソースコード

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