結果
問題 | No.1169 Row and Column and Diagonal |
ユーザー | boutarou |
提出日時 | 2020-08-14 21:31:51 |
言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 27 ms / 2,000 ms |
コード長 | 648 bytes |
コンパイル時間 | 1,638 ms |
コンパイル使用メモリ | 170,600 KB |
実行使用メモリ | 5,248 KB |
最終ジャッジ日時 | 2024-10-10 14:19:14 |
合計ジャッジ時間 | 2,849 ms |
ジャッジサーバーID (参考情報) |
judge2 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 2 |
other | AC * 13 |
ソースコード
/** * author: boutarou * created: 14.08.2020 21:25:02 **/ #include <bits/stdc++.h> using namespace std; #define rep(i,n) for(int i = 0; i < int(n); i++) using ll = long long; using P = pair<int, int>; int main() { int n; cin >> n; vector<vector<int>> ans(n, vector<int>(n)); int now = 0; rep(i,n) { int res = now; rep(j,n) { ans[i][res] = j + 1; res--; if (res < 0) res += n; } now += 2; if (now >= n) now -= n; } rep(i,n) { rep(j,n) { cout << ans[i][j] << " "; } cout << endl; } return 0; }