結果

問題 No.479 頂点は要らない
ユーザー bj_k28bj_k28
提出日時 2017-01-28 01:09:54
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
WA  
実行時間 -
コード長 1,388 bytes
コンパイル時間 1,557 ms
コンパイル使用メモリ 172,300 KB
実行使用メモリ 10,044 KB
最終ジャッジ日時 2023-08-25 11:46:42
合計ジャッジ時間 4,707 ms
ジャッジサーバーID
(参考情報)
judge11 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 3 ms
5,364 KB
testcase_01 AC 3 ms
5,316 KB
testcase_02 AC 3 ms
5,424 KB
testcase_03 AC 3 ms
5,236 KB
testcase_04 WA -
testcase_05 AC 3 ms
5,256 KB
testcase_06 AC 3 ms
5,256 KB
testcase_07 AC 3 ms
5,216 KB
testcase_08 AC 3 ms
5,248 KB
testcase_09 AC 3 ms
5,444 KB
testcase_10 AC 3 ms
5,380 KB
testcase_11 AC 3 ms
5,144 KB
testcase_12 WA -
testcase_13 AC 3 ms
5,316 KB
testcase_14 AC 3 ms
5,384 KB
testcase_15 AC 3 ms
5,212 KB
testcase_16 AC 3 ms
5,196 KB
testcase_17 WA -
testcase_18 WA -
testcase_19 WA -
testcase_20 AC 3 ms
5,256 KB
testcase_21 AC 3 ms
5,440 KB
testcase_22 AC 3 ms
5,300 KB
testcase_23 AC 4 ms
5,352 KB
testcase_24 AC 3 ms
5,308 KB
testcase_25 AC 4 ms
5,256 KB
testcase_26 AC 198 ms
9,700 KB
testcase_27 AC 193 ms
9,696 KB
testcase_28 AC 179 ms
10,044 KB
testcase_29 AC 66 ms
8,332 KB
testcase_30 AC 69 ms
8,516 KB
testcase_31 AC 69 ms
8,404 KB
testcase_32 AC 71 ms
8,344 KB
testcase_33 AC 75 ms
8,460 KB
testcase_34 WA -
testcase_35 AC 35 ms
7,856 KB
testcase_36 AC 18 ms
6,844 KB
testcase_37 AC 91 ms
8,760 KB
testcase_38 AC 61 ms
8,056 KB
testcase_39 AC 50 ms
7,460 KB
testcase_40 AC 86 ms
8,344 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>

#define mp make_pair
#define pb push_back
#define REP(i,a,n) for(int i = a;i < (n);i++)
#define RREP(i,a) for(int i = a;i > 0;i--)
#define rep(i,n) for(int i = 0;i < (n);i++)
#define rrep(i,n) for(int i = n - 1;i > 0;i--)
#define all(s) s.begin(), s.end()
#define rall(s) s.rbegin(), s.rend()
#define range(x,min,max) ((min) <= (x) && (x) <= (max))
#define xyrange(x, minX, maxX, y, minY, maxY) (range(x, minX, maxX) && range(y, minY, maxY))

using namespace std;

typedef long long LL;
typedef vector<int> VI;
typedef vector<vector<int> > VVI;
typedef vector<string> VS;
typedef vector<bool> VB;
typedef pair<int,int> PII;
typedef vector<PII> VPII;


const int DX[]={1,0,-1,0},DY[]={0,-1,0,1};
const int INF = 0x3f3f3f3f;

VVI edges(100010);
VB buy(100010, true);
int n, m;
VI as, bs;

string solve() {
	string ans;
	rrep (i, n) {
		buy[i] = false;
		rep (j, edges[i].size()) {
			int idx = edges[i][j]; // 頂点iからいける頂点idx
			if (!buy[idx]) {
				buy[i] = true;
				continue;
			}
		}
	}
	rep (i, n) {
		ans = (buy[i]? '1' : '0') + ans;
	}
	rep (i, n) {
		if (ans[i] == '1') {
			return ans.substr(i);
		}
	}
	return "0";
}

int main(){
	cin.tie(0);
   	ios::sync_with_stdio(false);
	cin >> n >> m;
	rep (i, m) {
		int a, b;
		cin >> a >> b;
		as.pb(a);
		bs.pb(b);
		edges[a].pb(b);
		edges[b].pb(a);
	}
	cout << solve() << endl;
	return 0;
}

0