結果

問題 No.1477 Lamps on Graph
ユーザー seven_threeseven_three
提出日時 2021-04-16 20:14:33
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
WA  
実行時間 -
コード長 1,137 bytes
コンパイル時間 994 ms
コンパイル使用メモリ 101,728 KB
実行使用メモリ 11,404 KB
最終ジャッジ日時 2023-09-15 20:34:31
合計ジャッジ時間 7,807 ms
ジャッジサーバーID
(参考情報)
judge12 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 4 ms
5,468 KB
testcase_01 AC 4 ms
5,292 KB
testcase_02 AC 4 ms
5,164 KB
testcase_03 AC 4 ms
5,148 KB
testcase_04 AC 4 ms
5,152 KB
testcase_05 WA -
testcase_06 AC 3 ms
5,148 KB
testcase_07 AC 3 ms
5,224 KB
testcase_08 AC 4 ms
5,180 KB
testcase_09 AC 4 ms
5,228 KB
testcase_10 WA -
testcase_11 AC 4 ms
5,296 KB
testcase_12 AC 119 ms
8,204 KB
testcase_13 AC 122 ms
7,952 KB
testcase_14 AC 144 ms
8,572 KB
testcase_15 AC 58 ms
6,960 KB
testcase_16 AC 42 ms
6,792 KB
testcase_17 AC 45 ms
6,520 KB
testcase_18 AC 169 ms
8,452 KB
testcase_19 AC 110 ms
8,044 KB
testcase_20 AC 41 ms
6,344 KB
testcase_21 AC 149 ms
7,632 KB
testcase_22 AC 25 ms
6,204 KB
testcase_23 AC 75 ms
7,080 KB
testcase_24 AC 175 ms
9,064 KB
testcase_25 AC 55 ms
6,544 KB
testcase_26 AC 164 ms
8,976 KB
testcase_27 AC 67 ms
7,276 KB
testcase_28 AC 88 ms
7,584 KB
testcase_29 AC 86 ms
7,212 KB
testcase_30 AC 97 ms
6,756 KB
testcase_31 AC 60 ms
6,692 KB
testcase_32 AC 255 ms
11,404 KB
testcase_33 AC 214 ms
11,100 KB
testcase_34 WA -
testcase_35 AC 235 ms
10,700 KB
testcase_36 AC 222 ms
10,764 KB
testcase_37 AC 176 ms
10,648 KB
testcase_38 AC 198 ms
10,692 KB
testcase_39 AC 219 ms
10,908 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <iostream>
#include <string>
#include <algorithm>
#include <vector>
#include <iomanip>
#include <cmath>
#include <stdio.h>
#include <queue>
#include <deque>
#include <cstdio>
#include <set>
#include <map>
#include <bitset>
#include <stack>
#include <cctype>
using namespace std;
int a[100010], b[100010], in[100010];
vector<pair<int, int>> vec;
vector<vector<int>> v(100010);
vector<int> ans;
bool bo[100010] = { false };
int main() {
	int n, m;
	cin >> n >> m;
	for (int i = 1; i <= n; i++) {
		cin >> a[i];
		vec.emplace_back(make_pair(a[i], i));
	}
	sort(vec.begin(), vec.end());
	for (int i = 1; i <= n; i++) {
		in[i] = vec[i - 1].second;
	}
	for (int i = 0; i < m; i++) {
		int c, d;
		cin >> c >> d;
		v[c].emplace_back(d);
		v[d].emplace_back(c);
	}
	int k;
	cin >> k;
	for (int i = 0; i < k; i++) {
		int b1;
		cin >> b1;
		bo[b1] = true;
	}
	for (int i = 1; i <= n; i++) {
		if (bo[in[i]]) {
			for (int j = 0; j < v[in[i]].size(); j++) {
				bo[v[in[i]][j]] = !bo[v[in[i]][j]];
			}
			ans.emplace_back(in[i]);
		}
	}
	cout << ans.size() << endl;
	for (int i = 0; i < ans.size(); i++) {
		cout << ans[i] << endl;
	}
}
0