結果
問題 |
No.479 頂点は要らない
|
ユーザー |
![]() |
提出日時 | 2018-07-22 09:16:22 |
言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
結果 |
AC
|
実行時間 | 86 ms / 1,500 ms |
コード長 | 1,231 bytes |
コンパイル時間 | 697 ms |
コンパイル使用メモリ | 81,812 KB |
実行使用メモリ | 9,204 KB |
最終ジャッジ日時 | 2024-12-26 05:07:59 |
合計ジャッジ時間 | 3,831 ms |
ジャッジサーバーID (参考情報) |
judge4 / judge1 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 38 |
ソースコード
#include<stdio.h> #include<string.h> #include<stdlib.h> #include<math.h> #include<stack> #include<queue> #include<vector> #include<algorithm> #include<string> #include<iostream> #include<set> #include<map> #include<bitset> using namespace std; typedef long long ll; #define i_7 1000000007 #define i_5 1000000005 ll mod(ll a){ ll c=a%i_7; if(c>=0)return c; else return c+i_7; } typedef pair<int,int> i_i; typedef pair<ll,ll> l_l; ll inf=1000000000000;/*10^12*/ #define rep(i,l,r) for(ll i=l;i<=r;i++) ll max(ll a,ll b){if(a<b)return b;else return a;} ll min(ll a,ll b){if(a>b)return b;else return a;} ////////////////////////////////////// int main(){ int n,m;cin>>n>>m; vector<int> e[n]; rep(i,0,m-1){ int a,b;cin>>a>>b; e[a].push_back(b); e[b].push_back(a); } bool deleted[n];memset(deleted,false,sizeof(deleted)); for(int v=n-1;v>=0;v--){ bool flag=true; for(auto x:e[v]){ if(deleted[x])flag=false; } if(flag)deleted[v]=true; } int pos=n-1; while(pos>=0&&deleted[pos])pos--; while(pos>=0){ if(!deleted[pos])cout<<1; else cout<<0; pos--; } cout<<endl; return 0; }