結果
問題 | No.145 yukiover |
ユーザー | masa |
提出日時 | 2015-09-24 15:52:33 |
言語 | C++11 (gcc 11.4.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 1,887 bytes |
コンパイル時間 | 497 ms |
コンパイル使用メモリ | 64,784 KB |
実行使用メモリ | 6,948 KB |
最終ジャッジ日時 | 2024-07-19 08:59:33 |
合計ジャッジ時間 | 1,205 ms |
ジャッジサーバーID (参考情報) |
judge5 / judge1 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | WA | - |
testcase_01 | WA | - |
testcase_02 | WA | - |
testcase_03 | WA | - |
testcase_04 | WA | - |
testcase_05 | WA | - |
testcase_06 | WA | - |
testcase_07 | WA | - |
testcase_08 | WA | - |
testcase_09 | WA | - |
testcase_10 | WA | - |
testcase_11 | WA | - |
testcase_12 | WA | - |
testcase_13 | WA | - |
testcase_14 | WA | - |
testcase_15 | WA | - |
testcase_16 | WA | - |
testcase_17 | WA | - |
testcase_18 | WA | - |
testcase_19 | WA | - |
testcase_20 | WA | - |
testcase_21 | WA | - |
testcase_22 | WA | - |
testcase_23 | WA | - |
ソースコード
#include <iostream> #include <cstdio> #include <vector> #include <algorithm> #include <utility> #include <string> using namespace std; int main() { int n; string s; vector<int> chars(255, 0); cin >> n >> s; for (int i = 0; i < n; i++) { chars[s[i]]++; } for (char c = 'a'; c <= 'z'; c++) { printf("%c %d\n", c, chars[c]); } int ans = 0; ans += chars['z']; chars['z'] = 0; int val; // yu for (char c = 'z'; c > 'u'; c--) { if (c == 'y') { continue; } val = min(chars['y'], chars[c]); ans += val; chars['y'] -= val; chars[c] -= val; } // yuk for (char c = 'z'; c > 'k'; c--) { if (c == 'y' || c == 'u') { continue; } val = min({chars['y'], chars['u'], chars[c]}); ans += val; chars['y'] -= val; chars['u'] -= val; chars[c] -= val; } // yuki for (char c = 'z'; c > 'i'; c--) { if (c == 'y' || c == 'u' || c =='k') { continue; } val = min({chars['y'], chars['u'], chars['k'], chars[c]}); ans += val; chars['y'] -= val; chars['u'] -= val; chars['k'] -= val; chars[c] -= val; } for (char c = 'z'; c >= 'a'; c--) { if (c == 'y' || c == 'u' || c =='k' || c == 'i') { continue; } val = min({chars['y'], chars['u'], chars['k'], chars['i'], chars[c]}); ans += val; chars['y'] -= val; chars['u'] -= val; chars['k'] -= val; chars['i'] -= val; chars[c] -= val; } // yukii val = min({chars['y'], chars['u'], chars['k'], chars['i'] / 2}); ans += val; chars['y'] -= val; chars['u'] -= val; chars['k'] -= val; chars['i'] -= val * 2; // yukk val = min({chars['y'], chars['u'], chars['k'] / 2}); ans += val; chars['y'] -= val; chars['u'] -= val; chars['k'] -= val * 2; // yuu val = min(chars['y'], chars['u'] / 2); ans += val; chars['y'] -= val; chars['u'] -= val * 2; // yy val = chars['y'] / 2; ans += val; chars['y'] -= val * 2; cout << ans << endl; return 0; }