Submission #581394

# Submission time Handle Problem Language Result Execution time Memory
581394 2022-06-22T15:04:54 Z Vanilla Pinball (JOI14_pinball) C++17
0 / 100
1 ms 212 KB
#include <bits/stdc++.h>
using namespace std;
typedef long long int64;
const int maxn = 1e5 + 2;
int64 l[maxn], r[maxn], c[maxn], cost[maxn];

int main() {
    int n,m;
    cin >> n >> m;
    for (int i = 0; i < n; i++){
        cin >> l[i] >> r[i] >> c[i] >> cost[i];
    }
    int64 ans = 1e18;
    for (int i = 0; i < n; i++){
        int64 tans = cost[i];
        int64 il = l[i], ir = r[i];
        for (int j = i - 1; j >= 0; j--){
            if (c[j] >= il && c[j] <= ir) {
                if (l[j] < il || r[j] > ir) {
                    tans+=cost[j];
                    il = min(il, l[j]);
                    ir = max(ir, r[j]);
                }
            }
            else {
                tans = 1e18;
                break;
            }
        }
        if (il == 1 && ir == m)
            ans = min(ans, tans);
    }
    cout << (ans == 1e18 ? -1: ans);
}
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 212 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 212 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 212 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 212 KB Output isn't correct
2 Halted 0 ms 0 KB -