QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#605658 | #2953. Pinned Files | Lionel_ZQY | AC ✓ | 0ms | 3876kb | C++20 | 1.2kb | 2024-10-02 18:21:43 | 2024-10-02 18:21:49 |
Judging History
answer
#include <bits/stdc++.h>
using namespace std;
using i64 = long long;
void solve(){
int n, m;
cin >> n >> m;
vector<int> a(n + 1), b(m + 1);
for(int i = 1; i <= n; i++){
cin >> a[i];
}
for(int i = 1; i <= m; i++){
cin >> b[i];
}
int nn, mm;
cin >> nn >> mm;
vector<int> ac(nn + 1), bc(mm + 1);
vector<int> bl(n + m + 1);
for(int i = 1; i <= nn; i++){
cin >> ac[i];
bl[ac[i]] = 1;
}
for(int i = 1; i <= mm; i++){
cin >> bc[i];
bl[bc[i]] = 2;
}
int ca = 1, cb = mm;
vector<bool> sta(n + 1), stb(m + 1);
for(int i = 1; i <= n; i++){
if(a[i] == ac[ca]){
sta[i] = true;
ca++;
if(ca > nn) break;
}
}
for(int i = m; i >= 1; i--){
if(b[i] == bc[cb]){
stb[i] = true;
cb--;
if(cb <= 0) break;
}
}
int ans = 0;
for(int i = 1; i <= n; i++){
if(sta[i]) continue;
ans += (bl[a[i]] == 1 ? 2 : 1);
}
for(int i = 1; i <= m; i++){
if(stb[i]) continue;
ans += (bl[b[i]] == 1 ? 1 : 2);
}
cout << ans << '\n';
}
int main(){
ios::sync_with_stdio(false);
cin.tie(0), cout.tie(0);
int t = 1;
// cin >> t;
while(t--){
solve();
}
return 0;
}
Details
Tip: Click on the bar to expand more detailed information
Test #1:
score: 100
Accepted
time: 0ms
memory: 3628kb
input:
50 50 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 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 50...
output:
196
result:
ok single line: '196'
Test #2:
score: 0
Accepted
time: 0ms
memory: 3520kb
input:
49 51 52 74 2 3 35 93 38 42 49 87 84 18 67 32 72 76 68 14 24 66 54 100 99 29 40 51 64 11 57 33 81 26 86 91 43 55 97 1 17 47 13 89 46 59 96 69 78 39 10 15 75 20 22 21 5 92 8 85 73 28 41 12 6 7 37 9 83 90 44 65 23 61 60 34 16 95 70 36 56 80 77 45 82 88 53 71 94 30 98 58 63 50 48 79 31 4 27 25 62 19 53...
output:
142
result:
ok single line: '142'
Test #3:
score: 0
Accepted
time: 0ms
memory: 3796kb
input:
79 21 28 53 79 59 24 78 16 63 17 95 52 98 7 60 2 67 31 45 50 81 54 58 84 6 22 94 27 71 87 23 64 30 10 66 92 55 89 68 25 36 14 11 83 1 96 80 47 65 26 9 5 62 73 19 32 51 46 69 70 61 57 39 74 13 56 97 72 37 91 82 40 18 93 4 33 8 75 15 48 49 100 44 43 99 77 42 38 88 20 3 90 34 35 12 41 76 29 85 86 21 65...
output:
160
result:
ok single line: '160'
Test #4:
score: 0
Accepted
time: 0ms
memory: 3580kb
input:
32 68 42 92 46 32 20 27 25 67 41 94 11 28 45 90 24 40 64 9 22 44 73 31 55 30 36 72 38 66 89 14 21 37 86 43 23 68 88 48 63 78 93 4 8 71 6 99 79 91 26 58 16 51 47 82 60 95 62 77 18 3 15 7 80 59 56 54 49 1 19 75 98 61 97 96 85 65 50 69 84 34 33 5 13 81 52 10 35 39 53 17 83 100 29 87 74 76 70 2 12 57 76...
output:
130
result:
ok single line: '130'
Test #5:
score: 0
Accepted
time: 0ms
memory: 3576kb
input:
9 91 49 90 32 84 2 67 76 22 52 6 43 73 17 12 39 70 14 100 48 78 46 27 87 85 29 75 59 9 42 24 1 99 58 98 4 55 79 13 83 10 47 5 44 94 3 7 8 53 25 16 34 11 54 37 45 41 69 20 95 31 40 61 35 30 86 82 15 80 74 33 81 51 77 62 18 89 92 96 97 91 36 72 71 38 26 50 63 93 60 66 88 19 21 56 64 28 57 65 68 23 82 ...
output:
117
result:
ok single line: '117'
Test #6:
score: 0
Accepted
time: 0ms
memory: 3560kb
input:
30 70 35 12 55 97 3 23 82 15 81 72 8 27 51 18 34 16 36 60 40 89 83 42 29 38 44 74 56 64 28 61 41 1 75 14 70 87 73 94 92 20 6 48 80 57 7 95 84 30 58 53 50 11 33 13 2 45 77 37 98 19 43 65 99 47 69 86 9 62 85 96 71 59 68 4 52 49 22 78 17 24 67 93 54 79 46 63 66 5 91 90 32 76 21 100 31 10 88 25 39 26 51...
output:
157
result:
ok single line: '157'
Test #7:
score: 0
Accepted
time: 0ms
memory: 3568kb
input:
34 66 99 71 20 53 90 84 45 79 34 5 26 23 73 35 85 6 100 7 8 47 19 44 36 43 33 63 95 82 28 42 15 37 12 62 89 60 98 51 55 68 96 4 11 69 93 94 49 67 64 87 46 10 50 76 2 54 97 91 78 24 83 17 38 25 58 88 52 59 92 13 27 29 3 75 31 70 56 32 61 21 65 41 14 1 80 18 16 72 74 66 77 57 22 48 39 81 30 9 86 40 15...
output:
159
result:
ok single line: '159'
Test #8:
score: 0
Accepted
time: 0ms
memory: 3868kb
input:
91 9 7 64 10 43 54 92 26 75 28 8 89 15 49 83 79 74 85 66 18 34 71 13 9 93 23 97 62 98 91 14 11 57 60 3 27 52 96 50 16 17 70 37 22 5 67 44 58 81 65 86 38 68 39 55 95 47 6 33 32 88 80 21 29 4 84 78 31 100 51 41 36 53 61 63 99 1 87 56 90 30 77 76 94 45 42 35 2 20 73 19 24 40 69 59 72 46 25 48 82 12 52 ...
output:
147
result:
ok single line: '147'
Test #9:
score: 0
Accepted
time: 0ms
memory: 3836kb
input:
80 20 96 79 71 65 18 41 37 75 25 36 58 3 48 94 76 91 51 66 8 92 99 98 46 61 14 33 30 20 55 74 4 73 42 59 72 95 12 5 22 10 47 7 17 85 87 54 39 19 34 82 86 32 9 80 83 84 2 63 53 15 64 49 40 31 29 43 28 89 62 44 13 68 56 6 26 78 57 1 38 90 60 45 24 21 27 16 93 23 11 97 52 50 70 69 77 100 35 88 81 67 42...
output:
142
result:
ok single line: '142'
Test #10:
score: 0
Accepted
time: 0ms
memory: 3568kb
input:
39 61 87 85 23 67 47 32 96 38 94 70 13 16 61 6 72 14 44 30 86 24 56 25 98 95 66 81 79 93 48 54 65 33 20 11 9 100 1 89 22 49 55 45 68 39 15 26 76 41 2 84 3 5 97 59 82 7 18 4 69 12 71 19 40 51 73 10 58 21 83 90 27 37 62 50 88 99 91 31 42 28 57 52 74 64 63 60 77 43 92 53 46 75 36 78 8 17 29 34 35 80 43...
output:
154
result:
ok single line: '154'
Test #11:
score: 0
Accepted
time: 0ms
memory: 3576kb
input:
62 38 10 18 3 82 71 1 39 33 35 67 55 66 34 97 81 54 12 24 4 61 22 29 15 60 13 46 88 83 52 37 40 57 69 50 89 9 74 59 42 43 72 47 48 31 73 96 76 62 70 27 53 87 26 98 28 19 20 7 17 79 25 63 32 84 21 23 75 91 36 51 45 49 16 86 64 2 6 56 41 99 80 85 93 65 30 11 92 8 44 94 95 68 14 77 90 5 100 58 78 38 5 ...
output:
139
result:
ok single line: '139'
Test #12:
score: 0
Accepted
time: 0ms
memory: 3524kb
input:
24 68 66 46 64 41 7 48 78 21 12 10 77 38 5 35 85 27 75 80 51 22 39 8 62 17 81 61 29 52 3 15 56 20 71 67 26 47 88 86 84 54 45 14 72 57 49 23 43 63 34 9 32 31 53 18 65 69 37 73 40 90 83 68 92 44 36 58 91 4 16 24 76 6 89 70 79 82 50 74 19 28 55 25 11 30 59 1 13 2 33 42 60 87 72 20 90 84 43 25 52 26 70 ...
output:
120
result:
ok single line: '120'
Test #13:
score: 0
Accepted
time: 0ms
memory: 3568kb
input:
51 1 29 2 46 16 5 21 31 11 19 52 23 32 6 20 42 18 33 24 26 3 50 44 36 8 1 15 38 14 39 43 30 34 22 17 4 7 35 13 45 49 12 51 9 41 27 48 47 37 28 10 40 25 39 13 45 19 25 51 32 36 12 6 40 34 29 5 10 7 26 27 24 52 33 28 3 17 46 8 37 9 31 44 15 4 11 49 22 50 41 43 48 35 16 14 47 13 38 20 1 21 2 18 23 30 4...
output:
88
result:
ok single line: '88'
Test #14:
score: 0
Accepted
time: 0ms
memory: 3672kb
input:
51 27 59 23 25 50 41 47 49 75 55 67 69 33 17 62 51 64 70 27 8 56 48 61 14 42 68 16 5 19 6 39 1 24 76 10 34 7 57 77 46 65 78 3 9 35 53 31 72 74 28 63 32 22 11 30 45 44 43 29 2 60 21 13 54 18 12 37 73 66 58 26 52 15 40 4 71 38 20 36 54 24 60 67 47 8 53 70 44 3 28 41 16 68 76 38 72 74 10 65 75 69 64 5 ...
output:
119
result:
ok single line: '119'
Test #15:
score: 0
Accepted
time: 0ms
memory: 3524kb
input:
43 14 17 1 21 27 12 54 19 3 6 13 16 22 52 39 23 32 25 40 45 53 46 30 51 4 56 33 29 31 15 37 50 38 36 20 41 24 11 48 49 10 7 43 18 5 28 8 55 14 47 26 34 35 44 42 57 9 2 28 29 39 16 43 9 32 5 25 14 19 54 11 2 49 36 4 26 30 42 34 37 47 3 13 46 55 24 31 10 27 41 8 1 6 38 45 18 51 33 7 12 40 44 29 23 56 ...
output:
77
result:
ok single line: '77'
Test #16:
score: 0
Accepted
time: 0ms
memory: 3876kb
input:
21 75 85 6 93 58 53 67 40 56 3 9 66 51 92 96 70 10 73 13 23 37 82 88 29 59 62 18 15 94 46 57 7 38 41 30 47 43 90 1 72 42 63 4 60 17 36 75 24 26 49 68 20 55 54 61 64 89 32 87 8 52 2 79 34 5 77 28 19 16 44 69 50 81 14 91 39 45 48 83 80 21 95 84 27 22 74 35 65 78 76 11 33 25 31 71 12 86 64 32 59 67 33 ...
output:
137
result:
ok single line: '137'
Test #17:
score: 0
Accepted
time: 0ms
memory: 3572kb
input:
12 60 15 27 11 42 53 5 18 65 44 39 62 30 29 33 61 22 12 66 24 43 70 68 48 51 63 46 32 50 13 57 35 40 28 55 8 25 26 1 21 9 19 16 45 52 7 31 67 47 69 10 54 72 64 34 56 2 49 41 14 23 59 58 38 36 3 20 71 37 60 17 4 6 23 49 48 32 59 41 50 16 22 39 42 12 38 56 20 5 3 53 7 33 9 47 52 31 72 29 49 66 28 2 23...
output:
115
result:
ok single line: '115'
Test #18:
score: 0
Accepted
time: 0ms
memory: 3612kb
input:
59 21 12 32 69 2 76 19 45 59 39 21 36 6 79 55 25 71 37 44 43 60 26 61 27 34 28 4 8 48 5 1 31 3 72 64 80 49 63 47 52 20 73 23 77 41 13 35 50 29 40 7 17 74 38 67 30 15 51 70 42 62 9 24 56 68 46 66 53 58 10 33 22 14 57 75 11 65 16 78 54 18 35 45 5 57 65 56 39 26 9 36 33 31 70 78 10 17 2 13 34 4 40 30 7...
output:
114
result:
ok single line: '114'
Test #19:
score: 0
Accepted
time: 0ms
memory: 3576kb
input:
20 63 31 6 22 47 81 23 61 38 76 42 8 49 59 50 66 78 30 39 74 17 35 28 64 7 60 29 12 58 45 48 82 10 83 54 37 40 2 1 9 75 68 73 33 25 52 56 65 11 15 71 79 41 36 24 72 5 62 43 20 80 3 32 63 18 13 21 69 46 14 26 16 51 19 70 4 53 44 67 57 55 27 77 34 51 32 50 58 55 52 66 74 12 37 17 82 54 67 51 71 45 14 ...
output:
109
result:
ok single line: '109'
Test #20:
score: 0
Accepted
time: 0ms
memory: 3564kb
input:
47 14 45 10 35 6 42 21 22 26 44 50 16 29 40 8 53 28 30 5 33 11 39 56 43 23 18 41 38 34 52 7 14 58 37 1 19 24 20 51 13 57 2 12 31 4 36 32 47 25 27 48 3 17 60 15 54 61 59 46 9 55 49 52 9 61 48 22 8 30 37 4 42 51 56 2 20 21 15 26 59 44 52 58 14 12 18 33 9 55 57 28 19 60 7 34 10 32 45 43 47 27 23 38 5 2...
output:
103
result:
ok single line: '103'
Test #21:
score: 0
Accepted
time: 0ms
memory: 3640kb
input:
4 51 50 18 7 51 44 16 25 36 23 29 9 47 39 2 17 8 6 20 19 55 45 12 27 1 11 14 10 43 13 38 54 5 52 21 41 28 42 46 4 15 35 32 37 48 26 3 33 22 49 53 31 24 30 40 34 10 45 54 36 53 34 52 42 32 35 23 9 20 41 14 29 18 48 51 26 6 7 1 24 47 38 15 4 12 49 8 22 11 46 33 13 50 55 25 40 16 39 2 10 43 5 3 37 21 4...
output:
94
result:
ok single line: '94'
Test #22:
score: 0
Accepted
time: 0ms
memory: 3800kb
input:
8 2 3 5 8 6 4 2 1 7 9 10 2 8 3 1 10 5 2 8 6 7 4 9
output:
8
result:
ok single line: '8'
Test #23:
score: 0
Accepted
time: 0ms
memory: 3576kb
input:
6 4 7 1 6 9 4 3 10 2 8 5 2 8 10 2 5 4 6 9 3 7 8 1
output:
12
result:
ok single line: '12'
Test #24:
score: 0
Accepted
time: 0ms
memory: 3572kb
input:
1 9 10 1 5 6 4 2 7 8 3 9 9 1 9 1 3 5 4 2 10 6 8 7
output:
10
result:
ok single line: '10'
Test #25:
score: 0
Accepted
time: 0ms
memory: 3636kb
input:
8 2 8 7 4 6 10 9 5 2 1 3 9 1 5 9 8 7 2 3 6 1 10 4
output:
15
result:
ok single line: '15'
Test #26:
score: 0
Accepted
time: 0ms
memory: 3632kb
input:
5 5 8 6 3 4 7 2 10 9 1 5 9 1 3 6 1 4 2 8 7 5 10 9
output:
12
result:
ok single line: '12'
Test #27:
score: 0
Accepted
time: 0ms
memory: 3580kb
input:
5 5 1 3 5 4 6 7 8 10 2 9 7 3 4 9 5 7 6 8 3 10 1 2
output:
12
result:
ok single line: '12'
Test #28:
score: 0
Accepted
time: 0ms
memory: 3568kb
input:
2 8 4 7 10 1 6 5 9 2 3 8 1 9 5 6 10 9 8 3 2 1 7 4
output:
17
result:
ok single line: '17'
Test #29:
score: 0
Accepted
time: 0ms
memory: 3580kb
input:
7 3 8 3 9 5 7 10 1 2 4 6 7 3 7 9 2 1 4 5 8 6 3 10
output:
14
result:
ok single line: '14'
Test #30:
score: 0
Accepted
time: 0ms
memory: 3872kb
input:
3 7 10 7 1 4 3 9 2 6 8 5 7 3 5 2 9 8 1 6 4 10 7 3
output:
10
result:
ok single line: '10'
Test #31:
score: 0
Accepted
time: 0ms
memory: 3544kb
input:
2 8 1 9 3 5 2 7 8 4 10 6 7 3 8 5 9 1 3 2 6 4 7 10
output:
11
result:
ok single line: '11'
Test #32:
score: 0
Accepted
time: 0ms
memory: 3576kb
input:
1 0 1 1 0 1
output:
0
result:
ok single line: '0'
Test #33:
score: 0
Accepted
time: 0ms
memory: 3868kb
input:
1 0 1 0 1 1
output:
1
result:
ok single line: '1'
Test #34:
score: 0
Accepted
time: 0ms
memory: 3524kb
input:
0 1 1 1 0 1
output:
1
result:
ok single line: '1'
Test #35:
score: 0
Accepted
time: 0ms
memory: 3644kb
input:
0 1 1 0 1 1
output:
0
result:
ok single line: '0'
Test #36:
score: 0
Accepted
time: 0ms
memory: 3568kb
input:
0 20 2 17 10 18 19 9 14 20 12 13 11 6 3 8 1 4 7 15 5 16 20 0 6 5 9 19 20 7 12 4 16 1 8 11 3 14 17 10 13 15 18 2
output:
20
result:
ok single line: '20'
Test #37:
score: 0
Accepted
time: 0ms
memory: 3524kb
input:
0 20 5 13 19 1 14 9 20 17 7 6 18 10 8 16 11 4 3 15 12 2 14 6 17 10 13 6 12 15 20 1 14 3 7 8 2 9 16 19 4 18 11 5
output:
24
result:
ok single line: '24'
Test #38:
score: 0
Accepted
time: 0ms
memory: 3876kb
input:
20 0 8 11 5 4 6 18 9 2 14 17 16 3 20 1 13 7 12 19 15 10 6 14 18 9 11 20 15 7 13 4 6 16 3 5 12 1 10 2 14 19 17 8
output:
22
result:
ok single line: '22'
Test #39:
score: 0
Accepted
time: 0ms
memory: 3576kb
input:
20 0 2 19 10 14 3 15 5 16 8 11 12 9 17 20 18 4 7 1 6 13 18 2 6 14 7 17 10 18 15 16 4 8 19 1 20 13 3 5 9 12 11 2
output:
36
result:
ok single line: '36'
Test #40:
score: 0
Accepted
time: 0ms
memory: 3836kb
input:
13 7 8 2 17 10 3 9 7 19 5 6 16 13 15 1 14 12 18 4 11 20 0 20 2 15 13 12 14 11 1 5 8 20 19 17 16 10 4 9 18 7 6 3
output:
27
result:
ok single line: '27'
Test #41:
score: 0
Accepted
time: 0ms
memory: 3672kb
input:
4 16 5 18 9 11 6 15 8 2 14 10 17 16 3 7 13 19 12 1 4 20 0 20 12 17 15 2 5 3 20 1 6 8 4 13 19 10 18 14 16 7 11 9
output:
36
result:
ok single line: '36'
Test #42:
score: 0
Accepted
time: 0ms
memory: 3632kb
input:
17 3 17 12 5 4 18 8 16 10 6 15 14 11 19 20 1 2 7 3 13 9 20 0 4 17 7 13 18 8 9 11 6 1 20 3 16 5 19 12 14 2 10 15
output:
35
result:
ok single line: '35'
Test #43:
score: 0
Accepted
time: 0ms
memory: 3572kb
input:
17 3 4 19 14 3 7 1 2 11 9 20 15 5 18 8 12 6 10 13 16 17 20 0 1 15 12 11 18 7 4 14 3 19 9 2 16 5 13 8 6 17 20 10
output:
31
result:
ok single line: '31'