結果
| 問題 |
No.2997 Making YuzuKizu
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2024-12-22 16:15:51 |
| 言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
AC
|
| 実行時間 | 17 ms / 2,000 ms |
| コード長 | 1,436 bytes |
| コンパイル時間 | 2,011 ms |
| コンパイル使用メモリ | 196,904 KB |
| 最終ジャッジ日時 | 2025-02-26 16:08:02 |
|
ジャッジサーバーID (参考情報) |
judge2 / judge1 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 1 |
| other | AC * 17 |
ソースコード
#include <bits/stdc++.h>
using namespace std;
int main(){
ios_base::sync_with_stdio(false);
cin.tie(nullptr);
string s; cin >> s;
vector<int> ap(26);
for(auto &c : s) ap.at(c-'a')++;
string Yuzuki = "yukari",Kizuna = "akari",Kawaii = "yuzukizu";
int low = 0,high = s.size();
while(high-low > 1){
int mid = (low+high)/2;
bool ok = true;
for(auto &c : Yuzuki){
ap.at(c-'a') -= mid;
if(ap.at(c-'a') < 0) ok = false;
}
for(auto &c : Yuzuki) ap.at(c-'a') += mid;
if(ok) low = mid;
else high = mid;
}
cout << low << " ";
low = 0,high = s.size();
while(high-low > 1){
int mid = (low+high)/2;
bool ok = true;
for(auto &c : Kizuna){
ap.at(c-'a') -= mid;
if(ap.at(c-'a') < 0) ok = false;
}
for(auto &c : Kizuna) ap.at(c-'a') += mid;
if(ok) low = mid;
else high = mid;
}
cout << low << " ";
low = 0,high = s.size();
while(high-low > 1){
int mid = (low+high)/2;
bool ok = true;
for(auto &c : Kawaii){
ap.at(c-'a') -= mid;
if(ap.at(c-'a') < 0) ok = false;
}
for(auto &c : Kawaii) ap.at(c-'a') += mid;
if(ok) low = mid;
else high = mid;
}
cout << low << endl;
//結月ゆかり紲星あかり誕生日おめでとう~.
}