結果

問題 No.479 頂点は要らない
ユーザー どららどらら
提出日時 2017-01-27 23:40:44
言語 C++11
(gcc 11.4.0)
結果
AC  
実行時間 85 ms / 1,500 ms
コード長 953 bytes
コンパイル時間 1,299 ms
コンパイル使用メモリ 147,068 KB
実行使用メモリ 9,332 KB
最終ジャッジ日時 2023-08-25 11:05:16
合計ジャッジ時間 4,292 ms
ジャッジサーバーID
(参考情報)
judge15 / judge11
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 4 ms
5,704 KB
testcase_01 AC 4 ms
5,696 KB
testcase_02 AC 4 ms
5,696 KB
testcase_03 AC 3 ms
5,692 KB
testcase_04 AC 3 ms
5,708 KB
testcase_05 AC 3 ms
5,760 KB
testcase_06 AC 4 ms
5,760 KB
testcase_07 AC 3 ms
5,744 KB
testcase_08 AC 3 ms
5,688 KB
testcase_09 AC 3 ms
5,712 KB
testcase_10 AC 4 ms
5,688 KB
testcase_11 AC 4 ms
5,696 KB
testcase_12 AC 3 ms
6,012 KB
testcase_13 AC 3 ms
5,768 KB
testcase_14 AC 4 ms
5,696 KB
testcase_15 AC 3 ms
5,756 KB
testcase_16 AC 4 ms
5,816 KB
testcase_17 AC 3 ms
5,820 KB
testcase_18 AC 3 ms
5,832 KB
testcase_19 AC 4 ms
5,736 KB
testcase_20 AC 4 ms
5,744 KB
testcase_21 AC 3 ms
5,720 KB
testcase_22 AC 4 ms
5,748 KB
testcase_23 AC 4 ms
5,784 KB
testcase_24 AC 4 ms
5,792 KB
testcase_25 AC 3 ms
5,808 KB
testcase_26 AC 85 ms
8,832 KB
testcase_27 AC 85 ms
8,884 KB
testcase_28 AC 69 ms
9,332 KB
testcase_29 AC 67 ms
7,608 KB
testcase_30 AC 67 ms
7,616 KB
testcase_31 AC 67 ms
7,564 KB
testcase_32 AC 67 ms
7,668 KB
testcase_33 AC 70 ms
7,928 KB
testcase_34 AC 78 ms
7,868 KB
testcase_35 AC 65 ms
7,488 KB
testcase_36 AC 37 ms
6,656 KB
testcase_37 AC 75 ms
8,076 KB
testcase_38 AC 64 ms
7,576 KB
testcase_39 AC 45 ms
7,160 KB
testcase_40 AC 54 ms
7,688 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
using namespace std;
#define REP(i,a,n) for(int i=(a); i<(int)(n); i++)
#define rep(i,n) REP(i,0,n)
#define FOR(it,c) for(__typeof((c).begin()) it=(c).begin(); it!=(c).end(); ++it)
#define ALLOF(c) (c).begin(), (c).end()
typedef long long ll;
typedef unsigned long long ull;

vector<int> adj[100005];

int main(){
  int n, m;
  cin >> n >> m;
  rep(i,m){
    int a, b;
    cin >> a >> b;
    adj[a].push_back(b);
    adj[b].push_back(a);
  }
  
  vector<int> use(n,-1);
  for(int i=n-1; i>=0; i--){
    if(use[i]==-1){
      bool flg = false;
      rep(j,adj[i].size()){
        if(adj[i][j] > j && use[adj[i][j]] == 0){
          flg = true;
          break;
        }
      }
      if(flg){
        use[i] = 1;
      }else{
        use[i] = 0;
      }
    }
  }

  bool flg = false;
  for(int i=n-1; i>=0; i--){
    if(!flg && use[i]==1){
      flg = true;
    }
    if(flg) cout << use[i];
  }
  cout << endl;
  return 0;
}

0