結果

問題 No.3724 Domination
コンテスト
ユーザー l__l
提出日時 2026-09-19 17:10:10
言語 C++23(gcc16)
(gcc 16.1.0 + boost 1.92.0 + ACL)
コンパイル:
g++-16 -O2 -lm -std=c++23 -Wuninitialized -DONLINE_JUDGE -o a.out _filename_
実行:
./a.out
結果
WA  
実行時間 -
コード長 1,185 bytes
記録
記録タグの例:
初AC ショートコード 純ショートコード 純主流ショートコード 最速実行時間
コンパイル時間 5,031 ms
コンパイル使用メモリ 389,444 KB
実行使用メモリ 10,068 KB
最終ジャッジ日時 2026-09-19 17:10:30
合計ジャッジ時間 12,502 ms
ジャッジサーバーID
(参考情報)
judge5_1 / judge3_0
このコードへのチャレンジ
(要ログイン)
サブタスク 配点 結果
部分点 20 % AC * 7 WA * 1
満点 80 % AC * 7 WA * 45
合計 2.5 * 0% = 0 点
権限があれば一括ダウンロードができます

ソースコード

diff #
raw source code

#include<bits/stdc++.h>
#include <atcoder/all>
using namespace std;
using namespace atcoder;
using ll = long long;
#define all(x) x.begin(), x.end()
#define rep(i, limit) for (int i = 0; i < (int)limit; i++)
constexpr char nl = '\n';
constexpr int INF = 1'000'000'000;
constexpr ll LINF = 2'000'000'000'000'000'000LL;
template<typename T> bool chmin(T& a, T b){if(a > b){a = b; return true;} return false;}
template<typename T> bool chmax(T& a, T b){if(a < b){a = b; return true;} return false;}

int main(){
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    
    int Q;cin >> Q;
    for(;Q--;){
        int N;cin >> N;
        if(N == 2){
            cout << -1 << nl;
            continue;
        }
        vector<int>C(N),R(N);
        rep(i,N)cin >> R[i];
        rep(i,N)cin >> C[i];

        vector<vector<int>>ans(N+1,vector<int>(N+1));

        for(int i = 0; i < N; i++)for(int j = 0; j < N; j++){
            if(min(C[j],R[i]) == 1 && max(C[j],R[i]) == N)ans[i][j] = N;
            else ans[i][j] = min(C[j],R[i]);
        }



        rep(i,N){
            rep(j,N){
                cout << ans[i][j] << " ";
            }
            cout << nl;
        }
    }
}
0