結果
問題 | No.145 yukiover |
ユーザー |
![]() |
提出日時 | 2020-05-22 18:59:29 |
言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 1,086 bytes |
コンパイル時間 | 1,328 ms |
コンパイル使用メモリ | 168,296 KB |
実行使用メモリ | 6,824 KB |
最終ジャッジ日時 | 2024-10-05 07:15:59 |
合計ジャッジ時間 | 2,142 ms |
ジャッジサーバーID (参考情報) |
judge3 / judge1 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 4 |
other | AC * 18 WA * 2 |
ソースコード
#include <bits/stdc++.h> using namespace std; int N; int z, y, uy, u, uu, k, uk, i, ui; int main() { cin >> N; while (N--) { char c; cin >> c; if (c == 'z') z++; else if (c == 'y') y++; else if (c > 'u') uy++; else if (c == 'u') u++; else if (c > 'k') uu++; else if (c == 'k') k++; else if (c > 'i') uk++; else if (c == 'i') i++; else ui++; } int ans = 0; while (y && u && k && i && ui) ans++, y--, u--, k--, i--, ui--; while (y && u && k && i >= 2) ans++, y--, u--, k--, i -= 2; while (y && u && k && uk) ans++, y--, u--, k--, uk--; while (y && u && k >= 2) ans++, y--, u--, k -= 2; while (y && u && uu) ans++, y--, u--, uk--; while (y && u >= 2) ans++, y--, u -= 2; while (y && uy) ans++, y--, uy--; while (y >= 2) ans++, y -= 2; ans += z; cout << ans << endl; }