# | TimeUTC-0 | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
918791 | vjudge1 | Studentsko (COCI14_studentsko) | C++17 | 38 ms | 572 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<bits/stdc++.h>
using namespace std;
#define ll int
#define pii pair<ll,ll>
#define pb push_back
#define fi first
#define se second
const ll N = 5003;
ll n,k;
pii q[N];
ll a[N],dp[2][N];
int main() {
cin >> n >> k;
for(int i=1; i<=n; i++) {
cin >> q[i].fi;
q[i].se = i;
}
sort(q+1,q+n+1);
for(int i=1; i<=n; i++) {
a[q[i].se] = (i-1)/k + 1;
}
for(int i=n; i>=1; i--) {
for(int j=0; j<=n; j++) {
dp[i%2][j] = dp[(i+1)%2][j];
if(a[i] >= j) {
dp[i%2][j] = max(dp[i%2][j],dp[(i+1)%2][a[i]]+1);
# | 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... |
# | 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... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |