結果
| 問題 | No.3734 No Flat Notes |
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2026-09-19 17:28:49 |
| 言語 | C++23(gcc16) (gcc 16.1.0 + boost 1.92.0 + ACL) |
| 結果 |
WA
不安定
|
| 実行時間 | - |
| コード長 | 3,676 bytes |
| 記録 | |
| コンパイル時間 | 3,253 ms |
| コンパイル使用メモリ | 305,472 KB |
| 実行使用メモリ | 9,928 KB |
| 最終ジャッジ日時 | 2026-09-19 17:29:02 |
| 合計ジャッジ時間 | 7,909 ms |
|
ジャッジサーバーID (参考情報) |
judge3_1 / judge5_0 |
(要ログイン)
| サブタスク | 配点 | 結果 |
|---|---|---|
| 部分点 | 20 % | AC * 28 |
| 満点 | 80 % | AC * 48 WA * 12 |
| 合計 | 3.5 * 20% = 70 点 |
ソースコード
#include <iostream>
#include <string>
#include <vector>
#include <map>
#include <set>
#include <unordered_map>
#include <unordered_set>
#include <algorithm>
#include <cstdint>
#include <queue>
#include <tuple>
#include <cassert>
#include <atcoder/all>
#include <iomanip>
#include <cmath>
#include <cstring>
using namespace std;
using ll = int64_t; using ull = uint64_t;
using vl = vector<ll>; using vvl = vector<vl>;using vvvl = vector<vvl>;
using vb = vector<bool>; using vvb = vector<vb>;using vvvb = vector<vvb>;
using vs = vector<string>; using vvs=vector<vector<string>>;
using pl = pair<ll,ll>; using vpl = vector<pl>;using vvpl = vector<vpl>;
using tl = tuple<ll,ll,ll>; using vtl = vector<tl>;using vvtl = vector<vector<tl>>;
using sl = set<ll>; using vsl = vector<sl>; using vvsl = vector<vsl>;
using ml = map<ll,ll>; using vml = vector<ml>; using vvml = vector<vml>;
using usl = unordered_set<ll>; using vusl = vector<usl>; using vvusl = vector<vusl>;
using uml = unordered_map<ll,ll>; using vuml = vector<uml>; using vvuml = vector<vuml>;
using mint = atcoder::modint998244353;
using vm = vector<mint>; using vvm = vector<vector<mint>>; using vvvm = vector<vvm>;
#define rep1(a) for (ll _ = 0; _ < ll(a); ++_)
#define rep2(i, a) for (ll i = 0; i < ll(a); ++i)
#define rep3(i, a, b) for (ll i = a; i < ll(b); ++i)
#define rrep1(a) for (ll i = (a)-1; i >= ll(0); --i)
#define rrep2(i, a) for (ll i = (a)-1; i >= ll(0); --i)
#define rrep3(i, a, b) for (ll i = (b)-1; i >= ll(a); --i)
#define overload3(a, b, c, d, ...) d
#define rep(...) overload3(__VA_ARGS__, rep3, rep2, rep1)(__VA_ARGS__)
#define rrep(...) overload3(__VA_ARGS__, rrep3, rrep2, rrep1)(__VA_ARGS__)
#define in(i,vec) for (auto i:(vec))
#define siz(a) ll(a.size())
void YesNo(bool a){cout<<(a?"Yes\n":"No\n");}
template<class T> using pqueue = priority_queue<T, vector<T>>;//大きい順
template<class T> using pqueue_g = priority_queue<T, vector<T>, greater<T>>;//小さい順
template<class T> bool chmin(T& x, T y){if(x>y){x=y;return true;}else return false;}
template<class T> bool chmax(T& x, T y){if(x<y){x=y;return true;}else return false;}
template<class T> void sor(vector<T>& v){sort(v.begin(),v.end());}
template<class T> void sor_g(vector<T>& v){sort(v.begin(),v.end(),greater<>());}
template<class T> void vin(vector<T>& v){size_t N = v.size();for(size_t i=0;i<N;++i)cin>>v[i];}
template<class T> void vvin(vector<vector<T>>& v){size_t N=v.size(),M=v[0].size();for(size_t i=0;i<N;++i)for(size_t j=0;j<M;++j)cin>>v[i][j];}
template<class T> T max(const vector<T>& v){return *max_element(v.begin(),v.end());}
template<class T> T min(const vector<T>& v){return *min_element(v.begin(),v.end());}
pair<int,int> d1{1,0},d2{0,1},d3{-1,0},d4{0,-1},d5{1,1},d6{-1,1},d7{1,-1},d8{-1,-1};
ll inf = 1e18;
int infi = 1e9;
int main(){
ios::sync_with_stdio(false);
cin.tie(nullptr);
ll H,W,M; cin>>H>>W>>M;
vvl A(H,vl(W,M));
if(M==0){
cout << -1 << endl; return 0;
}
ll l=0,r=0;
ll px=0,py=0;
int dir = 1;
auto step = [&](){
if(dir==1){
++py;
if(py==W){
py=W-1; ++px; dir=-1;
}
}else{
--py;
if(py<0){
py=0,++px,dir=1;
}
}
};
while(l<M-1 || r<M-1){
A[px][py] = ((px+py)%2 == 0 ? l++: H*W-(++r));
step();
}
if((px+py)%2!=0){
while(px<H){
A[px][py]=H*W-(++r);
step();
}
}else{
while(px<H){
A[px][py]=l++;
step();
}
}
rep(i,H)rep(j,W){
cout << A[i][j]+1 << (j+1==W?'\n':' ');
}
}