結果

問題 No.233 めぐるはめぐる (3)
ユーザー itezpaceitezpace
提出日時 2016-11-02 09:26:40
言語 C++11
(gcc 11.4.0)
結果
AC  
実行時間 203 ms / 1,000 ms
コード長 1,097 bytes
コンパイル時間 663 ms
コンパイル使用メモリ 78,228 KB
実行使用メモリ 17,292 KB
最終ジャッジ日時 2023-08-16 12:35:09
合計ジャッジ時間 4,759 ms
ジャッジサーバーID
(参考情報)
judge12 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 139 ms
16,844 KB
testcase_01 AC 91 ms
13,440 KB
testcase_02 AC 42 ms
10,128 KB
testcase_03 AC 94 ms
14,084 KB
testcase_04 AC 195 ms
17,292 KB
testcase_05 AC 200 ms
17,216 KB
testcase_06 AC 190 ms
17,144 KB
testcase_07 AC 200 ms
17,192 KB
testcase_08 AC 203 ms
17,252 KB
testcase_09 AC 11 ms
7,704 KB
testcase_10 AC 11 ms
8,032 KB
testcase_11 AC 10 ms
7,872 KB
testcase_12 AC 88 ms
13,420 KB
testcase_13 AC 144 ms
16,976 KB
権限があれば一括ダウンロードができます

ソースコード

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]<<endl;
      f=1;
      break;
    }
  }
  if(f==0){
    cout<<"NO"<<endl;
  }
}
0