結果

問題 No.3351 Towering Tower
コンテスト
ユーザー ponjuice
提出日時 2025-10-29 18:50:46
言語 C++23
(gcc 13.3.0 + boost 1.87.0)
結果
WA  
実行時間 -
コード長 1,627 bytes
コンパイル時間 8,700 ms
コンパイル使用メモリ 365,332 KB
実行使用メモリ 7,852 KB
最終ジャッジ日時 2025-11-13 21:07:39
合計ジャッジ時間 10,140 ms
ジャッジサーバーID
(参考情報)
judge2 / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample WA * 1
other WA * 9 RE * 18
権限があれば一括ダウンロードができます

ソースコード

diff #

#include<bits/stdc++.h>
#include "testlib.h"
using namespace std;
using ll = long long;

const int T_MIN  = 1, T_MAX = 1'000;
const int N_MIN = 2, N_MAX = 1'000;
const int M_MAX = 2'000;
const int H_MIN = 1, H_MAX = 1'000'000'000;
const int SUM_N_MAX = 100'000, SUM_M_MAX = 100'000;

int main(int argc, char** argv) {
    registerValidation(argc, argv);

    int t = inf.readInt(T_MIN, T_MAX);
    inf.readEoln();

    int sum_n = 0, sum_m = 0;
    for(int i = 0; i < t; i++) {
        int n = inf.readInt(N_MIN, N_MAX);
        inf.readSpace();
        int m = inf.readInt(n, M_MAX);
        inf.readEoln();
        vector<int> h = inf.readInts(n, H_MIN, H_MAX);
        inf.readEoln();
        vector<vector<int>> graph(n+1);
        set<array<int,2>> edge;
        for(int i = 0; i < m; i++) {
            int u = inf.readInt(1, n+1);
            inf.readSpace();
            int v = inf.readInt(u+1, n+1);
            inf.readEoln();
            u--,v--;
            assert(edge.count({u,v}) == 0);
            edge.insert({u, v});
            graph[u].push_back(v);
            graph[v].push_back(u);
        }

        vector<int> saw(n+1, 0);
        saw[0] = 1;
        queue<int> q; 
        q.push(0);
        while(q.size()) {
            int nw = q.front();
            q.pop();
            for(auto to: graph[nw]) {
                if(saw[to] == 0) {
                    saw[to] = 1;
                    q.push(to);
                }
            }
        }
        for(auto x: saw) {
            assert(x != 0);
        }
    }

    inf.readEof();
    assert(sum_n <= SUM_N_MAX);
    assert(sum_m <= SUM_M_MAX);
}
0