結果
| 問題 |
No.1169 Row and Column and Diagonal
|
| コンテスト | |
| ユーザー |
Example0911
|
| 提出日時 | 2020-08-14 21:28:49 |
| 言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
AC
|
| 実行時間 | 26 ms / 2,000 ms |
| コード長 | 624 bytes |
| コンパイル時間 | 1,640 ms |
| コンパイル使用メモリ | 172,140 KB |
| 実行使用メモリ | 6,820 KB |
| 最終ジャッジ日時 | 2024-10-10 14:07:10 |
| 合計ジャッジ時間 | 2,773 ms |
|
ジャッジサーバーID (参考情報) |
judge2 / judge4 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 2 |
| other | AC * 13 |
ソースコード
#include "bits/stdc++.h"
using namespace std;
// コンテスト中のみ
#define int long long
#define ll long long
#define rep(i,n) for(int i = 0; i < (n); i++)
#define P pair<ll,ll>
int MOD = 1000000007;
const ll INF = 1LL << 60;
signed main() {
ios::sync_with_stdio(false);
cin.tie(nullptr);
int n; cin >> n;
vector<vector<int>>ans(n, vector<int>(n));
rep(i, n) {
ans[i][i] = i + n;
}
rep(i, n) {
for (int j = i; j < i + n; j++) {
ans[i][j%n] = (i + n) - (j - i);
}
}
rep(i, n) {
rep(j, n) {
cout << (ans[i][j] % n) + 1;
if (j != n - 1)cout << " ";
else cout << endl;
}
}
return 0;
}
Example0911