結果
| 問題 |
No.1169 Row and Column and Diagonal
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2020-08-14 21:38:46 |
| 言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
AC
|
| 実行時間 | 22 ms / 2,000 ms |
| コード長 | 508 bytes |
| コンパイル時間 | 680 ms |
| コンパイル使用メモリ | 73,080 KB |
| 実行使用メモリ | 6,820 KB |
| 最終ジャッジ日時 | 2024-10-10 14:40:53 |
| 合計ジャッジ時間 | 1,853 ms |
|
ジャッジサーバーID (参考情報) |
judge4 / judge5 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 2 |
| other | AC * 13 |
ソースコード
#include <iostream>
#include <vector>
using namespace std;
int main(){
int N;
cin >> N;
vector<vector<int>> a(N, vector<int> (N));
for(int i = 0; i < N; i++){
a[i][i] = i;
}
for(int i = 0; i < N; i++){
for(int j = 1; j < N; j++) a[(i + j + N) % N][(i - j + N) % N] = a[i][i];
}
for(int i = 0; i < N; i++){
for(int j = 0; j < N; j++){
if(j != N - 1) cout << a[i][j] + 1 << ' ';
else cout << a[i][j] + 1 << endl;
}
}
}