Submission #980276

# Submission time Handle Problem Language Result Execution time Memory
980276 2024-05-12T02:30:06 Z vjudge1 Closing Time (IOI23_closing) C++17
0 / 100
1000 ms 10836 KB
#include "closing.h"
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using vll = vector <ll>;
using vi = vector <int>;

const ll MAXN = 2E5+16;

int max_score (int n, int u1, int u2, ll k, vi u, vi v, vi w) {
    vi ve(w);
    vi f1(n, 0), f2(n, 0);
    f1[u1] = 0;
    f2[u2] = 0;
    for (int u = u1+1; u < n; u++)
        f1[u] = f1[u-1] + w[u-1];
    for (int u = u1-1; u >= 0; u--)
        f1[u] = f1[u+1] + w[u];
    for (int u = u2+1; u < n; u++)
        f2[u] = f2[u-1] + w[u-1];
    for (int u = u2-1; u >= 0; u--)
        f2[u] = f2[u+1] + w[u];
    int ans = 0;
    for (int l1 = 0; l1 <= u1; l1++)
    for (int r1 = u1; r1 < n; r1++) {
        for (int l2 = 0; l2 <= u2; l2++)
        for (int r2 = u2; r2 < n; r2++) {
            ll cost = 0;
            for (int i = l1; i <= r1; i++) {
                if (l2 <= i && i <= r2) 
                    cost += max(f1[i], f2[i]);
                else
                    cost += f1[i];
            }
            for (int i = l2; i <= r2; i++) {
                if (l1 <= i && i <= r1) continue;
                cost += f2[i];
            }
            if (cost < k) ans = max(ans, r1-l1+1 + r2-l2+1);
        }
    }
    return ans;
}
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 344 KB 1st lines differ - on the 1st token, expected: '6', found: '5'
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 1024 ms 10836 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 348 KB 1st lines differ - on the 1st token, expected: '3', found: '2'
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 348 KB 1st lines differ - on the 1st token, expected: '3', found: '2'
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 348 KB 1st lines differ - on the 1st token, expected: '3', found: '2'
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 344 KB 1st lines differ - on the 1st token, expected: '6', found: '5'
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 344 KB 1st lines differ - on the 1st token, expected: '6', found: '5'
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 344 KB 1st lines differ - on the 1st token, expected: '6', found: '5'
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 344 KB 1st lines differ - on the 1st token, expected: '6', found: '5'
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 344 KB 1st lines differ - on the 1st token, expected: '6', found: '5'
2 Halted 0 ms 0 KB -