結果
| 問題 |
No.1169 Row and Column and Diagonal
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2020-08-15 03:32:32 |
| 言語 | C++17(gcc12) (gcc 12.3.0 + boost 1.87.0) |
| 結果 |
AC
|
| 実行時間 | 15 ms / 2,000 ms |
| コード長 | 550 bytes |
| コンパイル時間 | 17,041 ms |
| コンパイル使用メモリ | 275,304 KB |
| 最終ジャッジ日時 | 2025-01-13 00:58:25 |
|
ジャッジサーバーID (参考情報) |
judge1 / judge5 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 2 |
| other | AC * 13 |
ソースコード
#pragma GCC target("avx2")
#pragma GCC optimize("O3")
#pragma GCC optimize("unroll-loops")
#include <bits/stdc++.h>
using namespace std;
int main() {
cin.tie(0);ios::sync_with_stdio(false);
int N; cin >> N;
array<array<int,500>,500> grid;
for(int i=0;i<N;++i) {
for(int j=0;j<N;++j) {
grid[(2*i+j)%N][(i+j)%N]=j%N+1;
}
}
string ans="";
for(int i = 0; i < N; ++i) {
for(int j = 0; j < N; ++j) ans += to_string(grid[i][j])+" ";
ans += "\n";
}
cout << ans;
return 0;
}