結果

問題 No.233 めぐるはめぐる (3)
ユーザー 158b158b
提出日時 2015-06-27 00:49:10
言語 C++11
(gcc 11.4.0)
結果
WA  
実行時間 -
コード長 1,672 bytes
コンパイル時間 1,814 ms
コンパイル使用メモリ 106,868 KB
実行使用メモリ 19,596 KB
最終ジャッジ日時 2023-09-22 02:56:59
合計ジャッジ時間 6,576 ms
ジャッジサーバーID
(参考情報)
judge13 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 WA -
testcase_01 WA -
testcase_02 WA -
testcase_03 WA -
testcase_04 WA -
testcase_05 WA -
testcase_06 WA -
testcase_07 AC 99 ms
19,408 KB
testcase_08 AC 95 ms
19,356 KB
testcase_09 AC 2 ms
4,376 KB
testcase_10 AC 2 ms
4,380 KB
testcase_11 AC 2 ms
4,376 KB
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 = "aaaaa";
	int check1[6] = {0,1,2,3,4,5};
	int check2[5] = {0,1,2,3,4};
	bool flg = true;
	map<string, int> cnt;
	
	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);
		cnt[d1] ++;
	}
	
	if(n >= 180 * 120){
		cout << "NO" << endl;
		return 0;
	}
	
	sort(s.begin(), s.end());
	sort(s2.begin(), s2.end());
	
	
	do{
		for(int i=0; i<6; i++){
			c[i] = data1[check1[i]];
		}
		
		if(cnt[c] >= 120){
			continue;
		}
		
		for(int i=0; i<5; i++){
			check2[i] = i;
		}
		
		do{
			check = "";
			for(int i=0; i<5; i++){
				check += data1[ check1[i] ];
				check += data2[ check2[i] ];
			}
			check += data1[5];
			
			flg = true;
			for(int i=0; i<n; i++){
				if(check == s2[i]){
					flg = false;
					break;
				}
			}
			
			if(flg){
				cout << check << endl;
			}
		
		}while( next_permutation(check2, check2 + 5) && !flg);
	}while( next_permutation(check1, check1 + 6) && !flg);
	
    
    return 0;
}
0