結果
問題 | No.479 頂点は要らない |
ユーザー | conf |
提出日時 | 2017-01-27 22:57:52 |
言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 100 ms / 1,500 ms |
コード長 | 662 bytes |
コンパイル時間 | 604 ms |
コンパイル使用メモリ | 78,144 KB |
実行使用メモリ | 17,600 KB |
最終ジャッジ日時 | 2024-12-23 16:41:38 |
合計ジャッジ時間 | 3,088 ms |
ジャッジサーバーID (参考情報) |
judge4 / judge2 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 38 |
ソースコード
#include <iostream> #include <algorithm> #include <set> #include <vector> using namespace std; int main(){ set<int> G[100000]; bool B[100000]; int n,m; cin>>n>>m; for(int i=0;i<m;i++){ int a,b; cin>>a>>b; G[a].insert(b); G[b].insert(a); } fill(B,B+n,true); for(int i=n-1;i>=0;i--){ B[i]=false; for(auto to:G[i]){ if(B[to]==false){ B[i]=true; break; } } } bool flag = false; for(int i=n-1;i>=0;i--){ if(B[i])flag=true,cout<<'1'; else if(flag)cout<<'0'; } cout<<endl; return 0; }