結果
問題 | No.479 頂点は要らない |
ユーザー | ikd |
提出日時 | 2017-01-28 02:49:59 |
言語 | C++11 (gcc 13.3.0) |
結果 |
TLE
|
実行時間 | - |
コード長 | 1,006 bytes |
コンパイル時間 | 640 ms |
コンパイル使用メモリ | 64,096 KB |
実行使用メモリ | 14,592 KB |
最終ジャッジ日時 | 2024-12-23 20:07:09 |
合計ジャッジ時間 | 37,507 ms |
ジャッジサーバーID (参考情報) |
judge3 / judge4 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
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 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; }