結果

問題 No.466 ジオラマ
ユーザー te-shte-sh
提出日時 2017-12-07 16:57:28
言語 D
(dmd 2.106.1)
結果
WA  
実行時間 -
コード長 1,635 bytes
コンパイル時間 567 ms
コンパイル使用メモリ 86,456 KB
実行使用メモリ 4,384 KB
最終ジャッジ日時 2023-09-03 17:19:00
合計ジャッジ時間 5,139 ms
ジャッジサーバーID
(参考情報)
judge14 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

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

ソースコード

diff #

import std.algorithm, std.conv, std.range, std.stdio, std.string;

void main()
{
  auto rd = readln.split.to!(int[]), a = rd[0], b = rd[1], c = rd[2], d = rd[3];
  auto v0 = a-c, v1 = b-c, v2 = c, v = a+b-c;

  if (v < 2) {
    writeln(-1);
    return;
  } else if (v2 == 0) {
    auto e = v0-1 + v1-1;
    if (d < e) {
      writeln(-1);
      return;
    }
    writeln(v, " ", e);
    foreach (i; 0..v0-1)
      writeln(0, " ", i+2);
    foreach (i; 0..v1-1)
      writeln(1, " ", i+v0+1);
  } else if (v0 > 0 && v1 > 0) {
    auto e = v0-1 + v1-1 + v2+1;
    if (d < e) {
      writeln(-1);
      return;
    }
    writeln(v, " ", e);
    foreach (i; 0..v0-1)
      writeln(0, " ", i+2);
    foreach (i; 0..v1-1)
      writeln(1, " ", i+v0+1);
    writeln(0, " ", v0+v1);
    writeln(1, " ", v0+v1);
    foreach (i; 0..v2-1)
      writeln(v0+v1, " ", i+v0+v1+1);
  } else if (v0 == 0 && v1 > 0) {
    auto e = v2-1 + v1-1 + 1;
    if (d < e) {
      writeln(-1);
      return;
    }
    writeln(v, " ", e);
    writeln(1, " ", 0);
    foreach (i; 0..v2-1)
      writeln(0, " ", i+2);
    foreach (i; 0..v1-1)
      writeln(1, " ", i+v2+1);
  } else if (v0 > 0 && v1 == 0) {
    auto e = v2-1 + v0-1 + 1;
    if (d < e) {
      writeln(-1);
      return;
    }
    writeln(v, " ", e);
    writeln(0, " ", 1);
    foreach (i; 0..v2-1)
      writeln(1, " ", i+2);
    foreach (i; 0..v0-1)
      writeln(0, " ", i+v2+1);
  } else {
    auto e = v2+2;
    if (d < e) {
      writeln(-1);
      return;
    }
    writeln(v, " ", e);
    writeln(0, " ", 1);
    writeln(1, " ", 0);
    foreach (i; 0..v2)
      writeln(0, " ", i+2);
  }
}
0