結果

問題 No.1477 Lamps on Graph
ユーザー HaaHaa
提出日時 2021-04-16 20:08:31
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
WA  
実行時間 -
コード長 970 bytes
コンパイル時間 1,879 ms
コンパイル使用メモリ 176,712 KB
実行使用メモリ 13,340 KB
最終ジャッジ日時 2023-09-15 20:19:21
合計ジャッジ時間 8,268 ms
ジャッジサーバーID
(参考情報)
judge14 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 3 ms
5,572 KB
testcase_01 AC 3 ms
5,676 KB
testcase_02 AC 3 ms
5,788 KB
testcase_03 AC 3 ms
5,788 KB
testcase_04 AC 3 ms
5,604 KB
testcase_05 WA -
testcase_06 AC 3 ms
5,688 KB
testcase_07 AC 4 ms
5,688 KB
testcase_08 AC 3 ms
5,584 KB
testcase_09 AC 4 ms
5,608 KB
testcase_10 WA -
testcase_11 AC 3 ms
5,748 KB
testcase_12 AC 117 ms
9,792 KB
testcase_13 AC 116 ms
8,988 KB
testcase_14 AC 140 ms
10,364 KB
testcase_15 AC 58 ms
8,000 KB
testcase_16 AC 40 ms
7,420 KB
testcase_17 AC 44 ms
7,328 KB
testcase_18 AC 169 ms
9,452 KB
testcase_19 AC 109 ms
9,040 KB
testcase_20 AC 41 ms
6,868 KB
testcase_21 AC 146 ms
8,784 KB
testcase_22 AC 24 ms
6,672 KB
testcase_23 AC 75 ms
8,792 KB
testcase_24 AC 170 ms
10,824 KB
testcase_25 AC 55 ms
7,516 KB
testcase_26 AC 163 ms
10,320 KB
testcase_27 AC 66 ms
8,264 KB
testcase_28 AC 83 ms
8,776 KB
testcase_29 AC 84 ms
8,460 KB
testcase_30 AC 97 ms
7,620 KB
testcase_31 AC 59 ms
7,484 KB
testcase_32 AC 262 ms
13,340 KB
testcase_33 AC 216 ms
12,764 KB
testcase_34 WA -
testcase_35 AC 225 ms
12,344 KB
testcase_36 AC 217 ms
12,204 KB
testcase_37 AC 168 ms
11,980 KB
testcase_38 AC 190 ms
12,296 KB
testcase_39 AC 211 ms
12,204 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
using namespace std;
typedef long long int ll;
typedef pair<ll,ll> P;
typedef vector<ll> VI;
typedef vector<VI> VVI;
#define REP(i,n) for(int i=0;i<(n);i++)
#define ALL(v) v.begin(),v.end()
constexpr ll MOD=998244353;
constexpr ll INF=2e18;

int main(){
    int n, m; cin >> n >> m;
    vector<P> p(n); int a;
    REP(i,n){
        cin >> a;
        p[i]={a,i};
    }
    sort(ALL(p));
    VVI g(110000);
    int u, v;
    REP(i,m){
        cin >> u >> v;
        u--, v--;
        g[u].push_back(v);
        g[v].push_back(u);
    }
    VI f(n,0);
    int k; cin >> k;
    int b;
    REP(i,k){
        cin >> b;
        f[b-1]=1;
    }
    int z=0; VI ans;
    REP(i,n){
        if(f[p[i].second]){
            z++;
            ans.push_back(p[i].second+1);
            for(auto to:g[p[i].second]){
                f[to]=!f[to];
            }
        }
    }
    cout << z << endl;
    for(auto i:ans)
        cout << i << endl;
    return 0;
}
0