結果

問題 No.408 五輪ピック
ユーザー itezpaceitezpace
提出日時 2016-08-06 00:43:29
言語 C++11
(gcc 11.4.0)
結果
TLE  
実行時間 -
コード長 812 bytes
コンパイル時間 1,695 ms
コンパイル使用メモリ 165,980 KB
実行使用メモリ 11,776 KB
最終ジャッジ日時 2024-04-24 15:48:52
合計ジャッジ時間 8,090 ms
ジャッジサーバーID
(参考情報)
judge4 / judge2
このコードへのチャレンジ
(要ログイン)

テストケース

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

ソースコード

diff #

#include <bits/stdc++.h>
using namespace std;
typedef long long ll;

vector<vector<int>> v;
int n;
int x;

void calc(int a,int b,vector<int> vi){
  vector<int> vi2;
  vi2=vi;
  vi2[a]=1;
  if(b>=5){
    //
  } else {
  for(int i=0; i<n; ++i){
    if(v[a][i]==1){
      if(vi2[i]==0){
        calc(i,b+1,vi2);
      }
    }
    if(v[a][0]==1){
      if(b==4){
        x=1;
      }
    }
  }
  }
}

int main(){
  int m,a,b;
  cin>>n>>m;
  v.resize(n);
  for(int i=0; i<n; ++i){
    v[i].resize(n);
    for(int j=0; j<n; ++j){
      v[i][j]=0;
    }
  }
  for(int i=0; i<m; ++i){
    cin>>a>>b;
    v[a-1][b-1]=1;
    v[b-1][a-1]=1;
  }
  vector<int> vi;
  for(int i=0; i<n; ++i){
    vi.push_back(0);
  }
  x=0;
  calc(0,0,vi);
  if(x==1){
    cout<<"YES"<<endl;
  } else {
    cout<<"NO"<<endl;
  }
  return 0;
}
0