結果

問題 No.479 頂点は要らない
ユーザー けーけー
提出日時 2017-04-10 21:58:27
言語 C++14
(gcc 13.3.0 + boost 1.87.0)
結果
AC  
実行時間 94 ms / 1,500 ms
コード長 554 bytes
コンパイル時間 1,480 ms
コンパイル使用メモリ 176,748 KB
実行使用メモリ 27,824 KB
最終ジャッジ日時 2024-07-18 05:45:48
合計ジャッジ時間 4,400 ms
ジャッジサーバーID
(参考情報)
judge1 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 38
権限があれば一括ダウンロードができます

ソースコード

diff #

#include<bits/stdc++.h>
#define int long long
const int inf=8938103643641919514ll;
const int mod=1000000007ll;
const int dd[]={0,-1,0,1,0};
using namespace std;
int a,b,c,d;
struct Node{
	unordered_set<int> e;
};
Node *p;
bitset<114514> q;
signed main(){
	int i,j,k;
	cin>>a>>b;
	p=new Node[a];
	for(i=0;i<b;i++){
		int u,v;
		cin>>u>>v;
		p[u].e.insert(v);
		p[v].e.insert(u);
	}
	string ans;
	for(i=a-1;i>=0;i--){
		if(!q[i]){
			for(auto x:p[i].e)
				q.set(x);
		}
		ans.push_back(q[i]?'1':'0');
	}
	ans=ans.substr(ans.find('1'));
	cout<<ans<<endl;
}
0