-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathBad_Prices.cpp
More file actions
43 lines (34 loc) · 782 Bytes
/
Bad_Prices.cpp
File metadata and controls
43 lines (34 loc) · 782 Bytes
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
// https://codeforces.com/contest/1213/problem/B
#define DEBUG
#define MAXN 1e9+10
#include <bits/stdc++.h>
using namespace std;
int main ()
{
ios_base::sync_with_stdio(0); cin.tie(0);
#ifdef DEBUG
freopen("in.in", "r", stdin);
#endif
int t, temp;
cin >> t;
while (t--) {
int days;
cin >> days;
vector<int > a;
for (int i = 0; i < days; ++i) {
cin >> temp;
a.push_back(temp);
}
int ans = 0, min = a.back() ;
// compare
for (int i = days-2; i >= 0; --i) {
if (a[i] < min ) {
min = a[i];
} else if (a[i] > min) {
ans ++;
}
}
cout << ans << endl;
}
return 0;
}