結果

問題 No.1169 Row and Column and Diagonal
ユーザー kyo1kyo1
提出日時 2020-10-29 09:29:56
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
WA  
実行時間 -
コード長 520 bytes
コンパイル時間 2,143 ms
コンパイル使用メモリ 202,648 KB
実行使用メモリ 4,504 KB
最終ジャッジ日時 2023-09-29 03:57:17
合計ジャッジ時間 7,056 ms
ジャッジサーバーID
(参考情報)
judge15 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 WA -
testcase_01 AC 2 ms
4,380 KB
testcase_02 WA -
testcase_03 WA -
testcase_04 WA -
testcase_05 WA -
testcase_06 WA -
testcase_07 WA -
testcase_08 WA -
testcase_09 WA -
testcase_10 WA -
testcase_11 WA -
testcase_12 WA -
testcase_13 WA -
testcase_14 WA -
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>

using namespace std;

int main() {
  ios::sync_with_stdio(false);
  cin.tie(nullptr);
  int N;
  cin >> N;
  vector<vector<int>> X(N, vector<int>(N, 0));
  for (int i = 0; i < N; i++) {
    X[i][i] = i;
    int cur = 0;
    for (int j = 0; j < N; j++) {
      if (j == i) {
        X[i][j] = i;
      } else {
        X[i][j] = cur;
      }
      cur++;
    }
  }
  for (auto x : X) {
    for (const auto& e : x) {
      cout << e + 1 << (&e == &x.back() ? '\n' : ' ');
    }
  }
  return 0;
}
0