結果
問題 | No.839 Keep Distance and Nobody Explodes |
ユーザー |
![]() |
提出日時 | 2019-06-29 00:02:05 |
言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 11 ms / 2,000 ms |
コード長 | 580 bytes |
コンパイル時間 | 639 ms |
コンパイル使用メモリ | 65,240 KB |
実行使用メモリ | 5,376 KB |
最終ジャッジ日時 | 2024-07-02 05:15:28 |
合計ジャッジ時間 | 2,342 ms |
ジャッジサーバーID (参考情報) |
judge1 / judge5 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 30 |
ソースコード
#include <iostream> using namespace std; int main() { int n; cin >> n; int A[n+1][n+1], x = 1; for (int i = 0; i < n/2; i++) { if (i % 2) { for (int j = n-1; j >= 0; j--) { A[i][j] = x++; A[i+n/2][(j+n/2)%n] = x++; } } else { for (int j = 0; j < n; j++) { A[i][j] = x++; A[i+n/2][(j+n/2)%n] = x++; } } } for (int i = 0; i < n; i++) { for (int j = 0; j < n; j++) cout << A[i][j] << ' '; cout << endl; } }