結果

問題 No.479 頂点は要らない
ユーザー gazellegazelle
提出日時 2018-01-07 18:28:14
言語 C++11
(gcc 11.4.0)
結果
AC  
実行時間 104 ms / 1,500 ms
コード長 1,118 bytes
コンパイル時間 2,262 ms
コンパイル使用メモリ 100,064 KB
実行使用メモリ 17,688 KB
最終ジャッジ日時 2023-08-24 23:37:00
合計ジャッジ時間 6,517 ms
ジャッジサーバーID
(参考情報)
judge13 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1 ms
4,380 KB
testcase_01 AC 1 ms
4,376 KB
testcase_02 AC 2 ms
4,380 KB
testcase_03 AC 2 ms
4,376 KB
testcase_04 AC 2 ms
4,376 KB
testcase_05 AC 1 ms
4,380 KB
testcase_06 AC 2 ms
4,376 KB
testcase_07 AC 1 ms
4,376 KB
testcase_08 AC 2 ms
4,376 KB
testcase_09 AC 1 ms
4,380 KB
testcase_10 AC 2 ms
4,376 KB
testcase_11 AC 2 ms
4,376 KB
testcase_12 AC 2 ms
4,376 KB
testcase_13 AC 2 ms
4,376 KB
testcase_14 AC 2 ms
4,376 KB
testcase_15 AC 1 ms
4,380 KB
testcase_16 AC 2 ms
4,376 KB
testcase_17 AC 2 ms
4,376 KB
testcase_18 AC 1 ms
4,380 KB
testcase_19 AC 2 ms
4,376 KB
testcase_20 AC 2 ms
4,376 KB
testcase_21 AC 2 ms
4,376 KB
testcase_22 AC 2 ms
4,376 KB
testcase_23 AC 2 ms
4,376 KB
testcase_24 AC 2 ms
4,380 KB
testcase_25 AC 2 ms
4,380 KB
testcase_26 AC 72 ms
17,480 KB
testcase_27 AC 72 ms
17,464 KB
testcase_28 AC 64 ms
17,688 KB
testcase_29 AC 50 ms
15,124 KB
testcase_30 AC 50 ms
15,052 KB
testcase_31 AC 49 ms
15,084 KB
testcase_32 AC 50 ms
14,976 KB
testcase_33 AC 82 ms
13,716 KB
testcase_34 AC 92 ms
14,464 KB
testcase_35 AC 104 ms
13,144 KB
testcase_36 AC 62 ms
9,432 KB
testcase_37 AC 79 ms
14,388 KB
testcase_38 AC 69 ms
12,584 KB
testcase_39 AC 41 ms
10,284 KB
testcase_40 AC 49 ms
12,020 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include<iostream>
#include<iomanip>
#include<math.h>
#include<vector>
#include<algorithm>
#include<set>
#include<map>
#include<queue>
#include<stack>
#include<string>
#include<bitset>
#include<random>
#define INF 1000000000ll
#define MOD 1000000007ll
#define EPS 1e-10
#define REP(i,m) for(long long i=0; i<m; i++)
#define FOR(i,n,m) for(long long i=n; i<m; i++)
#define DUMP(a) for(long long dump=0; dump<(ll)a.size(); dump++) { cout<<a[dump]; if(dump!=(ll)a.size()-1) cout<<" "; else cout<<endl; }
#define ALL(v) v.begin(),v.end()
#define pb push_back
using namespace std;
typedef long long ll;
typedef pair<ll, ll> P;
typedef long double ld;

int main() {
	cin.tie(0);
	ios::sync_with_stdio(false);
	ll n,m;
	cin>>n>>m;
	vector<set<ll>> adj(n);
	REP(i,m) {
		ll a,b;
		cin>>a>>b;
		adj[a].insert(b);
		adj[b].insert(a);
	}
	vector<bool> used(n,false);
	string ans;
	for(ll i=n-1; i>=0; i--) {
		bool d=false;
		for(auto x: adj[i]) {
			if(x>i&&!used[x]) d=true;
		}
		if(d) {
			used[i]=true;
			ans+="1";
		} else ans+="0";
	}
	while(ans!="0"&&ans[0]=='0') ans=ans.substr(1,(ll)ans.size()-1);
	cout<<ans<<endl;
}
0