結果
| 問題 |
No.145 yukiover
|
| コンテスト | |
| ユーザー |
h_noson
|
| 提出日時 | 2016-06-08 23:32:05 |
| 言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
| 結果 |
AC
|
| 実行時間 | 4 ms / 5,000 ms |
| コード長 | 797 bytes |
| コンパイル時間 | 616 ms |
| コンパイル使用メモリ | 66,260 KB |
| 実行使用メモリ | 5,248 KB |
| 最終ジャッジ日時 | 2024-10-09 04:55:21 |
| 合計ジャッジ時間 | 1,413 ms |
|
ジャッジサーバーID (参考情報) |
judge3 / judge2 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 4 |
| other | AC * 20 |
ソースコード
#include <iostream>
#include <vector>
#include <map>
#include <algorithm>
using namespace std;
#define REP(i,s,e) for (i = s; i <= e; i++)
#define rep(i,n) REP (i,0,(int)(n)-1)
#define RREP(i,s,e) for (i = s; i >= e; i--)
#define rrep(i,n) RREP (i,(int)(n)-1,0)
#define INF (int)1e8
#define MOD (int)(1e9+7)
typedef long long ll;
int cnt[256];
int count(string s, char c) {
int ret = 0;
if (s.empty()) {
for (; c >= 'a'; c--)
ret += cnt[c];
return ret;
}
for (; s[0] < c; c--)
ret += cnt[c];
int x = min(cnt[c], count(s.substr(1), c-1));
ret += x + (cnt[c] - x) / 2;
return ret;
}
int main(void) {
int i, n;
string s;
cin >> n >> s;
rep (i,n) cnt[s[i]]++;
cout << count("yuki",'z') << endl;
return 0;
}
h_noson