結果
| 問題 |
No.3092 Tired Queen
|
| コンテスト | |
| ユーザー |
umezo
|
| 提出日時 | 2025-04-30 03:30:51 |
| 言語 | C++23 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
AC
|
| 実行時間 | 77 ms / 2,000 ms |
| コード長 | 976 bytes |
| コンパイル時間 | 3,931 ms |
| コンパイル使用メモリ | 273,096 KB |
| 実行使用メモリ | 7,552 KB |
| 最終ジャッジ日時 | 2025-04-30 03:30:59 |
| 合計ジャッジ時間 | 7,931 ms |
|
ジャッジサーバーID (参考情報) |
judge2 / judge3 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | AC * 41 |
ソースコード
#include<bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define ALL(v) v.begin(),v.end()
typedef long long ll;
template <class T> using V=vector<T>;
template <class T> using VV=V<V<T>>;
int G[1010][1010];
int main(){
ios::sync_with_stdio(false);
std::cin.tie(nullptr);
int n;
cin>>n;
int now=1;
auto f=[&](int l,int r)->void{
if(l==r) G[l][r]=now;
else{
int t=0;
int i=l,j=l;
while(i<r || j<r){
if(t==0){
G[i][j++]=now++,G[i][j]=now++;
if(i==r && j==r) break;
if(j!=r) t=1;
swap(i,j);
}
else{
G[i++][j]=now++,G[i][j]=now++;
if(i==r && j==r) break;
if(i!=r) t=0;
swap(i,j);
}
}
}
};
for(int i=0;i<n;i++){
int l=i,r=n-1-i;
if(l>r) break;
f(l,r);
}
rep(i,n){
rep(j,n){
if(j) cout<<" ";
cout<<G[i][j];
}
cout<<'\n';
}
return 0;
}
umezo