結果

問題 No.479 頂点は要らない
ユーザー rickythetarickytheta
提出日時 2017-01-27 23:01:05
言語 C++11
(gcc 11.4.0)
結果
AC  
実行時間 42 ms / 1,500 ms
コード長 1,407 bytes
コンパイル時間 2,750 ms
コンパイル使用メモリ 147,748 KB
実行使用メモリ 9,796 KB
最終ジャッジ日時 2023-08-25 04:35:21
合計ジャッジ時間 3,327 ms
ジャッジサーバーID
(参考情報)
judge15 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 4 ms
6,440 KB
testcase_01 AC 4 ms
6,440 KB
testcase_02 AC 4 ms
6,320 KB
testcase_03 AC 3 ms
6,400 KB
testcase_04 AC 3 ms
6,316 KB
testcase_05 AC 4 ms
6,316 KB
testcase_06 AC 4 ms
6,600 KB
testcase_07 AC 4 ms
6,492 KB
testcase_08 AC 4 ms
6,520 KB
testcase_09 AC 4 ms
6,412 KB
testcase_10 AC 4 ms
6,388 KB
testcase_11 AC 3 ms
6,468 KB
testcase_12 AC 4 ms
6,496 KB
testcase_13 AC 4 ms
6,328 KB
testcase_14 AC 4 ms
6,408 KB
testcase_15 AC 4 ms
6,600 KB
testcase_16 AC 4 ms
6,388 KB
testcase_17 AC 4 ms
6,328 KB
testcase_18 AC 4 ms
6,336 KB
testcase_19 AC 4 ms
6,416 KB
testcase_20 AC 4 ms
6,448 KB
testcase_21 AC 4 ms
6,348 KB
testcase_22 AC 4 ms
6,376 KB
testcase_23 AC 4 ms
6,480 KB
testcase_24 AC 4 ms
6,480 KB
testcase_25 AC 4 ms
6,448 KB
testcase_26 AC 42 ms
9,640 KB
testcase_27 AC 41 ms
9,792 KB
testcase_28 AC 30 ms
9,796 KB
testcase_29 AC 32 ms
8,512 KB
testcase_30 AC 31 ms
8,324 KB
testcase_31 AC 32 ms
8,436 KB
testcase_32 AC 32 ms
8,408 KB
testcase_33 AC 34 ms
8,488 KB
testcase_34 AC 35 ms
8,632 KB
testcase_35 AC 32 ms
8,220 KB
testcase_36 AC 19 ms
7,520 KB
testcase_37 AC 37 ms
8,868 KB
testcase_38 AC 31 ms
8,260 KB
testcase_39 AC 22 ms
8,020 KB
testcase_40 AC 28 ms
8,548 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>

using namespace std;

typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;

typedef int _loop_int;
#define REP(i,n) for(_loop_int i=0;i<(_loop_int)(n);++i)
#define FOR(i,a,b) for(_loop_int i=(_loop_int)(a);i<(_loop_int)(b);++i)
#define FORR(i,a,b) for(_loop_int i=(_loop_int)(b)-1;i>=(_loop_int)(a);--i)

#define DEBUG(x) cout<<#x<<": "<<x<<endl
#define DEBUG_VEC(v) cout<<#v<<":";REP(i,v.size())cout<<" "<<v[i];cout<<endl
#define ALL(a) (a).begin(),(a).end()

#define CHMIN(a,b) a=min((a),(b))
#define CHMAX(a,b) a=max((a),(b))

// mod
const ll MOD = 1000000007ll;
#define FIX(a) ((a)%MOD+MOD)%MOD

// floating
typedef double Real;
const Real EPS = 1e-11;
#define EQ0(x) (abs(x)<EPS)
#define EQ(a,b) (abs(a-b)<EPS)
typedef complex<Real> P;

int n,m;
vi g[125252];
bool used[125252];
bool eee[125252];

int main(){
  scanf("%d%d",&n,&m);
  set<pair<pii,int>> S;
  REP(i,m){
    int a,b;
    scanf("%d%d",&a,&b);
    g[a].push_back(i);
    g[b].push_back(i);
  }
  FORR(i,0,n){
    bool flag = false;
    for(int x : g[i]){
      if(eee[x]){
        flag = true;
      }
    }
    if(flag){
      used[i] = true;
    }else{
      for(int x : g[i]){
        eee[x] = true;
      }
    }
  }
  int i=n-1;
  while(!used[i])--i;
  while(i>=0){
    putchar(used[i]?'1':'0');
    --i;
  }
  putchar('\n');
  return 0;
}
0