제출 #344840

#제출 시각UTC-0아이디문제언어결과실행 시간메모리
3448402021-01-06 15:58:35dimashiiMoney (IZhO17_money)C++17
45 / 100
1591 ms58952 KiB
#include <bits/stdc++.h>
using namespace std;
const int mxN = 1e6 + 123;
int A[mxN], B[mxN], f[mxN], R[mxN];
void Upd(int pos) {
for (int i = pos; i < mxN; i |= i + 1) ++f[i];
}
int Get(int pos) {
int ans = 0;
for (int i = pos; i >= 0; i &= i + 1, --i) ans += f[i];
return ans;
}
int Count(int l, int r) {
if (l > r) return 0;
return Get(r) - Get(l - 1);
}
int main() {
ios_base :: sync_with_stdio(false); cin.tie(nullptr);
int N; cin >> N;
for (int i = 1; i <= N; ++i) cin >> A[i];
R[N] = N;
for (int i = N - 1; i > 0; i--) {
if (A[i] <= A[i + 1]) R[i] = R[i + 1];
 
הההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההה
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...