結果

問題 No.3765 321-avoiding Grid
コンテスト
ユーザー simasima_71
提出日時 2026-10-16 22:14:02
言語 C++14
(gcc 15.3.0 + boost 1.92.0 + ACL)
コンパイル:
g++-15 -O2 -lm -std=c++14 -Wuninitialized -DONLINE_JUDGE -o a.out _filename_
実行:
./a.out
結果
WA  
実行時間 -
コード長 1,614 bytes
記録
記録タグの例:
初AC ショートコード 純ショートコード 純主流ショートコード 最速実行時間
コンパイル時間 5,270 ms
コンパイル使用メモリ 549,272 KB
実行使用メモリ 9,808 KB
最終ジャッジ日時 2026-10-16 22:14:17
合計ジャッジ時間 10,583 ms
ジャッジサーバーID
(参考情報)
judge5_0 / judge4_0
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample WA * 3
other WA * 28
権限があれば一括ダウンロードができます

ソースコード

diff #
raw source code

#include <bits/stdc++.h>
#include <atcoder/all>
using namespace std;
using namespace atcoder;
#define rep(i, l, r) for (ll i = (l); i < (r); ++i)
#define all(x) (x).begin(), (x).end()
#define sz(x) (int)(x).size()
using ll = long long;
using ull = unsigned long long;
using ld = long double;
using pl = pair<ll,ll>;
using vi = vector<int>;
using vl = vector<ll>;
using vvl = vector<vector<ll>>;
using vvvl = vector<vector<vector<ll>>>;
template<class T> using pq_ = priority_queue<T, vector<T>, greater<T>>;
#define sz(x) (int)(x).size()
typedef pair<int, int> pii;
using mint=modint998244353;
// g++ a.cpp -std=c++23 -I.
// g++ -std=c++23 -I. a.cpp -o main
// g++ -std=c++23 -I. anaive.cpp -o naive
// g++ -std=c++23 -I. agene.cpp -o gene
#include <boost/multiprecision/cpp_dec_float.hpp>
#include <boost/multiprecision/cpp_int.hpp>
namespace mp = boost::multiprecision;
using Bint = mp::cpp_int;
using Real = mp::number<mp::cpp_dec_float<1024>>;



int main(){
    ios::sync_with_stdio(false);
    std::cin.tie(nullptr);
    ll n;
    cin>>n;
    ll a,b,c;
    cin>>a>>b>>c;
    vvl z(n,vl(n));
    vl d;
    rep(i,0,a)d.push_back(1);
    rep(i,0,b)d.push_back(2);
    rep(i,0,c)d.push_back(3);
    ll now=0;
    rep(i,0,n){
        rep(j,0,n){
            if((i+j)%2==0){
                z[i][j]=d[now];
                now++;
            }
        }
    }
    rep(i,0,n){
        rep(j,0,n){
            if((i+j)%2==1){
                z[i][j]=d[now];
                now++;
            }
        }
    }
    rep(i,0,n){
        rep(j,0,n){
            cout<<z[i][j]<<" ";
        }
        cout<<endl;
    }
}
0