Submission #48556


ソースコード

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
#include<bits/stdc++.h>
#define F first
#define S second
#define endl '\n'
#define MP make_pair
#define pb push_back
using namespace std;
typedef pair<int, int> P;
typedef pair<int, P> i_P;
typedef long long LL;
static const int INF = INT_MAX;
static const int MIN = INT_MIN;
static const LL L_INF = LLONG_MAX;
static const int MOD = 1000000000 + 7;
static const int SIZE = 100005;
vector< P > v( 300005 );
int main() {
cin.tie(0);
ios::sync_with_stdio(false);
int n, q;
cin >> n >> q;
int cnt[1000005] = {};
int a[n + 1];
for( int i = 1; i <= n; ++i ) {
cin >> a[i];
}
for( int i = 0; i < q; ++i ) {
int t;
char c;
cin >> t >> c;
if( c == 'R' ) ++cnt[t];
else --cnt[t];
v[t].F = min( v[t].F, cnt[t] );
v[t].S = max( v[t].S, cnt[t] );
}
int res = 0;
for( int i = 1; i <= n; ++i ) {
if( i + v[a[i]].F < 1 || i + v[a[i]].S > n ) ++res;
}
cout << res << endl;
return 0;
}

ステータス

項目 データ
問題 1116 - AC MONKEY BABYS
ユーザー名 crom
投稿日時 2019-04-23 18:03:06
言語 C++11
状態 Accepted
得点 10
ソースコード長 1075 Byte
最大実行時間 51 ms
最大メモリ使用量 7520 KB

セット

セット 得点 Cases
1 ALL 10 / 10 *

テストケース

ファイル名 状態 実行時間 メモリ使用量 #
in_1.txt AC 51 ms 7516 KB
1
in_2.txt AC 51 ms 7444 KB
1
in_3.txt AC 22 ms 6896 KB
1
in_4.txt AC 39 ms 7520 KB
1
in_5.txt AC 34 ms 6844 KB
1
in_6.txt AC 29 ms 7060 KB
1
in_7.txt AC 45 ms 7484 KB
1
in_8.txt AC 21 ms 6800 KB
1
in_9.txt AC 43 ms 7164 KB
1
in_10.txt AC 28 ms 6712 KB
1
sample_in1.txt AC 19 ms 6760 KB
1
sample_in2.txt AC 22 ms 6736 KB
1