結果
問題 |
No.479 頂点は要らない
|
ユーザー |
![]() |
提出日時 | 2017-03-10 15:45:50 |
言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 1,418 bytes |
コンパイル時間 | 1,712 ms |
コンパイル使用メモリ | 171,296 KB |
実行使用メモリ | 15,144 KB |
最終ジャッジ日時 | 2024-06-24 07:52:03 |
合計ジャッジ時間 | 4,860 ms |
ジャッジサーバーID (参考情報) |
judge3 / judge1 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 32 WA * 6 |
ソースコード
#include<bits/stdc++.h> using namespace std; #define INF 1000000000 #define REP(i,n) for(int (i)=0;(i)<(int)(n);(i)++) typedef long long LL; int N; int M; vector<int>G[100001];//辺の相手 vector<int>num[100001];//辺番号 bool used[100001]; bool in[100001]; int main(){ cin>>N>>M; REP(i,M){ int a,b; cin>>a>>b; G[a].push_back(b); num[a].push_back(i); G[b].push_back(a); num[b].push_back(i); } REP(i,100001){ used[i]=false; in[i]=false; } REP(i,N){ bool check=false; REP(j,G[i].size()){ if(used[num[i][j]]==false){ used[num[i][j]]=true; check=true; } } if(check){ in[i]=true; } } for(int i=N-1;i>0;i--){ bool check=false; REP(j,G[i].size()){ if(used[num[i][j]]==false){ check=true; } if(in[G[i][j]]==false){ check=true; } } if(check==false){ in[i]=false; REP(j,G[i].size()){ used[num[i][j]]=false; } } } bool check=false; for(int i=N-1;i>=0;i--){ if(in[i]){ check=true; cout<<1; }else{ if(check){ cout<<0; } } } cout<<endl; return 0; }