結果
問題 | No.1169 Row and Column and Diagonal |
ユーザー |
![]() |
提出日時 | 2020-08-14 21:33:23 |
言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 20 ms / 2,000 ms |
コード長 | 658 bytes |
コンパイル時間 | 789 ms |
コンパイル使用メモリ | 89,120 KB |
最終ジャッジ日時 | 2025-01-12 23:21:04 |
ジャッジサーバーID (参考情報) |
judge1 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 2 |
other | AC * 13 |
ソースコード
#include <iostream> #include <vector> #include <string> #include <algorithm> #include <cstdio> #include <cstring> #include <cmath> using namespace std; using ll = long long; int r[500][500]; int p[500]; int main() { ios::sync_with_stdio(false); cin.tie(0); int n; cin >> n; for (int i = 0; i < n; i++) { for (int j = 0; j < n; j++) { r[i][j] = ((n - 1 - j) - i + n) % n; } } for (int i = 0; i < n; i++) { p[r[i][i]] = i + 1; } for (int i = 0; i < n; i++) { for (int j = 0; j < n; j++) { cout << p[r[i][j]] << " \n"[j == n - 1]; } } return 0; }