Submission #980115

# Submission time Handle Problem Language Result Execution time Memory
980115 2024-05-11T23:50:34 Z Maaxle Closing Time (IOI23_closing) C++17
0 / 100
90 ms 21844 KB
#include "closing.h"
#include <bits/stdc++.h>
    
#define range(it, a, b) for (ll it = a; it < b; it++)
#define all(x) begin(x), end(x)
#define ll long long
#define ull unsigned long long
#define INF64 ((ll) 1 << 60)
#define INF32 ((ll) 1 << 30)
#define uset unordered_set
#define umap unordered_map 
#define pqueue priority_queue
    
using namespace std;

struct Road {
    ll i, w;
};
bool operator < (const Road& a, const Road& b) {
    return a.w > b.w;
}

ll ans, k;
vector<vector<Road>> adj;
vector<ll> close;

void dijkstra(ll X, ll Y) {
    pqueue<Road> pq;
    pq.push({X, 0});
    pq.push({Y, 0});

    Road t;
    while (!pq.empty()) {
        t = pq.top(); pq.pop();
        
        if (close[t.i] != -1)
            continue;
        if (k - t.w < 0)
            return;

        close[t.i] = t.w;
        ans++;
        k -= t.w;
        for (Road& k : adj[t.i]) {
            Road nt = {k.i, t.w + k.w};
            if (close[k.i] == -1)
                pq.push(nt);
        }
    }
}

int max_score(int N, int X, int Y, long long K, vector<int> U, vector<int> V, vector<int> W) {
    close.resize(N, -1);
    adj.resize(N);
    k = K;

    range(i, 0, N-1) {
        adj[U[i]].push_back({V[i], W[i]});
        adj[V[i]].push_back({U[i], W[i]});
    }

    dijkstra(X, Y);
    return ans;
} 
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 348 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 Correct 72 ms 21588 KB Output is correct
2 Correct 90 ms 21844 KB Output is correct
3 Incorrect 46 ms 11600 KB 2nd lines differ - on the 1st token, expected: '38', found: '1000'
4 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 348 KB Output is correct
2 Incorrect 0 ms 348 KB 1st lines differ - on the 1st token, expected: '30', found: '17'
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 348 KB Output is correct
2 Incorrect 0 ms 348 KB 1st lines differ - on the 1st token, expected: '30', found: '17'
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 348 KB Output is correct
2 Incorrect 0 ms 348 KB 1st lines differ - on the 1st token, expected: '30', found: '17'
3 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: '6', found: '5'
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: '6', found: '5'
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: '6', found: '5'
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: '6', found: '5'
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: '6', found: '5'
2 Halted 0 ms 0 KB -