結果
| 問題 |
No.839 Keep Distance and Nobody Explodes
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2019-06-14 22:30:01 |
| 言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
AC
|
| 実行時間 | 9 ms / 2,000 ms |
| コード長 | 1,329 bytes |
| コンパイル時間 | 1,061 ms |
| コンパイル使用メモリ | 118,752 KB |
| 実行使用メモリ | 6,820 KB |
| 最終ジャッジ日時 | 2024-11-14 06:53:29 |
| 合計ジャッジ時間 | 2,802 ms |
|
ジャッジサーバーID (参考情報) |
judge5 / judge1 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | AC * 30 |
ソースコード
#define _USE_MATH_DEFINES
#include <cstdio>
#include <iostream>
#include <sstream>
#include <fstream>
#include <iomanip>
#include <algorithm>
#include <cmath>
#include <complex>
#include <string>
#include <vector>
#include <array>
#include <list>
#include <queue>
#include <stack>
#include <set>
#include <map>
#include <bitset>
#include <numeric>
#include <limits>
#include <climits>
#include <cfloat>
#include <functional>
#include <iterator>
#include <memory>
#include <regex>
using namespace std;
int main()
{
int n;
cin >> n;
vector<vector<int> > v(n, vector<int>(n, 0));
int cnt = 1;
for(int i=0; i<n; ++i){
for(int y=0; y<n/2; ++y){
int x = i - y;
if(0 <= x && x < n / 2){
v[y+n/2][x+n/2] = cnt;
++ cnt;
v[y][x] = cnt;
++ cnt;
}
}
}
for(int i=0; i<n; ++i){
for(int y=0; y<n/2; ++y){
int x = n - 1 - i + y;
if(n / 2 <= x && x < n){
v[y][x] = cnt;
++ cnt;
v[y+n/2][x-n/2] = cnt;
++ cnt;
}
}
}
for(int y=0; y<n; ++y){
cout << v[y][0];
for(int x=1; x<n; ++x)
cout << ' ' << v[y][x];
cout << endl;
}
return 0;
}