結果

問題 No.479 頂点は要らない
ユーザー 👑 はまやんはまやんはまやんはまやん
提出日時 2017-03-06 14:34:42
言語 C++14
(gcc 13.2.0 + boost 1.83.0)
結果
AC  
実行時間 226 ms / 1,500 ms
コード長 807 bytes
コンパイル時間 3,614 ms
コンパイル使用メモリ 174,292 KB
実行使用メモリ 22,340 KB
最終ジャッジ日時 2023-09-05 15:51:17
合計ジャッジ時間 7,648 ms
ジャッジサーバーID
(参考情報)
judge11 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 3 ms
5,844 KB
testcase_01 AC 3 ms
5,792 KB
testcase_02 AC 3 ms
5,792 KB
testcase_03 AC 4 ms
5,820 KB
testcase_04 AC 3 ms
5,816 KB
testcase_05 AC 3 ms
5,804 KB
testcase_06 AC 4 ms
5,808 KB
testcase_07 AC 4 ms
6,088 KB
testcase_08 AC 3 ms
5,756 KB
testcase_09 AC 4 ms
5,804 KB
testcase_10 AC 3 ms
5,820 KB
testcase_11 AC 3 ms
5,800 KB
testcase_12 AC 4 ms
5,868 KB
testcase_13 AC 3 ms
5,984 KB
testcase_14 AC 4 ms
5,768 KB
testcase_15 AC 3 ms
5,872 KB
testcase_16 AC 3 ms
5,752 KB
testcase_17 AC 3 ms
5,868 KB
testcase_18 AC 3 ms
5,792 KB
testcase_19 AC 4 ms
5,964 KB
testcase_20 AC 4 ms
6,016 KB
testcase_21 AC 4 ms
5,944 KB
testcase_22 AC 4 ms
5,932 KB
testcase_23 AC 4 ms
5,920 KB
testcase_24 AC 4 ms
5,992 KB
testcase_25 AC 4 ms
5,960 KB
testcase_26 AC 210 ms
22,260 KB
testcase_27 AC 207 ms
22,224 KB
testcase_28 AC 154 ms
22,340 KB
testcase_29 AC 123 ms
20,840 KB
testcase_30 AC 121 ms
20,688 KB
testcase_31 AC 121 ms
21,008 KB
testcase_32 AC 120 ms
20,844 KB
testcase_33 AC 199 ms
18,848 KB
testcase_34 AC 225 ms
20,072 KB
testcase_35 AC 226 ms
19,796 KB
testcase_36 AC 129 ms
15,092 KB
testcase_37 AC 211 ms
19,592 KB
testcase_38 AC 183 ms
17,796 KB
testcase_39 AC 114 ms
14,404 KB
testcase_40 AC 139 ms
16,004 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include<bits/stdc++.h>
using namespace std;
#define rep(i,a,b) for(int i=a;i<b;i++)




#define rrep(i,a,b) for(int i=a;i>=b;i--)
int N, M;
vector<int> E[101010];
map<pair<int, int>, int> D;
//-----------------------------------------------------------------
int ans[101010];
int vis[101010];
int main() {
	cin >> N >> M;
	rep(i, 0, M) {
		int a, b; scanf("%d%d", &a, &b);
		E[a].push_back(b); E[b].push_back(a);
		D[{a, b}] = D[{b, a}] = i;
	}

	rrep(i, N - 1, 0) {
		bool ok = 0;
		for (int to : E[i]) {
			int j = D[{i, to}];
			if (vis[j]) continue;
			if (i < to) ok = 1;
		}
		if (ok) {
			ans[i] = 1;
			for (int to : E[i]) vis[D[{i, to}]] = 1;
		}
	}

	int f = 0;
	rrep(i, N - 1, 0) {
		if (ans[i]) f = 1;

		if (f == 0) continue;

		if (ans[i]) printf("1");
		else printf("0");
	}
	printf("\n");
}
0