結果
問題 |
No.479 頂点は要らない
|
ユーザー |
![]() |
提出日時 | 2017-01-28 02:51:11 |
言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
結果 |
TLE
|
実行時間 | - |
コード長 | 1,044 bytes |
コンパイル時間 | 597 ms |
コンパイル使用メモリ | 63,964 KB |
実行使用メモリ | 14,720 KB |
最終ジャッジ日時 | 2024-12-23 20:08:54 |
合計ジャッジ時間 | 37,692 ms |
ジャッジサーバーID (参考情報) |
judge3 / judge2 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 24 TLE * 14 |
ソースコード
#include<iostream> #include<vector> using namespace std; struct E{ int to, id; }; signed main(){ int N, M; cin>> N>> M; vector<E> g[N]; for(int i=0; i<M; i++){ int a, b; cin>> a>> b; g[a].push_back(E{b, i}); g[b].push_back(E{a, i}); } vector<int> v; int usedused[M]; for(int i=0; i<M; i++) usedused[i]=0; for(int n=N-1; n>=0; n--){ int used[M]; for(int i=0; i<M; i++) used[i]=usedused[i]; for(int k=0; k<n; k++){ for(auto e: g[k]){ used[e.id]=1; } } bool y=false; for(auto e: g[n]){ y|=(used[e.id]==0); } v.push_back(y); if(y){ for(auto e:g[n]){ usedused[e.id]=1; } } } bool Lz=true; for(int d: v){ if(d==0){ if(Lz){ }else{ cout<< d; } }else{ if(Lz){ cout<< d; Lz=false; }else{ cout<< d; } } }cout<< endl; return 0; }