結果
| 問題 | No.3727 Garden Master |
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2026-09-19 14:26:04 |
| 言語 | C++23(gcc16) (gcc 16.1.0 + boost 1.92.0 + ACL) |
| 結果 |
WA
不安定
|
| 実行時間 | - |
| コード長 | 2,029 bytes |
| 記録 | |
| コンパイル時間 | 2,867 ms |
| コンパイル使用メモリ | 394,896 KB |
| 実行使用メモリ | 10,004 KB |
| 最終ジャッジ日時 | 2026-09-19 14:26:17 |
| 合計ジャッジ時間 | 5,517 ms |
|
ジャッジサーバーID (参考情報) |
judge4_0 / judge5_0 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 1 |
| other | AC * 21 WA * 9 |
ソースコード
#pragma GCC optimize ("O3,inline,omit-frame-pointer,no-asynchronous-unwind-tables,fast-math")
#include <bits/stdc++.h>
#include <unordered_map>
#include <stdlib.h>
using namespace std;
#define rep(i, a, n) for(ll i = a; i < n; i++)
#define rrep(i, a, n) for(ll i = a; i >= n; i--)
#define inr(l, x, r) (l <= x && x < r)
#define ll long long
#define ld long double
#define pii pair<int, int>
#define pll pair<ll, ll>
#define all(x) (x).begin(), (x).end()
//constexpr ll MOD = 1000000007;
constexpr ll MOD = 998244353;
constexpr int IINF = 1001001001;
constexpr ll INF = 1LL<<60;
template<class t,class u> void chmax(t&a,u b){if(a<b)a=b;}
template<class t,class u> void chmin(t&a,u b){if(b<a)a=b;}
int main() {
ios::sync_with_stdio(false);
std::cin.tie(nullptr);
ll n; cin >> n;
if(n%2){
rep(i,0,n){
if(i%2){
rep(j,0,n) cout << j+1 << " ";
}else{
rrep(j,n-1,0) cout << j+1 << " ";
}
cout << endl;
}
vector<vector<ll>> ans(n,vector<ll>(n,0));
rep(i,0,n){
if(i%2){
rep(j,0,n) ans[j][i] = j+1;
}else{
rrep(j,n-1,0) ans[n-j-1][i] = j+1;
}
}
rep(i,0,n){
rep(j,0,n) cout << ans[i][j] << " ";
cout << endl;
}
}else{
vector<ll> v(n);
iota(all(v),1);
rep(i,0,n){
if(i%2 == 1){
rep(j,0,n){
if(j%2 == 0) swap(v[j],v[j+1]);
}
}
for(auto x: v) cout << x << " ";
cout << endl;
reverse(all(v));
}
vector<vector<ll>> ans(n,vector<ll>(n,0));
rep(i,0,n){
if(i%2){
rep(j,0,n) ans[j][i] = j+1;
}else{
rrep(j,n-1,0) ans[n-j-1][i] = j+1;
}
}
rep(i,0,n){
rep(j,0,n) cout << ans[i][j] << " ";
cout << endl;
}
}
return 0;
}