結果

問題 No.3012 岩井星人グラフ
ユーザー tnakao0123
提出日時 2025-01-28 14:30:09
言語 C++17
(gcc 13.3.0 + boost 1.87.0)
結果
AC  
実行時間 31 ms / 2,000 ms
コード長 571 bytes
コンパイル時間 581 ms
コンパイル使用メモリ 40,056 KB
実行使用メモリ 6,820 KB
最終ジャッジ日時 2025-01-28 14:30:18
合計ジャッジ時間 7,294 ms
ジャッジサーバーID
(参考情報)
judge2 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 2
other AC * 23
権限があれば一括ダウンロードができます
コンパイルメッセージ
main.cpp: In function ‘int main()’:
main.cpp:19:8: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
   19 |   scanf("%d%d", &x, &y);
      |   ~~~~~^~~~~~~~~~~~~~~~

ソースコード

diff #

/* -*- coding: utf-8 -*-
 *
 * 3012.cc:  No.3012 蟯ゥ莠墓弌莠コ繧ー繝ゥ繝・- yukicoder
 */

#include<cstdio>
#include<algorithm>

using namespace std;

/* subroutines */

inline void pedge(int u, int v) { printf("%d %d\n", u + 1, v + 1); }

/* main */

int main() {
  int x, y;
  scanf("%d%d", &x, &y);

  int xy = x * y;
  printf("%d %d\n", xy, xy);
  
  for (int i = 0; i < x; i++) pedge(i, (i + 1) % x);

  for (int i = 0, k = x; i < x; i++)
    for (int j = 1, u = i; j < y; j++) {
      int v = k++;
      pedge(u, v);
      u = v;
    }

  return 0;
}
0