結果
| 問題 |
No.1169 Row and Column and Diagonal
|
| コンテスト | |
| ユーザー |
keep_OC
|
| 提出日時 | 2020-08-14 21:43:03 |
| 言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
AC
|
| 実行時間 | 33 ms / 2,000 ms |
| コード長 | 1,135 bytes |
| コンパイル時間 | 1,841 ms |
| コンパイル使用メモリ | 175,372 KB |
| 実行使用メモリ | 5,248 KB |
| 最終ジャッジ日時 | 2024-10-10 14:46:57 |
| 合計ジャッジ時間 | 3,057 ms |
|
ジャッジサーバーID (参考情報) |
judge1 / judge4 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 2 |
| other | AC * 13 |
ソースコード
#include <bits/stdc++.h>
using namespace std;
typedef int64_t Int;
#define all(x) (x).begin(), (x).end()
const double EPS = 1e-10;
const Int INF = 1e18;
const int inf = 1e9;
const Int mod = 1e9+7;
bool print_space_enable = false;
void print() {
cout << '\n';
print_space_enable = false;
}
template <class Head, class... Tail>
void print(Head&& head, Tail&&... tail) {
if (print_space_enable) cout << " ";
cout << fixed << setprecision(15) << head;
print_space_enable = true;
print(std::forward<Tail>(tail)...);
}
template<typename T>
void print(vector<T> v) {
for (size_t i = 0; i < v.size(); i++) {
if (i > 0) std::cout << " ";
std::cout << v[i];
}
std::cout << std::endl;
}
int main() {
Int n;
cin >> n;
vector<Int> a(n);
map<Int, Int> mp;
for (Int i = 0; i < n; i++) {
a[i] = n - 1 - i;
mp[n - 1 - i] = i;
}
for (Int i = 0; i < n; i++) {
for (Int j = 0; j < n; j++) {
Int index = (mp[i] - i + n) % n;
cout << a[(index + j) % n] + 1 << " " ;
}
cout << endl;
}
return 0;
}
keep_OC