이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include "bubblesort2.h"
#include <bits/stdc++.h>
using namespace std;
// macros
typedef long long ll;
typedef long double ld;
typedef pair<int, int> ii;
typedef pair<ll, ll> lll;
typedef tuple<int, int, int> iii;
typedef vector<int> vi;
typedef vector<ii> vii;
typedef vector<iii> viii;
typedef vector<ll> vll;
typedef vector<lll> vlll;
#define REP(a,b,c) for(int a=int(b); a<int(c); a++)
#define RE(a,c) REP(a,0,c)
#define RE1(a,c) REP(a,1,c+1)
#define REI(a,b,c) REP(a,b,c+1)
#define REV(a,b,c) for(int a=int(c-1); a>=int(b); a--)
#define FOR(a,b) for(auto& a : b)
#define all(a) a.begin(), a.end()
#define INF 1e9
#define EPS 1e-9
#define pb push_back
#define popb pop_back
#define fi first
#define se second
#define sz size()
mt19937_64 rng(chrono::steady_clock::now().time_since_epoch().count());
const int MX=101;
int cnt[MX];
vi countScans(vi A, vi X, vi V){
int n=A.size();
int q=X.size();
vi ans(q);
if(n <= 8000 && q <= 8000) {
multiset<int> ms;
RE(i,n) ms.insert(A[i]);
vi B(n,0);
RE(j,q) {
ms.erase(ms.find(A[X[j]]));
A[X[j]] = V[j];
ms.insert(V[j]);
int ci=0;
FOR(i,ms) B[ci++]=i;
int cAns = 0;
RE(i,n)
cAns = max(cAns, i-int(upper_bound(all(B), A[i])-B.begin() - 1));
ans[j] = cAns;
}
} else {
RE(i,n)
REP(j,A[i],MX)
cnt[j]++;
RE(j,q) {
REP(i,A[X[j]],MX)
cnt[i]--;
A[X[j]] = V[j];
REP(i,A[X[j]],MX)
cnt[i]++;
int cAns = 0;
RE(i,n)
cAns = max(cAns, i-int(cnt[A[i]] - 1));
ans[j] = cAns;
}
}
return ans;
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |