Submission #852186

#TimeUsernameProblemLanguageResultExecution timeMemory
852186vjudge1Bubble Sort 2 (JOI18_bubblesort2)C++17
0 / 100
6187 ms872 KiB
#include <bits/stdc++.h> //#define int long long #define ll long long #define endl '\n' #define pii pair<int,int> #define vint vector<int> #define vll vector<ll> #define vpii vector<pii> #define pb push_back #define se second #define fi first #define all(x) x.begin(), x.end() #define graph vector<vll> using namespace std; const int N = (int)2e5 + 69; const int mod = (int)1e4 + 7; const int naser = 3999, tourist = 3816; int power(int a, int b) { int ans = 1; while (b) { if (b % 2) ans *= a; a *= a; b /= 2; } return ans; } vint countScans(vint a, vint x, vint v) { int n = a.size(); int q = x.size(); vint ans(q); for (int j = 0; j < q; j++) { a[x[j]] = v[j]; vint b = a; sort(all(b)); map<int, pii> mp; for (int i = 0; i < n; i++) { if (!mp[b[i]].fi) mp[b[i]].fi = i + 1; else mp[b[i]].fi = min(mp[b[i]].fi, i + 1); mp[b[i]].se = max(mp[b[i]].se, i + 1); } for (int i = 1; i <= n; i++) { ans[j] = max(ans[j], min(abs(i - mp[a[i - 1]].fi), abs(i - mp[a[i - 1]].se))); } } return ans; } //int32_t main() { // // vint ans = countScans({1,2,3,4}, {0,2}, {3,1}); // for (int x : ans) // cout << x << endl; // //}
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...