結果
| 問題 |
No.145 yukiover
|
| コンテスト | |
| ユーザー |
👑 |
| 提出日時 | 2020-02-07 20:09:50 |
| 言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 719 bytes |
| コンパイル時間 | 655 ms |
| コンパイル使用メモリ | 67,968 KB |
| 実行使用メモリ | 5,376 KB |
| 最終ジャッジ日時 | 2024-09-25 07:25:57 |
| 合計ジャッジ時間 | 1,500 ms |
|
ジャッジサーバーID (参考情報) |
judge4 / judge3 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 2 WA * 2 |
| other | AC * 4 WA * 16 |
ソースコード
#include <iostream>
#include <algorithm>
using namespace std;
int n,dta[9];
int main(){
char yuki[4] = {'y','u','k','i'};
string s;cin>>n>>s;
for(int i = 0; s.size() > i; i++){
bool ok = false;
for(int j = 0; 8 > j; j+=2){
if(s[i] >= yuki[j/2]){
ok = true;
dta[j+s[i]==yuki[j/2]]++;
break;
}
}
if(!ok)dta[8]++;
}reverse(dta,dta+9);
int tans = (dta[1]>dta[0]?dta[0]+(dta[1]-dta[0])/2:dta[1]);
for(int i = 2; 7 > i; i+=2){
int ans = min(dta[i],dta[i+1]);
if(dta[i+1] > dta[i]){
dta[i+1] -= dta[i];
ans += min(dta[i+1],tans);
if(dta[i+1] > tans)ans += (dta[i+1]-tans)/2;
}
tans = ans;
}
cout << tans + dta[8] << endl;
}