#include "bubblesort2.h"
#include <bits/stdc++.h>
#define ll long long
#define fi first
#define se second
#define endl '\n'
#define MASK(i) (1LL << (i))
#define ull unsigned long long
#define ld long double
#define pb push_back
#define all(x) (x).begin() , (x).end()
#define BIT(x , i) ((x >> (i)) & 1)
#define TASK "task"
#define sz(s) (int) (s).size()
using namespace std;
const int mxN = 5e5 + 227;
const int inf = 1e9 + 277;
const int mod = 1e9 + 7;
const ll infll = 1e18 + 7;
const int base = 307;
const int LOG = 20;
template <typename T1, typename T2> bool minimize(T1 &a, T2 b) {
if (a > b) {a = b; return true;} return false;
}
template <typename T1, typename T2> bool maximize(T1 &a, T2 b) {
if (a < b) {a = b; return true;} return false;
}
vector<int> countScans(vector<int> a, vector<int> q1, vector<int> q2)
{
vector<int> ans;
for(int i = 0; i < sz(q1); i++) {
int pos = q1[i];
int val = q2[i];
a[pos] = val;
int cur = inf;
int res = 0;
for(int i = sz(a) - 1; i >= 0; i--) {
if(a[i] > cur) ++res;
minimize(cur, a[i]);
}
ans.pb(res);
}
return ans;
}
//void solve()
//{
// vector<int> a;
// vector<int> q1;
// vector<int> q2;
// int n;
// cin >> n;
// for(int i = 1; i <= n; i++) {
// int x;
// cin >> x;
// a.pb(x);
// }
//
//
// int q;
// cin >> q;
// for(int i = 1; i <= q; i++) {
// int p, v;
// cin >> p >> v;
// q1.pb(p);
// q2.pb(v);
// }
// vector<int> res = countScans(a, q1, q2);
// for(auto it : res) cout << it << endl;
//}
//
//int main()
//{
// ios_base::sync_with_stdio(0);
// cin.tie(0);
// freopen(TASK".inp" , "r" , stdin);
// freopen(TASK".out" , "w" , stdout);
//
// int tc = 1;
// //cin >> tc;
// while(tc--) {
// solve();
// }
// return 0;
//}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
2 ms |
212 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
2 ms |
212 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
73 ms |
544 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
2 ms |
212 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |