# | TimeUTC-0 | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
987606 | Otalp | Permutation (APIO22_perm) | C++17 | 49 ms | 856 KiB |
This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#include "perm.h"
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define pb push_back
ll pref[200][200], suf[200][200];
ll a[200100];
ll n;
void calc(){
for(int x=0; x<=n + 1; x++) pref[0][x] = 1;
for(int i=1; i<=n; i++){
for(int x=0; x<=n + 1; x++){
pref[i][x] = pref[i - 1][x];
if(a[i] <= x){
pref[i][x] += pref[i-1][a[i]];
}
}
}
for(int x=0; x<=n + 1; x++) suf[n + 1][x] = 1;
for(int i=n; i>=1; i--){
for(int x=n + 1; x>=0; x--){
suf[i][x] = suf[i + 1][x];
if(a[i] >= x){
suf[i][x] += suf[i + 1][a[i]];
}
}
Compilation message (stderr)
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |