답안 #876038

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
876038 2023-11-21T07:01:11 Z Regulus Escape Route (JOI21_escape_route) C++17
0 / 100
146 ms 158992 KB
#include <bits/stdc++.h>            // pA
#include "escape_route.h"
#define IO ios::sync_with_stdio(false);cin.tie(0);
#define debug(x) cerr << #x << " = " << (x) << ' '
#define endl cerr << '\n'
#define all(v) (v).begin(), (v).end()
#define lowbit(x) (x)&-(x)
#define pb emplace_back
#define F first
#define S second
using namespace std;
using ll = long long;
using pll = pair<ll, ll>;
using ppl = pair<pll, ll>;
 
const int N = 2e5+5;
const int INF = 2e9;
pll dis[N];
vector<ll> ans;
vector<pll> g[N];
priority_queue<ppl, vector<ppl>, greater<ppl> > pq;
 
std::vector<long long> calculate_necessary_time(int N, int M, long long s, int Q, std::vector<int> A, std::vector<int> B,std::vector<long long> L, std::vector<long long> C, std::vector<int> U, std::vector<int> V, std::vector<long long> T)
{
    int i, j, n=N, m=M;
 
    for (i=0; i < m; ++i) g[A[i]].pb(B[i], i), g[B[i]].pb(A[i], i);
    
    for (i=0; i < n; ++i) dis[i] = {INF, INF};
    dis[0] = {0, 0}, pq.push({pll{0, 0}, 0});
    while (!pq.empty())
    {
        int x = pq.top().S;
        pq.pop();
        for (auto p : g[x])
        {
            ll v = p.F, id = p.S;
            pll tmp = dis[x];
            tmp.S += L[id];
            if (tmp.S >= C[id]) ++tmp.F, tmp.S = 0;
            if (tmp < dis[v])
            {
                dis[v] = tmp, pq.push({dis[v], v});
            }
        }
    }

    for (i=0; i < Q; ++i)
    {
        auto p = dis[V[i]];
        ans.pb(p.F*s + p.S);
    }

 
    return ans;
}

Compilation message

escape_route.cpp: In function 'std::vector<long long int> calculate_necessary_time(int, int, long long int, int, std::vector<int>, std::vector<int>, std::vector<long long int>, std::vector<long long int>, std::vector<int>, std::vector<int>, std::vector<long long int>)':
escape_route.cpp:25:12: warning: unused variable 'j' [-Wunused-variable]
   25 |     int i, j, n=N, m=M;
      |            ^
# 결과 실행 시간 메모리 Grader output
1 Incorrect 11 ms 71516 KB Output isn't correct
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 146 ms 158992 KB Output isn't correct
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 11 ms 71516 KB Output isn't correct
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 11 ms 71516 KB Output isn't correct
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 11 ms 71516 KB Output isn't correct
2 Halted 0 ms 0 KB -