結果

問題 No.233 めぐるはめぐる (3)
ユーザー itezpaceitezpace
提出日時 2016-11-02 09:25:23
言語 C++11
(gcc 11.4.0)
結果
WA  
実行時間 -
コード長 1,085 bytes
コンパイル時間 698 ms
コンパイル使用メモリ 77,384 KB
実行使用メモリ 17,680 KB
最終ジャッジ日時 2023-08-16 12:34:46
合計ジャッジ時間 7,481 ms
ジャッジサーバーID
(参考情報)
judge12 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 WA -
testcase_01 WA -
testcase_02 WA -
testcase_03 WA -
testcase_04 WA -
testcase_05 WA -
testcase_06 WA -
testcase_07 WA -
testcase_08 WA -
testcase_09 WA -
testcase_10 WA -
testcase_11 WA -
testcase_12 WA -
testcase_13 WA -
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <set>
using namespace std;
int main(){
  vector<char> v1={'a','a','e','i','u','u'};
  vector<char> v2={'b','g','m','n','r'};
  vector<string> v3;
  for(int i=0;i<v1.size();++i){
    if(i!=1 && i!=5){
    vector<char> v4=v1;
    char a=v4[i];
    v4.erase(v4.begin()+i);
    do{
      vector<char> v5=v2;
      do{
         string s1;
         for(int j=0;j<v5.size();++j){
           s1+=v5[j];
           s1+=v4[j];
         }
         for(int j=0;j<=s1.size();j+=2){
           string s2=s1;
           s2.insert(s2.begin()+j,a);
           v3.push_back(s2);
         }
      } while(next_permutation(v5.begin(),v5.end()));
    } while(next_permutation(v4.begin(),v4.end()));
    }
  }
  int N;cin>>N;
  set<string> s;
  string S;
  for(int i=0;i<N;++i){
    cin>>S;
    s.insert(S);
  }
  int ss1=s.size();
  int f=0;
  for(int i=0;i<v3.size();++i){
    s.insert(v3[i]);
    int ss2=s.size();
    if(ss2>ss1){
      cout<<v3[i];
      f=1;
      break;
    }
  }
  if(f==0){
    cout<<"NO";
  }
}
0