結果

問題 No.466 ジオラマ
ユーザー startcppstartcpp
提出日時 2016-12-30 16:59:37
言語 C++11
(gcc 11.4.0)
結果
WA  
実行時間 -
コード長 1,039 bytes
コンパイル時間 845 ms
コンパイル使用メモリ 61,272 KB
実行使用メモリ 4,388 KB
最終ジャッジ日時 2023-08-22 08:31:40
合計ジャッジ時間 6,306 ms
ジャッジサーバーID
(参考情報)
judge13 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

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

ソースコード

diff #

#include <iostream>
#include <algorithm>
using namespace std;

int a, b, c, d;
bool is_swap = false;

int main() {
	cin >> a >> b >> c >> d;
	if (a > b) { swap(a, b); is_swap = true; }
	
	if (c == 0) {
		if (a + b - 2 > d) { cout << -1 << endl; return 0; }
		cout << a + b << " " << a + b - 2 << endl;
		for (int i = 0; i < a - 1; i++) {
			cout << is_swap << " " << 2 + i << endl;
		}
		for (int i = 0; i < b - 1; i++) {
			cout << (!is_swap) << " " << a + 1 + i << endl;
		}
		return 0;
	}
	
	if ((a == b && b == c) || b - 1 + a - c > d) { cout << -1 << endl; return 0; }
	
	cout << b + a - c << " " << b - 1 + a - c << endl;
	
	if (a >= 2) cout << is_swap << " " << 2 << endl;
	for (int i = 0; i < a - 2; i++) {
		cout << 2 + i << " " << 3 + i << endl;
	}
	
	int prev_id = a - c + 1; if (prev_id == 1) prev_id = (is_swap);
	int id = ((b + a - c == a + 1) ? (!is_swap) : a + 1);
	for (int i = 0; i < b - c; i++) {
		cout << id << " " << prev_id << endl;
		prev_id = id;
		if (i + 2 == b - c) id = (!is_swap);
		else id++;
	}
	return 0;
}
0