結果

問題 No.479 頂点は要らない
ユーザー bachoppibachoppi
提出日時 2020-07-20 18:21:56
言語 C++14
(gcc 13.2.0 + boost 1.83.0)
結果
AC  
実行時間 133 ms / 1,500 ms
コード長 1,160 bytes
コンパイル時間 1,144 ms
コンパイル使用メモリ 103,776 KB
実行使用メモリ 14,176 KB
最終ジャッジ日時 2023-08-25 19:48:50
合計ジャッジ時間 4,743 ms
ジャッジサーバーID
(参考情報)
judge15 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
4,380 KB
testcase_01 AC 1 ms
4,380 KB
testcase_02 AC 2 ms
4,380 KB
testcase_03 AC 1 ms
4,376 KB
testcase_04 AC 2 ms
4,380 KB
testcase_05 AC 2 ms
4,376 KB
testcase_06 AC 1 ms
4,388 KB
testcase_07 AC 2 ms
4,380 KB
testcase_08 AC 1 ms
4,376 KB
testcase_09 AC 2 ms
4,376 KB
testcase_10 AC 1 ms
4,380 KB
testcase_11 AC 2 ms
4,376 KB
testcase_12 AC 1 ms
4,376 KB
testcase_13 AC 1 ms
4,376 KB
testcase_14 AC 2 ms
4,376 KB
testcase_15 AC 2 ms
4,376 KB
testcase_16 AC 2 ms
4,380 KB
testcase_17 AC 1 ms
4,380 KB
testcase_18 AC 1 ms
4,376 KB
testcase_19 AC 2 ms
4,380 KB
testcase_20 AC 2 ms
4,380 KB
testcase_21 AC 2 ms
4,380 KB
testcase_22 AC 2 ms
4,376 KB
testcase_23 AC 2 ms
4,376 KB
testcase_24 AC 2 ms
4,384 KB
testcase_25 AC 2 ms
4,376 KB
testcase_26 AC 133 ms
13,896 KB
testcase_27 AC 133 ms
14,176 KB
testcase_28 AC 95 ms
13,904 KB
testcase_29 AC 89 ms
8,948 KB
testcase_30 AC 88 ms
8,948 KB
testcase_31 AC 89 ms
8,912 KB
testcase_32 AC 93 ms
8,904 KB
testcase_33 AC 90 ms
9,348 KB
testcase_34 AC 96 ms
9,500 KB
testcase_35 AC 80 ms
6,356 KB
testcase_36 AC 42 ms
4,520 KB
testcase_37 AC 98 ms
10,220 KB
testcase_38 AC 81 ms
8,560 KB
testcase_39 AC 59 ms
8,084 KB
testcase_40 AC 78 ms
10,032 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include<iostream>
#include<string>
#include<cstring>
#include<algorithm>
#include<vector>
#include<iomanip>
#include<math.h>
#include<complex>
#include<queue>
#include<deque>
#include<stack>
#include<map>
#include<set>
#include<bitset>
#include<functional>
#include<assert.h>
#include<numeric>
using namespace std;
#define REP(i,m,n) for(int i=(int)(m) ; i < (int) (n) ; ++i )
#define rep(i,n) REP(i,0,n)
using ll = long long;
const int inf=1e9+7;
const ll longinf=1LL<<60 ;
const ll mod=1e9+7 ;
#define PI 3.141592653589793


int main(){
  int n, m; cin >> n >> m; vector<int> to[n];
  rep(i, m){
    int a, b; cin >> a >> b; 
    to[a].push_back(b); to[b].push_back(a);
  }
  set<int> ans; set<int> ok;
  for(int i=n-1; i>=0; i--){
    bool can = false;
    for(int k: to[i]){
      if(ok.count(k)){
        can = true; ans.insert(i);
      }
    }
    if(!can){
      ok.insert(i); //cout << i << endl;
    }
  }
  int tmp[n] = {};
  for(auto k: ans){
    tmp[k] = 1; //cout << k << endl;
  }
  reverse(tmp, tmp+n); bool zero = true;
  rep(i, n){
    if(zero && tmp[i]==0) continue;
    if(tmp[i]==1) zero = false;
    cout << tmp[i];
  }
  cout << endl;
}
0