結果
問題 | No.479 頂点は要らない |
ユーザー |
![]() |
提出日時 | 2018-11-16 12:19:57 |
言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 98 ms / 1,500 ms |
コード長 | 686 bytes |
コンパイル時間 | 2,228 ms |
コンパイル使用メモリ | 198,144 KB |
最終ジャッジ日時 | 2025-01-06 16:44:43 |
ジャッジサーバーID (参考情報) |
judge2 / judge4 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 38 |
ソースコード
#include<bits/stdc++.h>using namespace std;using Int = long long;template<typename T1,typename T2> inline void chmin(T1 &a,T2 b){if(a>b) a=b;}template<typename T1,typename T2> inline void chmax(T1 &a,T2 b){if(a<b) a=b;}//INSERT ABOVE HEREsigned main(){int n,m;cin>>n>>m;vector<vector<int> > G(n);for(int i=0;i<m;i++){int a,b;cin>>a>>b;G[a].emplace_back(b);G[b].emplace_back(a);}vector<int> used(n);for(int i=n-1;i>=0;i--){if(used[i]) continue;for(int v:G[i]) used[v]=1;}while(used.size()>1u&&used.back()==0) used.pop_back();reverse(used.begin(),used.end());for(int x:used) cout<<x;cout<<endl;return 0;}