Submission #00175
ソースコード
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 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 | #include <iostream> #include <algorithm> #include <string> using namespace std; int main(){ cin.tie(0); ios::sync_with_stdio( false ); int n; while (cin >> n && n){ string str[51]; int m = 0; for ( int i = 0; i < n; ++i){ string s; cin >> s; int cnt = 1; for ( size_t j = 0; j < s.size() - 1; ++j){ if (j == 0) str[i] += s[0]; if (s[j] == 'a' || s[j] == 'i' || s[j] == 'u' || s[j] == 'e' || s[j] == 'o' ){ str[i] += s[j + 1]; cnt++; } } m = max(m, cnt); } //cout << m << endl; for ( int i = 0; i < n; ++i){ for ( int j = 0; j <= m - ( int )str[i].size(); ++j){ str[i] += " " ; } } sort(str, str + n); /*for(int i = 0; i < n; ++i){ cout << str[i] << endl; }*/ int ans = -1; for ( int i = 0; i < m; ++i){ bool check = true ; for ( int j = 0; j < n - 1; ++j){ bool check2 = true ; for ( int k = 0; k <= i; ++k){ if (str[j][k] != str[j + 1][k]){ check2 = false ; break ; } } if (check2){ check = false ; break ; } } if (check){ ans = i + 1; break ; } } cout << ans << endl; } return 0; } |
ステータス
項目 | データ |
---|---|
問題 | 0004 - 空港コード |
ユーザー名 | mds_boy |
投稿日時 | 2015-08-28 11:49:33 |
言語 | C++11 |
状態 | Wrong Answer |
得点 | 0 |
ソースコード長 | 1672 Byte |
最大実行時間 | 25 ms |
最大メモリ使用量 | 688 KB |
セット
セット | 得点 | Cases | |
---|---|---|---|
1 | ALL | 0 / 15 | * |
テストケース
ファイル名 | 状態 | 実行時間 | メモリ使用量 | # |
---|---|---|---|---|
B1 | WA | 20 ms | 476 KB |
1
|
B2 | WA | 21 ms | 688 KB |
1
|
B3 | WA | 25 ms | 644 KB |
1
|
B4 | WA | 18 ms | 464 KB |
1
|