結果
| 問題 |
No.145 yukiover
|
| コンテスト | |
| ユーザー |
hotpepsi
|
| 提出日時 | 2015-02-07 01:35:03 |
| 言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 1,335 bytes |
| コンパイル時間 | 569 ms |
| コンパイル使用メモリ | 60,636 KB |
| 実行使用メモリ | 5,376 KB |
| 最終ジャッジ日時 | 2024-06-23 10:30:17 |
| 合計ジャッジ時間 | 1,437 ms |
|
ジャッジサーバーID (参考情報) |
judge1 / judge3 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 4 |
| other | AC * 15 WA * 5 |
ソースコード
#include <iostream>
#include <algorithm>
#include <sstream>
#include <cstdio>
using namespace std;
int main(int argc, char *argv[]) {
string s;
getline(cin, s);
int N = atoi(s.c_str());
getline(cin, s);
int cnt[256] = {};
for (char c : s) {
cnt[c] += 1;
}
int ans = cnt['z'];
cnt['z'] = 0;
while (cnt['y'] && cnt['u'] && cnt['k'] && cnt['i']) {
int i;
for (i = 'a'; i < 'i'; ++i) {
if (cnt[i]) {
break;
}
}
if (i >= 'i') {
break;
}
++ans;
cnt['y'] -= 1, cnt['u'] -= 1, cnt['k'] -= 1, cnt['i'] -= 1, cnt[i] -= 1;
}
while (cnt['y'] && cnt['u'] && cnt['k'] && cnt['j']) {
++ans;
cnt['y'] -= 1, cnt['u'] -= 1, cnt['k'] -= 1, cnt['j'] -= 1;
}
while (cnt['y'] && cnt['u'] && cnt['k'] >= 2) {
++ans;
cnt['y'] -= 1, cnt['u'] -= 1, cnt['k'] -= 2;
}
while (cnt['y'] && cnt['u']) {
int i;
for (i = 'l'; i < 'u'; ++i) {
if (cnt[i]) {
break;
}
}
if (i >= 'u') {
break;
}
++ans;
cnt['y'] -= 1, cnt['u'] -= 1, cnt[i] -= 1;
}
while (cnt['y'] && cnt['u'] >= 2) {
++ans;
cnt['y'] -= 1, cnt['u'] -= 2;
}
while (cnt['y']) {
int i;
for (i = 'v'; i < 'y'; ++i) {
if (cnt[i]) {
break;
}
}
if (i >= 'y') {
break;
}
++ans;
cnt['y'] -= 1, cnt[i] -= 1;
}
while (cnt['y'] >= 2) {
cnt['y'] -= 2;
++ans;
}
cout << ans << endl;
return 0;
}
hotpepsi