結果

問題 No.1169 Row and Column and Diagonal
ユーザー ytqm3
提出日時 2021-05-18 16:37:04
言語 C++17
(gcc 13.3.0 + boost 1.87.0)
結果
AC  
実行時間 22 ms / 2,000 ms
コード長 367 bytes
コンパイル時間 2,061 ms
コンパイル使用メモリ 197,624 KB
最終ジャッジ日時 2025-01-21 13:42:04
ジャッジサーバーID
(参考情報)
judge5 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 2
other AC * 13
権限があれば一括ダウンロードができます

ソースコード

diff #

#include<bits/stdc++.h>
using namespace std;

int main()
{
  int N;
  cin>>N;
  vector<vector<int>> a(N,vector<int> (N));
  for(int i=0;i<N;++i)
  {
    for(int j=0;j<N;++j)
    {
      a[(i+j)%N][(i+j*(N/2+1))%N]=i;
    }
  }
  for(int i=0;i<N;++i)
  {
    for(int j=0;j<N-1;++j)
    {
      cout<<a[i][j]+1<<' ';
    }
    cout<<a[i][N-1]+1<<endl;
  }
  return 0;
}
0