結果

問題 No.2640 traO Stamps
ユーザー ponjuiceponjuice
提出日時 2024-02-19 00:05:24
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
WA  
実行時間 -
コード長 1,717 bytes
コンパイル時間 10,968 ms
コンパイル使用メモリ 336,912 KB
実行使用メモリ 6,676 KB
最終ジャッジ日時 2024-02-19 00:05:37
合計ジャッジ時間 13,057 ms
ジャッジサーバーID
(参考情報)
judge11 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 WA -
testcase_01 RE -
testcase_02 WA -
testcase_03 RE -
testcase_04 RE -
testcase_05 RE -
testcase_06 RE -
testcase_07 RE -
testcase_08 RE -
testcase_09 RE -
testcase_10 RE -
testcase_11 RE -
testcase_12 RE -
testcase_13 RE -
testcase_14 RE -
testcase_15 RE -
testcase_16 RE -
testcase_17 RE -
testcase_18 RE -
testcase_19 RE -
testcase_20 RE -
testcase_21 RE -
testcase_22 RE -
testcase_23 RE -
testcase_24 RE -
testcase_25 RE -
testcase_26 RE -
testcase_27 RE -
testcase_28 RE -
testcase_29 RE -
testcase_30 RE -
testcase_31 RE -
testcase_32 RE -
testcase_33 RE -
権限があれば一括ダウンロードができます

ソースコード

diff #

#include<bits/stdc++.h>
#include<atcoder/all>
#include "testlib.h"
using namespace std;
using namespace atcoder;

const int Nmin = 2, Nmax = 200;
const int Mmin = 1;
const int Kmin = 1, Kmax = 200'000;
const int Cmin = 0, Cmax = 1'000'000'000;
const int Qmin = 1, Qmax = 100'000;

int main(){
    // validation を始める際に必ず行う
    registerValidation();

    int N = inf.readInt(Nmin, Nmax);
    inf.readSpace();
    const int Mmax = N * (N - 1) / 2;
    int M = inf.readInt(Mmin, Mmax);
    inf.readSpace();
    int K = inf.readInt(Kmin, Kmax);
    inf.readEoln();
    for(int i = 0; i < N; i++){
        inf.readInt(1, N);
        if(i != N - 1) inf.readSpace();
        else inf.readEoln();
    }

    set<pair<int,int>> Edges;
    dsu uf(N);
    for(int i = 0; i < M; i++) {
        int A = inf.readInt(1, N);
        inf.readSpace();
        int B = inf.readInt(1, N);
        inf.readSpace();
        int C = inf.readInt(Cmin, Cmax);
        inf.readEoln();

        assert(A < B);
        assert(Edges.find(pair<int,int>(A, B)) == Edges.end());
        Edges.insert(pair<int,int>(A, B));
        uf.merge(A - 1, B - 1);
    }
    assert(uf.groups().size() == 1);

    int Q = inf.readInt(Qmin, Qmax);
    inf.readEoln();

    int Tcount = 0;
    for(int i = 0; i < Q; i++){
        int T = inf.readInt(1, 2);
        inf.readSpace();

        if(T == 1){
            inf.readInt(0, K);
            inf.readSpace();
            inf.readInt(1, N);
        }
        if(T == 2){
            Tcount++;
            int X = inf.readInt(0, K);
            inf.readSpace();
            inf.readInt(X, K);
        }
        inf.readEoln();
    }
    assert(Tcount != 0);
    inf.readEof();
    return 0;
}
0