結果

問題 No.291 黒い文字列
ユーザー 唐澤貴洋唐澤貴洋
提出日時 2015-10-16 23:17:39
言語 C++11
(gcc 11.4.0)
結果
WA  
実行時間 -
コード長 979 bytes
コンパイル時間 721 ms
コンパイル使用メモリ 76,932 KB
実行使用メモリ 4,504 KB
最終ジャッジ日時 2023-09-29 01:49:51
合計ジャッジ時間 2,128 ms
ジャッジサーバーID
(参考情報)
judge15 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

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

ソースコード

diff #

#include<iostream>
#include<vector>
#include<set>
#include<map>
#include<list>
#include<stack>
#include<queue>
#include<bitset>
#include<array>
#include<algorithm>
#include<cstdio>
#include<string>
#include<cstdlib>
#include<numeric>
#define D int
#define U unsigned
using namespace std;
D n, m,a, b, d, e;
D i, j, k;
char c,f;
string s;
D ans;
char ta[] = { 'K','U','R','O','I' };
int main() {
	D t;
	vector<int> kuroi;
	auto it = kuroi.begin();
	cin >> s;
	for (auto x : s) {
		if (x == ta[0]) {
			kuroi.push_back(1);
		}
		if (x == '?') {
			sort(kuroi.begin(), kuroi.end());
			reverse(kuroi.begin(), kuroi.end());
			if (!kuroi.empty()) {
				kuroi[0]++;
				if (kuroi[0] == 5) {
					ans++;
					kuroi.erase(kuroi.begin());
				}
			}
			else {
				kuroi.push_back(1);
			}
		}
		for (it = kuroi.begin(); it != kuroi.end(); it++) {
			if (ta[*it]==x) {
				(*it)++;
				if (*it == 5) {
					ans++;
					kuroi.erase(it);
				}
				break;
			}
		}
	}
	cout << ans << endl;
}
0