結果

問題 No.1065 電柱 / Pole (Easy)
ユーザー ngtkanangtkana
提出日時 2020-04-20 19:29:39
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
WA  
実行時間 -
コード長 1,446 bytes
コンパイル時間 2,577 ms
コンパイル使用メモリ 203,544 KB
実行使用メモリ 24,864 KB
最終ジャッジ日時 2024-04-09 22:41:32
合計ジャッジ時間 12,056 ms
ジャッジサーバーID
(参考情報)
judge3 / judge4
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
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 -
testcase_34 RE -
testcase_35 RE -
testcase_36 RE -
testcase_37 RE -
testcase_38 RE -
testcase_39 RE -
testcase_40 RE -
testcase_41 RE -
testcase_42 RE -
testcase_43 RE -
testcase_44 RE -
testcase_45 RE -
testcase_46 RE -
testcase_47 RE -
権限があれば一括ダウンロードができます

ソースコード

diff #

/* validator */

#include<bits/stdc++.h>
#define ALL(v) std::begin(v),std::end(v)
using lint=long long;
using ld=long double;
int main(){
    auto read=[]{
        std::string s;std::getline(std::cin,s);
        lint n=s.length();
        lint l=0,r;
        for(r=l;r<n&&s.at(r)!=' ';r++);
        assert(r-l<=9);
        lint x=std::stoll(s.substr(l,r-l));
        l=r+1;
        for(r=l;r<n&&s.at(r)!=' ';r++);
        assert(r-l<=9);
        lint y=std::stoll(s.substr(l,r-l));
        return std::pair{x,y};
    };
    auto[n,m]=read();
    assert(2<=n&&n<=200'000&&n-1<=m&&m<=200'000);
    auto[s,t]=read();
    assert(1<=s&&s<=n&&1<=t&&t<=n);
    std::vector<std::pair<ld,ld>>pts(n);
    for(lint i=0;i<n;i++){
        auto[x,y]=read();
        assert(-1'000<=x&&x<=1'000&&-1'000<=y&&y<=1'000);
        pts.at(i)={x,y};
    }
    std::vector<std::vector<lint>>g(n);
    for(lint i=0;i<n-1;i++){
        auto[u,v]=read();
        assert(1<=u&&u<=n&&1<=v&&v<=n);
        u--,v--;
        g.at(u).push_back(v);
        g.at(v).push_back(u);
    }
    std::vector<lint>que,ckd(n);
    que.push_back(s);
    for(lint k=0;k<(lint)que.size();k++){
        lint x=que.at(k);
        for(lint y:g.at(x)){
            if(std::exchange(ckd.at(y),true))continue;
            que.push_back(y);
        }
    }
    assert(ckd.at(t));
    assert(!std::cin.eof());
    std::string emplyline;std::getline(std::cin,emplyline);
    assert(std::cin.eof());
}
0