結果

問題 No.145 yukiover
ユーザー __math__math
提出日時 2015-02-28 01:04:12
言語 C++11
(gcc 11.4.0)
結果
AC  
実行時間 6 ms / 5,000 ms
コード長 1,618 bytes
コンパイル時間 740 ms
コンパイル使用メモリ 103,424 KB
実行使用メモリ 4,384 KB
最終ジャッジ日時 2023-09-06 03:50:51
合計ジャッジ時間 2,018 ms
ジャッジサーバーID
(参考情報)
judge12 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
4,380 KB
testcase_01 AC 2 ms
4,380 KB
testcase_02 AC 1 ms
4,376 KB
testcase_03 AC 2 ms
4,380 KB
testcase_04 AC 1 ms
4,376 KB
testcase_05 AC 2 ms
4,384 KB
testcase_06 AC 1 ms
4,380 KB
testcase_07 AC 2 ms
4,380 KB
testcase_08 AC 2 ms
4,380 KB
testcase_09 AC 1 ms
4,376 KB
testcase_10 AC 2 ms
4,380 KB
testcase_11 AC 3 ms
4,376 KB
testcase_12 AC 6 ms
4,376 KB
testcase_13 AC 4 ms
4,384 KB
testcase_14 AC 5 ms
4,376 KB
testcase_15 AC 4 ms
4,376 KB
testcase_16 AC 2 ms
4,376 KB
testcase_17 AC 5 ms
4,380 KB
testcase_18 AC 5 ms
4,380 KB
testcase_19 AC 6 ms
4,376 KB
testcase_20 AC 5 ms
4,376 KB
testcase_21 AC 5 ms
4,380 KB
testcase_22 AC 5 ms
4,380 KB
testcase_23 AC 5 ms
4,376 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#define _USE_MATH_DEFINES
#define _CRT_SECURE_NO_DEPRECATE

#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <climits>
#include <cfloat>
#include <ctime>
#include <cassert>
#include <map>
#include <utility>
#include <set>
#include <iostream>
#include <memory>
#include <string>
#include <vector>
#include <algorithm>
#include <functional>
#include <sstream>
#include <complex>
#include <stack>
#include <queue>
#include <numeric>
#include <list>
#include <iomanip>
#include <fstream>
#include <iterator>
#include <bitset>

using namespace std;

typedef long long ll;
typedef unsigned long long ull;
typedef pair<int, int> Pii;
typedef pair<ll, ll> Pll;

#define FOR(i,n) for(int i = 0; i < (n); i++)
#define sz(c) ((int)(c).size())
#define ten(x) ((int)1e##x)
#define tenll(x) ((ll)1e##x)
template<class T> T gcd(T a, T b) { return b ? gcd(b, a % b) : a; }

int main(){
	const string base = "yuki";
	int n; cin >> n;
	string s; cin >> s;
	vector<int> x(9);
	FOR(i, n){
		int pt = 0;
		while (pt < 4 && s[i] < base[pt]) pt++;
		if (pt != 4 && s[i] == base[pt]) x[pt * 2 + 1]++;
		else x[pt * 2]++;
	}

	int ans = x[0];
	int a, b, c, d, e, f, g, h;
	tie(a, b, c, d, e, f, g, h) = tie(x[1], x[2], x[3], x[4], x[5], x[6], x[7], x[8]);
	while (a&&c&&e&&g&&h) ans++, a--, c--, e--, g--, h--;
	while (a&&c&&e&&g/2) ans++, a--, c--, e--, g -= 2;
	while (a&&c&&e&&f) ans++, a--, c--, e--, f--;
	while (a&&c&&e/2) ans++, a--, c--, e -= 2;
	while (a&&c&&d) ans++, a--, c--, d--;
	while (a&&c/2) ans++, a--, c -= 2;
	while (a&&b) ans++, a--, b--;
	while (a/2) ans++, a-=2;

	cout << ans << endl;
}
0