結果
問題 |
No.145 yukiover
|
ユーザー |
|
提出日時 | 2025-07-23 09:24:38 |
言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 895 bytes |
コンパイル時間 | 2,018 ms |
コンパイル使用メモリ | 198,304 KB |
実行使用メモリ | 7,716 KB |
最終ジャッジ日時 | 2025-07-23 09:24:41 |
合計ジャッジ時間 | 3,773 ms |
ジャッジサーバーID (参考情報) |
judge1 / judge2 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 4 |
other | AC * 11 WA * 9 |
ソースコード
#include <bits/stdc++.h> using namespace std; int main(){ ios_base::sync_with_stdio(false); cin.tie(nullptr); int N; cin >> N; string s; cin >> s; vector<int> C(26); for(auto c : s) C.at(c-'a')++; string yuki = "yuki"; int answer = C.at(25); C.at(25) = 0; int low = 0,high = C.at(24)+1; while(high-low > 1){ int mid = (high+low)/2; auto D = C; int left = mid; D.at(24) -= mid; for(int c=1; c<4; c++){ int p1 = yuki.at(c-1)-'a',p2 = yuki.at(c)-'a'; for(int p=p2+1; p<=p1; p++){ left -= D.at(p); if(left <= 0){left = 0; break;} } if(left > D.at(p2) || left <= 0) break; D.at(p2) -= left; } if(left == 0) low = mid; else high = mid; } answer += low; cout << answer << endl; }