Submission #1065724

# Submission time Handle Problem Language Result Execution time Memory
1065724 2024-08-19T11:17:24 Z Gr1sen Closing Time (IOI23_closing) C++17
8 / 100
73 ms 25424 KB
#include "closing.h"
#include <iostream>
#include <vector>
#include <algorithm>
#include <queue>

using namespace std;


#define ll long long
#define vi vector<ll>
#define mp make_pair
#define pi pair<ll,ll>
#define pq priority_queue<pi>
#define vvi vector<vi>
#define vp vector<pi>
#define vvp vector<vp>
#define F first
#define S second

vi M;
vvp Adj;

int max_score(int N, int X, int Y, ll K, vector<int> U, vector<int> V, vector<int> W) {
    M = vi(N, -1);
    Adj = vvp(N);
    for (int i = 0; i < V.size(); i++) {
        int a  = U[i];
        int b  = V[i];
        int c  = -W[i];
        Adj[a].push_back({b, c});
        Adj[b].push_back({a, c});
    }
    pq Q;
    Q.push({0, X});
    Q.push({0, Y});
    ll ans = 0;
    while (Q.size()) {
    	int a = Q.top().second;
        int b = Q.top().first * (-1);
        Q.pop();
        //cerr << a << " " << b << endl;
        if (M[a] != -1) continue;
        if (K - b < 0) return ans;
        M[a] = b;
        ans += 1;
        K -= b;
        for (auto i : Adj[a]) {
            Q.push({i.S - b, i.F});
        }
    }
    return ans;
}

Compilation message

closing.cpp: In function 'int max_score(int, int, int, long long int, std::vector<int>, std::vector<int>, std::vector<int>)':
closing.cpp:27:23: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   27 |     for (int i = 0; i < V.size(); i++) {
      |                     ~~^~~~~~~~~~
# Verdict Execution time Memory Grader output
1 Incorrect 0 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 Correct 73 ms 21584 KB Output is correct
2 Correct 64 ms 25424 KB Output is correct
3 Correct 42 ms 5456 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 0 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 0 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 0 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 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 0 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 0 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 0 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 0 ms 344 KB 1st lines differ - on the 1st token, expected: '6', found: '5'
2 Halted 0 ms 0 KB -