Submission #48452
ソースコード
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 | #include <stdio.h> #include <stdint.h> #define max(X, Y) ((X) > (Y) ? (X) : (Y)) #define min(X, Y) ((X) < (Y) ? (X) : (Y)) #define N 2 * 100005 int64_t n; int64_t q; int64_t a[N]; int64_t pos[N]; int64_t min_move[N]; int64_t max_move[N]; int64_t ans; int main() { int64_t t; char d; scanf ( "%lld %lld" , &n, &q); for ( int i = 1; i <= n; i++) { scanf ( "%lld" , &a[i]); } for ( int i = 1; i <= q; i++) { scanf ( "%lld %c" , &t, &d); if (d == 'R' ) { pos[t]++; } else { pos[t]--; } min_move[t] = min(min_move[t], pos[t]); max_move[t] = max(max_move[t], pos[t]); } for ( int i = 1; i <= n; i++) { if (i + min_move[a[i]] <= 0) { ans++; } else if (i + max_move[a[i]] > n) { ans++; } } printf ( "%lld\n" , ans); return 0; } |
ステータス
項目 | データ |
---|---|
問題 | 1116 - AC MONKEY BABYS |
ユーザー名 | ei1710 |
投稿日時 | 2019-04-22 23:59:14 |
言語 | C |
状態 | Accepted |
得点 | 10 |
ソースコード長 | 952 Byte |
最大実行時間 | 58 ms |
最大メモリ使用量 | 6748 KB |
セット
セット | 得点 | Cases | |
---|---|---|---|
1 | ALL | 10 / 10 | * |
テストケース
ファイル名 | 状態 | 実行時間 | メモリ使用量 | # |
---|---|---|---|---|
in_1.txt | AC | 53 ms | 4956 KB |
1
|
in_2.txt | AC | 46 ms | 4904 KB |
1
|
in_3.txt | AC | 26 ms | 5608 KB |
1
|
in_4.txt | AC | 43 ms | 4676 KB |
1
|
in_5.txt | AC | 35 ms | 4612 KB |
1
|
in_6.txt | AC | 28 ms | 4656 KB |
1
|
in_7.txt | AC | 58 ms | 6748 KB |
1
|
in_8.txt | AC | 19 ms | 4644 KB |
1
|
in_9.txt | AC | 40 ms | 5948 KB |
1
|
in_10.txt | AC | 19 ms | 4528 KB |
1
|
sample_in1.txt | AC | 29 ms | 4476 KB |
1
|
sample_in2.txt | AC | 19 ms | 4516 KB |
1
|