結果

問題 No.233 めぐるはめぐる (3)
ユーザー 158b158b
提出日時 2015-06-27 20:36:46
言語 C++11
(gcc 11.4.0)
結果
WA  
実行時間 -
コード長 1,627 bytes
コンパイル時間 1,275 ms
コンパイル使用メモリ 98,840 KB
実行使用メモリ 19,668 KB
最終ジャッジ日時 2023-09-22 03:18:33
合計ジャッジ時間 7,193 ms
ジャッジサーバーID
(参考情報)
judge15 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 WA -
testcase_01 AC 103 ms
16,888 KB
testcase_02 AC 50 ms
10,056 KB
testcase_03 WA -
testcase_04 WA -
testcase_05 WA -
testcase_06 WA -
testcase_07 WA -
testcase_08 WA -
testcase_09 AC 2 ms
4,380 KB
testcase_10 AC 2 ms
4,376 KB
testcase_11 WA -
testcase_12 WA -
testcase_13 WA -
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <iostream>
#include <algorithm>
#include <functional>
#include <string>
#include <climits>
#include <vector>
#include <numeric>
#include <complex>
#include <map>
#include <bitset>
using namespace std;

//#define __int64 long long
#define long __int64
#define REP(i,a,b) for(int i=a;i<b;i++)
#define rep(i,n) REP(i,0,n)
const int Vecy[4] = {0,-1,0,1};
const int Vecx[4] = {1,0,-1,0};


int main(){
	int n;
	vector<pair<string,string> > s;
	vector<string> s2;
	string in;
	string d1,d2;
	string data = "inabameguru";
	string data1 = "aaeiuu";
	string data2 = "bgmnr";
	string check;
	string c = "aaaaaa";
	char check1[6] = {'a','a','e','i','u','u'};
	char check2[5] = {'b','g','m','n','r'};
	bool flg = true;
	
	cin >> n;
	for(int i=0; i<n; i++){
		cin >> in;
		d1 = "";
		d2 = "";
		for(int ii=0; ii<5; ii++){
			d1 += in[ii*2];
			d2 += in[ii*2+1];
		}
		d1 += in[10];
		
		s.push_back( make_pair(d1, d2) );
		s2.push_back(in);
	}
	
	sort(s.begin(), s.end());
	sort(s2.begin(), s2.end());
	int cnt = 0;
	
	
	do{
		for(int i=0; i<5; i++){
			check2[i] = data2[i];
		}
		
		do{
			flg = false;
			for(vector< pair<string, string> >::iterator itr = s.begin(); itr != s.end(); itr++){
				for(int i=0; i<5; i++){
					if(check2[i] != itr->second[i]){
						flg = true;
						break;
					}
				}
			}
			
			if(flg){
				for(int i=0; i<5; i++){
					cout << check1[i];
					cout << check2[i];
				}
				cout << check1[5] << endl;
			}
			cnt ++;
		
		}while( next_permutation(check2, check2 + 5) && !flg);
	}while( next_permutation(check1, check1 + 6) && !flg);
	
    if(!flg){
		cout << "NO" << endl;
    }
    return 0;
}
0