結果

問題 No.233 めぐるはめぐる (3)
ユーザー 158b158b
提出日時 2015-06-27 20:41:23
言語 C++11
(gcc 11.4.0)
結果
WA  
実行時間 -
コード長 1,638 bytes
コンパイル時間 1,319 ms
コンパイル使用メモリ 98,448 KB
実行使用メモリ 19,556 KB
最終ジャッジ日時 2023-09-22 03:19:54
合計ジャッジ時間 6,224 ms
ジャッジサーバーID
(参考情報)
judge11 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 148 ms
18,664 KB
testcase_01 AC 98 ms
17,008 KB
testcase_02 AC 49 ms
10,964 KB
testcase_03 AC 108 ms
17,008 KB
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 1 ms
4,380 KB
testcase_11 RE -
testcase_12 AC 100 ms
16,756 KB
testcase_13 AC 156 ms
19,032 KB
権限があれば一括ダウンロードができます

ソースコード

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;
			vector< pair<string,string> >::iterator itr = s.begin();
			for(int i=0; i<cnt; i++){
				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