Submission #00005
ソースコード
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 | #include<bits/stdc++.h> using namespace std; int ugo[200200]; int mns[200200]; int pls[200200]; int type[200200]; signed main() { int n, q; scanf ( "%d %d" , &n, &q); for ( int i = 0; i < n; i++ ) { scanf ( "%d" , &type[i]); } for ( int i = 0; i < q; i++ ) { char d; int t; scanf ( "%d %c" , &t, &d); if ( d == 'R' ) { ugo[t]++; } else { ugo[t]--; } mns[t] = min ( mns[t], ugo[t] ); pls[t] = max ( pls[t], ugo[t] ); } int cnt = 0; for ( int i = 0; i < n; i++ ) { int t = type[i]; if ( mns[t] + i < 0 || pls[t] + i >= n ) cnt++; } cout << cnt << endl; return 0; } |
ステータス
項目 | データ |
---|---|
問題 | 0003 - AC MONKEY BABYS |
ユーザー名 | r1825 |
投稿日時 | 2019-04-24 15:58:46 |
言語 | C++ |
状態 | Accepted |
得点 | 100 |
ソースコード長 | 761 Byte |
最大実行時間 | 57 ms |
最大メモリ使用量 | 3608 KB |
セット
セット | 得点 | Cases | |
---|---|---|---|
1 | ALL | 100 / 100 | * |
テストケース
ファイル名 | 状態 | 実行時間 | メモリ使用量 | # |
---|---|---|---|---|
in_1.txt | AC | 57 ms | 1880 KB |
1
|
in_2.txt | AC | 56 ms | 1756 KB |
1
|
in_3.txt | AC | 25 ms | 1536 KB |
1
|
in_4.txt | AC | 48 ms | 1392 KB |
1
|
in_5.txt | AC | 29 ms | 444 KB |
1
|
in_6.txt | AC | 26 ms | 644 KB |
1
|
in_7.txt | AC | 52 ms | 3608 KB |
1
|
in_8.txt | AC | 17 ms | 576 KB |
1
|
in_9.txt | AC | 46 ms | 2060 KB |
1
|
in_10.txt | AC | 23 ms | 444 KB |
1
|
sample_in1.txt | AC | 24 ms | 448 KB |
1
|
sample_in2.txt | AC | 25 ms | 664 KB |
1
|