-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcodeforce_.cpp
51 lines (46 loc) · 972 Bytes
/
codeforce_.cpp
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
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
const int INF = 0x3f3f3f3f;
using pii = pair<int, int>;
using pli = pair<ll, int>;
using pll = pair<ll, ll>;
using vi = vector<int>;
using vll = vector<ll>;
using vpii = vector<pii>;
int main() {
ios::sync_with_stdio(false);
cin.tie(NULL);
cout.tie(NULL);
#ifndef ONLINE_JUDGE
freopen("../input.txt", "r", stdin);
freopen("../output.txt", "w", stdout);
#endif
int t;
cin >> t;
while (t--) {
int n;
cin >> n;
vll a(n);
vll b(n);
for (auto &i: a) {
cin >> i;
}
for (auto &i: b) {
cin >> i;
}
int ans = 0;
int l = 0, r = 0;
while (r != n - 1) {
if (a[l] > b[r]) {
r++;
ans++;
} else {
l++;
r++;
}
}
cout << ans << "\n";
}
return 0;
}