結果

問題 No.479 頂点は要らない
ユーザー olpheolphe
提出日時 2017-01-27 23:04:34
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 136 ms / 1,500 ms
コード長 960 bytes
コンパイル時間 780 ms
コンパイル使用メモリ 89,180 KB
実行使用メモリ 17,632 KB
最終ジャッジ日時 2023-08-25 04:37:21
合計ジャッジ時間 4,057 ms
ジャッジサーバーID
(参考情報)
judge12 / judge13
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 4 ms
8,100 KB
testcase_01 AC 4 ms
8,088 KB
testcase_02 AC 4 ms
8,100 KB
testcase_03 AC 4 ms
8,104 KB
testcase_04 AC 4 ms
8,072 KB
testcase_05 AC 4 ms
8,012 KB
testcase_06 AC 5 ms
8,248 KB
testcase_07 AC 4 ms
8,036 KB
testcase_08 AC 4 ms
8,000 KB
testcase_09 AC 4 ms
8,080 KB
testcase_10 AC 4 ms
8,020 KB
testcase_11 AC 4 ms
8,204 KB
testcase_12 AC 4 ms
8,020 KB
testcase_13 AC 4 ms
8,108 KB
testcase_14 AC 4 ms
8,016 KB
testcase_15 AC 4 ms
8,040 KB
testcase_16 AC 5 ms
8,080 KB
testcase_17 AC 4 ms
8,036 KB
testcase_18 AC 4 ms
8,160 KB
testcase_19 AC 5 ms
8,168 KB
testcase_20 AC 5 ms
8,084 KB
testcase_21 AC 5 ms
8,100 KB
testcase_22 AC 5 ms
8,244 KB
testcase_23 AC 5 ms
8,116 KB
testcase_24 AC 5 ms
8,184 KB
testcase_25 AC 4 ms
8,072 KB
testcase_26 AC 118 ms
17,632 KB
testcase_27 AC 120 ms
17,476 KB
testcase_28 AC 105 ms
17,528 KB
testcase_29 AC 94 ms
17,420 KB
testcase_30 AC 94 ms
17,456 KB
testcase_31 AC 93 ms
17,488 KB
testcase_32 AC 94 ms
17,484 KB
testcase_33 AC 107 ms
15,980 KB
testcase_34 AC 118 ms
16,940 KB
testcase_35 AC 136 ms
17,016 KB
testcase_36 AC 81 ms
14,032 KB
testcase_37 AC 121 ms
16,312 KB
testcase_38 AC 108 ms
15,336 KB
testcase_39 AC 65 ms
13,288 KB
testcase_40 AC 81 ms
13,932 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include "iostream"
#include "climits"
#include "list"
#include "queue"
#include "set"
#include "functional"
#include "algorithm"
#include "math.h"
#include "utility"

using namespace std;
const long long int MOD = 1000000007;


long long int N, M;
int s, e;
set<int>edge[100000];
bool flag[100000] = {};
int big=0;
set<int>::iterator itr;

int main() {
	cin >> N >> M;
	for (int i = 0; i < M; i++) {
		cin >> s >> e;
		edge[s].insert(e);
		edge[e].insert(s);
	}
	for (int i = N; i >= 0; i--) {
		if (!edge[i].empty()) {
			for (auto j = edge[i].begin(); j != edge[i].end(); ++j) {
				flag[*j] = true;
				while (!edge[*j].empty()) {
					itr = edge[*j].begin();
					if(*itr!=i)	edge[*itr].erase(*j);
					edge[*j].erase(*itr);

				}
			}
			edge[i].clear();
		}
	}
	for (int i = N; i >= 0; i--) {
		if (flag[i]) {
			big = i;
			break;
		}
	}
	for (int i = big; i >= 0; i--) {
		if (flag[i])cout << "1";
		else cout << "0";
	}
	cout << endl;
	return 0;
}

0