結果

問題 No.839 Keep Distance and Nobody Explodes
ユーザー startcpp
提出日時 2019-06-14 23:16:56
言語 C++11(廃止可能性あり)
(gcc 13.3.0)
結果
WA  
実行時間 -
コード長 630 bytes
コンパイル時間 590 ms
コンパイル使用メモリ 54,828 KB
実行使用メモリ 6,824 KB
最終ジャッジ日時 2024-11-14 13:39:43
合計ジャッジ時間 2,222 ms
ジャッジサーバーID
(参考情報)
judge4 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 1 WA * 29
権限があれば一括ダウンロードができます

ソースコード

diff #

//誤読して距離の和を最大化してしまった。(WA)
#include <iostream>
#define rep(i, n) for(i = 0; i < n; i++)
using namespace std;

int n;
int ans[300][300];

signed main() {
	int i, j;
	
	cin >> n;
	int n2 = n / 2;
	
	rep(i, n2) {
		rep(j, n2) {
			int sft = 2 * n * i + 1;
			ans[i][j] = sft + 2 * j;
		}
		rep(j, n2) {
			int sft = 2 * n * i + 1 + n;
			ans[i][n - 1 - j] = sft + 2 * j;
		}
	}
	
	for (i = n2; i < n; i++) {
		rep(j, n) {
			ans[i][j] = ans[n - 1 - i][n - 1 - j] + 1;
		}
	}
	
	rep(i, n) {
		rep(j, n) {
			cout << ans[i][j];
			if (j + 1 < n) cout << " ";
		}
		cout << endl;
	}
	return 0;
}
0