結果

問題 No.479 頂点は要らない
ユーザー kotamanegikotamanegi
提出日時 2017-01-27 23:08:12
言語 C++11
(gcc 11.4.0)
結果
AC  
実行時間 89 ms / 1,500 ms
コード長 1,242 bytes
コンパイル時間 702 ms
コンパイル使用メモリ 88,184 KB
実行使用メモリ 12,240 KB
最終ジャッジ日時 2023-08-25 04:41:49
合計ジャッジ時間 3,653 ms
ジャッジサーバーID
(参考情報)
judge13 / judge11
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 4 ms
8,024 KB
testcase_01 AC 4 ms
8,096 KB
testcase_02 AC 4 ms
8,068 KB
testcase_03 AC 4 ms
8,120 KB
testcase_04 AC 4 ms
8,032 KB
testcase_05 AC 4 ms
8,016 KB
testcase_06 AC 4 ms
8,256 KB
testcase_07 AC 5 ms
8,012 KB
testcase_08 AC 4 ms
8,052 KB
testcase_09 AC 4 ms
8,164 KB
testcase_10 AC 4 ms
8,068 KB
testcase_11 AC 4 ms
8,156 KB
testcase_12 AC 4 ms
8,116 KB
testcase_13 AC 5 ms
8,020 KB
testcase_14 AC 4 ms
8,028 KB
testcase_15 AC 4 ms
8,096 KB
testcase_16 AC 5 ms
8,256 KB
testcase_17 AC 4 ms
8,052 KB
testcase_18 AC 4 ms
8,060 KB
testcase_19 AC 5 ms
8,244 KB
testcase_20 AC 5 ms
8,248 KB
testcase_21 AC 4 ms
8,072 KB
testcase_22 AC 5 ms
8,088 KB
testcase_23 AC 5 ms
8,180 KB
testcase_24 AC 5 ms
8,064 KB
testcase_25 AC 5 ms
8,072 KB
testcase_26 AC 89 ms
11,524 KB
testcase_27 AC 88 ms
11,632 KB
testcase_28 AC 69 ms
12,240 KB
testcase_29 AC 68 ms
10,208 KB
testcase_30 AC 69 ms
10,300 KB
testcase_31 AC 69 ms
10,056 KB
testcase_32 AC 70 ms
10,328 KB
testcase_33 AC 69 ms
10,304 KB
testcase_34 AC 74 ms
10,400 KB
testcase_35 AC 63 ms
9,776 KB
testcase_36 AC 35 ms
8,936 KB
testcase_37 AC 66 ms
10,744 KB
testcase_38 AC 59 ms
10,168 KB
testcase_39 AC 43 ms
9,912 KB
testcase_40 AC 55 ms
10,360 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#define  _CRT_SECURE_NO_WARNINGS
#include <stdio.h>
#include <algorithm>
#include <utility>
#include <functional>
#include <cstring>
#include <queue>
#include <stack>
#include <math.h>
#include <iterator>
#include <vector>
#include <string>
#include <set>
#include <math.h>
#include <iostream> 
#include<map>
#include <iomanip>
#include <stdlib.h>
#include <list>
#include <typeinfo>
#include <list>
#include <set>
using namespace std;
#define MAX_MOD 1000000007
#define REP(i,n) for(long long i = 0;i < n;++i)
#define LONG_INF 8000000000000000000
vector<int> vertex[200000];
int take[200000] = {};
int main() {
	int n, m;
	cin >> n >> m;
	REP(i, m) {
		int a, b;
		cin >> a >> b;
		vertex[a].push_back(b);
		vertex[b].push_back(a);
	}
	bool start_push = false;
	for (int i = n-1;i >= 0;--i) {
		if (take[i] == false) {
			vector<int> hogees;
			for (int q = 0;q < vertex[i].size();++q) {
				if (take[vertex[i][q]] == false) {
					if (vertex[i][q] > i) {
						take[i] = true;
						goto ok;
					}
					hogees.push_back(vertex[i][q]);
				}
			}
			REP(q, hogees.size()) {
				take[hogees[q]] = true;
			}
		ok:;
		}
		if (take[i] == true) {
			cout << 1;
			start_push = true;
		}
		else if (start_push == true) cout << 0;
	}
	return 0;
}
0