結果

問題 No.1477 Lamps on Graph
ユーザー chocono2230chocono2230
提出日時 2021-04-16 20:17:40
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
WA  
実行時間 -
コード長 1,263 bytes
コンパイル時間 2,192 ms
コンパイル使用メモリ 210,064 KB
実行使用メモリ 11,096 KB
最終ジャッジ日時 2023-09-15 20:42:31
合計ジャッジ時間 8,643 ms
ジャッジサーバーID
(参考情報)
judge11 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
4,380 KB
testcase_01 AC 1 ms
4,380 KB
testcase_02 AC 1 ms
4,384 KB
testcase_03 AC 2 ms
4,380 KB
testcase_04 AC 1 ms
4,384 KB
testcase_05 WA -
testcase_06 AC 2 ms
4,380 KB
testcase_07 AC 2 ms
4,380 KB
testcase_08 AC 1 ms
4,376 KB
testcase_09 AC 2 ms
4,376 KB
testcase_10 WA -
testcase_11 AC 2 ms
4,376 KB
testcase_12 AC 108 ms
6,996 KB
testcase_13 AC 112 ms
6,680 KB
testcase_14 AC 134 ms
7,380 KB
testcase_15 AC 54 ms
4,864 KB
testcase_16 AC 39 ms
5,140 KB
testcase_17 AC 42 ms
4,860 KB
testcase_18 AC 167 ms
8,080 KB
testcase_19 AC 105 ms
7,136 KB
testcase_20 AC 39 ms
4,376 KB
testcase_21 AC 146 ms
7,012 KB
testcase_22 AC 23 ms
4,376 KB
testcase_23 AC 71 ms
5,120 KB
testcase_24 AC 166 ms
8,072 KB
testcase_25 AC 52 ms
4,760 KB
testcase_26 AC 158 ms
8,512 KB
testcase_27 AC 63 ms
5,388 KB
testcase_28 AC 80 ms
6,440 KB
testcase_29 AC 83 ms
5,844 KB
testcase_30 AC 93 ms
5,424 KB
testcase_31 AC 56 ms
5,140 KB
testcase_32 AC 256 ms
11,096 KB
testcase_33 AC 211 ms
11,084 KB
testcase_34 WA -
testcase_35 AC 219 ms
10,512 KB
testcase_36 AC 210 ms
10,512 KB
testcase_37 AC 160 ms
10,316 KB
testcase_38 AC 184 ms
10,640 KB
testcase_39 AC 208 ms
10,504 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
#define rep(i,n) for(int i = 0; i < (int)(n); i++)
#define rrep(ri,n) for(int ri = (int)(n-1); ri >= 0; ri--)
#define rep2(i,x,n) for(int i = (int)(x); i < (int)(n); i++)
#define rrep2(ri,x,n) for(int ri = (int)(n-1); ri >= (int)(x); ri--)
#define repit(itr,x) for(auto itr = x.begin(); itr != x.end(); itr++)
#define rrepit(ritr,x) for(auto ritr = x.rbegin(); ritr != x.rend(); ritr++)
#define ALL(x) x.begin(), x.end()
using ll = long long;
using namespace std;

int main() {
  int n, m;
  cin >> n >> m;
  vector<pair<int, int>> a(n);
  vector<int> aa(n);
  rep(i, n) {
    int in;
    cin >> in;
    a.at(i) = {in, i};
    aa.at(i) = in;
  }
  vector<vector<int>> gr(n, vector<int>());
  rep(i, m){
    int a, b;
    cin >> a >> b;
    a--; b--;
    gr.at(a).push_back(b);
    gr.at(b).push_back(a);
  }
  int k;
  cin >> k;
  vector<int> co(n, 0);
  rep(i, k) {
    int in;
    cin >> in;
    in--;
    co.at(in)++;
  }
  sort(ALL(a));
  vector<int> ans;
  for(auto [c, now] : a) {
    if(co.at(now) % 2 == 0) continue;
    ans.push_back(now);
    for(auto nx : gr.at(now)) {
      if(aa.at(nx) < c) continue;
      co.at(nx)++;
    }
  }
  cout << ans.size() << endl;
  for(auto i : ans) {
    cout << i+1 << endl;
  }
  return 0;
}
0