結果
| 問題 |
No.839 Keep Distance and Nobody Explodes
|
| コンテスト | |
| ユーザー |
leaf_1415
|
| 提出日時 | 2019-06-14 23:04:59 |
| 言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
| 結果 |
AC
|
| 実行時間 | 12 ms / 2,000 ms |
| コード長 | 540 bytes |
| コンパイル時間 | 687 ms |
| コンパイル使用メモリ | 57,000 KB |
| 実行使用メモリ | 6,824 KB |
| 最終ジャッジ日時 | 2024-11-14 13:03:32 |
| 合計ジャッジ時間 | 2,483 ms |
|
ジャッジサーバーID (参考情報) |
judge5 / judge4 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | AC * 30 |
ソースコード
#include <iostream>
#include <algorithm>
#define llint long long
using namespace std;
llint n;
int ans[305][305];
int main(void)
{
cin >> n;
int id = 1;
for(int j = 0; j < n/2; j++){
if(j%2 == 0){
for(int i = 0; i < n; i++){
ans[i][j] = id++;
ans[(i+n/2)%n][j+n/2] = id++;
}
}else{
for(int i = 0; i < n; i++){
ans[n-1-i][j] = id++;
ans[n-1-(i+n/2)%n][j+n/2] = id++;
}
}
}
for(int i = 0; i < n; i++){
for(int j = 0; j < n; j++){
cout << ans[i][j] << " ";
}
cout << endl;
}
return 0;
}
leaf_1415