結果
| 問題 | No.3727 Garden Master |
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2026-09-19 14:04:48 |
| 言語 | C++23 (gcc 15.3.0 + boost 1.92.0 + ACL) |
| 結果 |
AC
不安定
|
| 実行時間 | 22 ms / 2,000 ms |
| + 710µs | |
| コード長 | 795 bytes |
| 記録 | |
| コンパイル時間 | 2,159 ms |
| コンパイル使用メモリ | 346,796 KB |
| 実行使用メモリ | 12,800 KB |
| 最終ジャッジ日時 | 2026-09-19 14:04:57 |
| 合計ジャッジ時間 | 4,833 ms |
|
ジャッジサーバーID (参考情報) |
judge7_0 / judge2_0 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 1 |
| other | AC * 30 |
ソースコード
#include<bits/stdc++.h>
using namespace std;
using ll=long long;
int main(){
ios::sync_with_stdio(false);
cin.tie(nullptr);
ll N;
cin>>N;
vector<vector<array<ll,2>>> G(2*N);
for(int i=0;i<N;i++){
for(int j=0;j<N;j++){
G[i-j+N].push_back({i+1,j+1});
}
}
vector<vector<ll>> R(N,vector<ll>(N));
auto B=R;
for(int i=0;i<N;i++){
for(int j=0;j<N;j++){
int d=i-j;
if(d%2!=0)d*=-1;
auto [y,x]=G[d+N].back();
B[i][j]=y;
R[i][j]=x;
G[d+N].pop_back();
}
}
for(int i=0;i<N;i++)for(int j=0;j<N;j++){
cout<<R[i][j]<<" \n"[j==N-1];
}
for(int i=0;i<N;i++)for(int j=0;j<N;j++){
cout<<B[i][j]<<" \n"[j==N-1];
}
}