Submission #840873

# Submission time Handle Problem Language Result Execution time Memory
840873 2023-08-31T19:47:26 Z Mohmad_Zaid Closing Time (IOI23_closing) C++17
0 / 100
78 ms 17036 KB
#include "closing.h"
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define pb push_back

vector<vector<pair<int,int>>>g;
struct triple{
    int first,second;
    ll curr;
};
int max_score(int N, int X, int Y, long long K,vector<int> U, vector<int> V, vector<int> W)
{
    int n=N;
    set<ll>dis;
    g.resize(n,vector<pair<int,int>>());
    for(int i=0;i<n;i++){
        g[U[i]].pb({V[i],W[i]});
        g[V[i]].pb({U[i],W[i]});
    }
    queue<triple>q;
    triple one;
    one.first=X;
    one.second=X;
    one.curr=0;
    triple two;
    two.first=Y;
    two.second=Y;
    two.curr=0;
    q.push(one);
    q.push(two);
    while(!q.empty()){
        int p=q.front().first;
        int v=q.front().second;
        ll cur=q.front().curr;
        q.pop();
        for(auto i:g[v]){
            if(i.first==p)continue;
            if(cur+i.second>K)break;
            dis.insert(cur+i.second);
            triple temp;
            temp.first=v;
            temp.second=i.first;
            temp.curr=i.second+cur;
        }
    }
    int ans=0;
    for(auto i:dis){
        if(i>K)break;
        ans++;
        K-=i;
    }

    return ans+2;
}

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:41:20: warning: variable 'temp' set but not used [-Wunused-but-set-variable]
   41 |             triple temp;
      |                    ^~~~
# Verdict Execution time Memory Grader output
1 Runtime error 1 ms 340 KB Execution killed with signal 11
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 78 ms 17036 KB 1st lines differ - on the 1st token, expected: '451', found: '7'
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 1 ms 340 KB Execution killed with signal 11
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 1 ms 340 KB Execution killed with signal 11
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 1 ms 340 KB Execution killed with signal 11
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 1 ms 340 KB Execution killed with signal 11
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 1 ms 340 KB Execution killed with signal 11
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 1 ms 340 KB Execution killed with signal 11
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 1 ms 340 KB Execution killed with signal 11
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 1 ms 340 KB Execution killed with signal 11
2 Halted 0 ms 0 KB -