結果

問題 No.479 頂点は要らない
ユーザー ikdikd
提出日時 2017-01-28 12:17:53
言語 C++11
(gcc 11.4.0)
結果
WA  
実行時間 -
コード長 1,049 bytes
コンパイル時間 1,095 ms
コンパイル使用メモリ 69,144 KB
実行使用メモリ 12,228 KB
最終ジャッジ日時 2023-08-25 13:02:51
合計ジャッジ時間 4,856 ms
ジャッジサーバーID
(参考情報)
judge14 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
4,380 KB
testcase_01 AC 1 ms
4,380 KB
testcase_02 AC 1 ms
4,380 KB
testcase_03 AC 1 ms
4,380 KB
testcase_04 AC 2 ms
4,380 KB
testcase_05 AC 2 ms
4,380 KB
testcase_06 AC 1 ms
4,384 KB
testcase_07 AC 1 ms
4,384 KB
testcase_08 AC 2 ms
4,380 KB
testcase_09 AC 1 ms
4,380 KB
testcase_10 AC 2 ms
4,380 KB
testcase_11 AC 1 ms
4,380 KB
testcase_12 AC 1 ms
4,380 KB
testcase_13 AC 1 ms
4,380 KB
testcase_14 AC 2 ms
4,380 KB
testcase_15 AC 2 ms
4,380 KB
testcase_16 AC 2 ms
4,384 KB
testcase_17 AC 1 ms
4,384 KB
testcase_18 AC 2 ms
4,380 KB
testcase_19 WA -
testcase_20 WA -
testcase_21 WA -
testcase_22 WA -
testcase_23 WA -
testcase_24 WA -
testcase_25 WA -
testcase_26 WA -
testcase_27 WA -
testcase_28 WA -
testcase_29 TLE -
testcase_30 -- -
testcase_31 -- -
testcase_32 -- -
testcase_33 -- -
testcase_34 -- -
testcase_35 -- -
testcase_36 -- -
testcase_37 -- -
testcase_38 -- -
testcase_39 -- -
testcase_40 -- -
権限があれば一括ダウンロードができます

ソースコード

diff #

#include<iostream>
#include<vector>
#include<algorithm>

using namespace std;

struct E{
   int to, id;
};

signed main(){

   int N, M;
   cin>> N>> M;
   vector<E> g[N];
   for(int i=0; i<M; i++){
      int a, b;
      cin>> a>> b;
      g[a].push_back(E{b, i});
      g[b].push_back(E{a, i});
   }

   for(int i=0; i<(1<<N); i++){
      vector<int> v;
      for(int j=0; j<N; j++){
         v.push_back((i>>j)&1);
      }
      vector<int> used(M, 0);
      for(int k=0; k<N; k++){
         if(v[k]){
            for(auto e: g[k]){
               used[e.id]=1;
            }
         }
      }
      int s=0;
      for(int u: used) s+=u;
      if(s==M){
         reverse(v.begin(), v.end());
         bool Lz=true;
         for(int d: v){
            if(d==0){
               if(Lz){

               }else{
                  cout<< d;
               }
            }else{
               if(Lz){
                  Lz=false;
               }
               cout<< d;
            }
         }cout<< endl;
         break;
      }
   }

   return 0;
}
0