提出 #577682


ソースコード 拡げる

#include <iostream>
#include <vector>
#include <algorithm>
#include <utility>
using namespace std;

#define fi first
#define se second

typedef pair<char,int> pci;
typedef pair<int,int> pii;

int N;
vector<pci> DL;
bool flgs[1100] = {0};

bool check(int n, int len) {
	if(DL[n].fi == 'y') {
		if(DL[n].se >= len)
			flgs[n] = true;
	}
	else {
		if(DL[n].se >= len)
			return false;
	}
	return true;
}

int main() {
	vector<pii> q;
	cin >> N;
	DL.resize(N);
	for(int i = 0; i < DL.size(); i++)
		cin >> DL[i].fi >> DL[i].se;

	for(int i = 0; i < DL.size(); i++) {
		if(DL[i].fi == 'y')
			q.push_back(pii(DL[i].se, i));
	}
	sort(q.begin(), q.end());

	int res = 0;
	for(int i = 0; i < q.size(); i++) {
		if(flgs[q[i].se]) {
			continue;
		}
		res++;
		// up
		for(int j = q[i].se; j >= 0; j--) {
			if(!check(j, q[i].fi)) break;
		}
		// down
		for(int j = q[i].se; j < DL.size(); j++) {
			if(!check(j, q[i].fi)) break;
		}
	}
	cout << res << endl;
}

提出情報

提出日時
問題 C - Delete Files
ユーザ qu1temp1
言語 C++11 (GCC 4.8.1)
得点 100
コード長 1007 Byte
結果 AC
実行時間 28 ms
メモリ 1132 KiB

ジャッジ結果

セット名 All
得点 / 配点 100 / 100
結果
AC × 54
セット名 テストケース
All 00_sample_00, 00_sample_01, 00_sample_02, 01_random-small_00, 01_random-small_01, 01_random-small_02, 01_random-small_03, 01_random-small_04, 01_random-small_05, 01_random-small_06, 01_random-small_07, 01_random-small_08, 01_random-small_09, 02_random-large_00, 02_random-large_01, 02_random-large_02, 02_random-large_03, 02_random-large_04, 02_random-large_05, 02_random-large_06, 02_random-large_07, 02_random-large_08, 02_random-large_09, 03_mutual_00, 03_mutual_01, 03_mutual_02, 03_mutual_03, 03_mutual_04, 03_mutual_05, 03_mutual_06, 03_mutual_07, 03_mutual_08, 03_mutual_09, 04_all_00, 04_all_01, 04_all_02, 04_all_03, 04_all_04, 04_all_05, 04_all_06, 04_all_07, 04_all_08, 04_all_09, 05_maximal_00, 05_maximal_01, 05_maximal_02, 05_maximal_03, 05_maximal_04, 05_maximal_05, 05_maximal_06, 05_maximal_07, 05_maximal_08, 05_maximal_09, 99_handmade_00
ケース名 結果 実行時間 メモリ
00_sample_00 AC 28 ms 1048 KiB
00_sample_01 AC 28 ms 948 KiB
00_sample_02 AC 24 ms 1052 KiB
01_random-small_00 AC 25 ms 984 KiB
01_random-small_01 AC 26 ms 1044 KiB
01_random-small_02 AC 27 ms 1044 KiB
01_random-small_03 AC 26 ms 1048 KiB
01_random-small_04 AC 26 ms 1040 KiB
01_random-small_05 AC 28 ms 1048 KiB
01_random-small_06 AC 24 ms 1052 KiB
01_random-small_07 AC 26 ms 1048 KiB
01_random-small_08 AC 26 ms 1048 KiB
01_random-small_09 AC 26 ms 1044 KiB
02_random-large_00 AC 26 ms 1048 KiB
02_random-large_01 AC 25 ms 1044 KiB
02_random-large_02 AC 27 ms 1052 KiB
02_random-large_03 AC 25 ms 1048 KiB
02_random-large_04 AC 26 ms 1048 KiB
02_random-large_05 AC 26 ms 1044 KiB
02_random-large_06 AC 26 ms 1048 KiB
02_random-large_07 AC 26 ms 1044 KiB
02_random-large_08 AC 26 ms 1040 KiB
02_random-large_09 AC 26 ms 1044 KiB
03_mutual_00 AC 27 ms 1048 KiB
03_mutual_01 AC 25 ms 1128 KiB
03_mutual_02 AC 25 ms 1052 KiB
03_mutual_03 AC 26 ms 1052 KiB
03_mutual_04 AC 24 ms 1048 KiB
03_mutual_05 AC 25 ms 1048 KiB
03_mutual_06 AC 26 ms 1040 KiB
03_mutual_07 AC 25 ms 1052 KiB
03_mutual_08 AC 26 ms 1044 KiB
03_mutual_09 AC 26 ms 1052 KiB
04_all_00 AC 26 ms 1092 KiB
04_all_01 AC 26 ms 1048 KiB
04_all_02 AC 26 ms 1052 KiB
04_all_03 AC 26 ms 1052 KiB
04_all_04 AC 25 ms 1040 KiB
04_all_05 AC 26 ms 1048 KiB
04_all_06 AC 26 ms 1048 KiB
04_all_07 AC 25 ms 1048 KiB
04_all_08 AC 26 ms 1048 KiB
04_all_09 AC 24 ms 1048 KiB
05_maximal_00 AC 28 ms 1044 KiB
05_maximal_01 AC 27 ms 1044 KiB
05_maximal_02 AC 27 ms 952 KiB
05_maximal_03 AC 25 ms 1132 KiB
05_maximal_04 AC 26 ms 1052 KiB
05_maximal_05 AC 27 ms 944 KiB
05_maximal_06 AC 26 ms 1048 KiB
05_maximal_07 AC 25 ms 1124 KiB
05_maximal_08 AC 26 ms 1052 KiB
05_maximal_09 AC 27 ms 1048 KiB
99_handmade_00 AC 28 ms 1044 KiB