結果

問題 No.630 門松グラフ
ユーザー te-shte-sh
提出日時 2018-07-24 17:01:35
言語 D
(dmd 2.105.2)
結果
WA  
実行時間 -
コード長 815 bytes
コンパイル時間 701 ms
コンパイル使用メモリ 98,396 KB
実行使用メモリ 4,380 KB
最終ジャッジ日時 2023-09-03 20:48:47
合計ジャッジ時間 4,556 ms
ジャッジサーバーID
(参考情報)
judge15 / judge12
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
4,380 KB
testcase_01 AC 2 ms
4,376 KB
testcase_02 AC 2 ms
4,380 KB
testcase_03 AC 1 ms
4,376 KB
testcase_04 AC 1 ms
4,380 KB
testcase_05 AC 1 ms
4,380 KB
testcase_06 AC 1 ms
4,376 KB
testcase_07 WA -
testcase_08 AC 1 ms
4,376 KB
testcase_09 AC 1 ms
4,380 KB
testcase_10 AC 1 ms
4,380 KB
testcase_11 WA -
testcase_12 AC 1 ms
4,376 KB
testcase_13 AC 1 ms
4,376 KB
testcase_14 AC 2 ms
4,380 KB
testcase_15 WA -
testcase_16 AC 1 ms
4,376 KB
testcase_17 AC 1 ms
4,380 KB
testcase_18 AC 1 ms
4,376 KB
testcase_19 AC 1 ms
4,376 KB
testcase_20 AC 2 ms
4,376 KB
testcase_21 AC 1 ms
4,380 KB
testcase_22 AC 1 ms
4,380 KB
testcase_23 AC 2 ms
4,380 KB
testcase_24 AC 42 ms
4,380 KB
testcase_25 AC 1 ms
4,380 KB
testcase_26 AC 42 ms
4,380 KB
testcase_27 AC 42 ms
4,380 KB
testcase_28 AC 1 ms
4,376 KB
testcase_29 AC 70 ms
4,376 KB
testcase_30 AC 66 ms
4,380 KB
testcase_31 AC 56 ms
4,380 KB
testcase_32 AC 37 ms
4,376 KB
testcase_33 AC 23 ms
4,376 KB
testcase_34 AC 44 ms
4,380 KB
testcase_35 AC 29 ms
4,380 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import std.algorithm, std.container, std.conv, std.math, std.range, std.typecons, std.stdio, std.string;

auto rdsp(){return readln.splitter;}
void pick(R,T)(ref R r,ref T t){t=r.front.to!T;r.popFront;}
void readV(T...)(ref T t){auto r=rdsp;foreach(ref v;t)pick(r,v);}
void writeA(T)(size_t n,T t){foreach(i,v;t.enumerate){write(v);if(i<n-1)write(" ");}writeln;}

void main()
{
  int n, m; readV(n, m);
  auto k = n/2;

  if (m < n-1 || m > k*(n-k)) {
    writeln("NO");
    return;
  }

  writeln("YES");
  writeA(n, iota(1, n+1));

  foreach (i; 0..k) {
    writeln(i+1, " ", k+i+1);
    if (k+i+1 < n) writeln(i+1, " ", k+i+2);
  }
  auto c = n-1;

  foreach (i; 0..k)
    foreach (j; k..n) {
      if (i+k == j || i+k+1 == j) continue;
      writeln(i+1, " ", j+1);
      ++c;
      if (c == m) return;
    }
}
0