Submission #00164


ソースコード

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
#include<bits/stdc++.h>
using namespace std;
const char boin[] = "aiueo";
int main(){
int n;
while(cin >> n, n){
string name[50];
for(int i = 0; i < n; i++) cin >> name[i];
bool flug = true;
int i;
for(i = 1; i <= 50; i++){
flug = true;
map<string, string> m;
for(int j = 0; j < n; j++){
string code;
code += name[j][0];
int x = 1;
while(name[j].length() >= x && code.length() < i){
for(int k = 0; k < 5; k++){
if(name[j][x - 1] == boin[k]){
code += name[j][x];
break;
}
}
x++;
}
if(m.count(code) == 1){
flug = false;
break;
}
else m[code] = 1;
}
if(flug == true) break;
}
if(flug == true) cout << i << endl;
else cout << -1 << endl;
}
}

ステータス

項目 データ
問題 0004 - 空港コード
ユーザー名 Ak-u.Cielo
投稿日時 2015-08-28 11:33:03
言語 C++11
状態 Accepted
得点 15
ソースコード長 795 Byte
最大実行時間 31 ms
最大メモリ使用量 692 KB

セット

セット 得点 Cases
1 ALL 15 / 15 *

テストケース

ファイル名 状態 実行時間 メモリ使用量 #
B1 AC 31 ms 472 KB
1
B2 AC 26 ms 692 KB
1
B3 AC 29 ms 652 KB
1
B4 AC 26 ms 616 KB
1