제출 #1161149

#제출 시각아이디문제언어결과실행 시간메모리
1161149just도로 폐쇄 (APIO21_roads)C++20
0 / 100
25 ms7860 KiB
#include "bits/stdc++.h"
using namespace std;

#define all(x) (x).begin(), (x).end()
#define int long long
#define vec vector
#define pii pair<int, int>

#define X first
#define Y second

vec<int> calc(int n, vec<pii> edges, vec<int> costs) {
    bool is_star = true;
    for(auto [u, _]: edges) is_star &= u == 0;

    if (is_star) {
        sort(all(costs));
        partial_sum(all(costs), costs.begin());
        reverse(all(costs));
        costs.push_back(0);
        return costs;
    }

    assert(!is_star);
}

vec<int> minimum_closure_costs(
    signed N, 
    vec<signed> U, 
    vec<signed> V, 
    vec<signed> W
) {
    vec<pii> edges;
    vec<int> costs(N);

    for (int i = 0; i < N; i++) {
        edges.push_back({U[i], V[i]});
        costs[i] = W[i];
    }

    return calc(N, edges, costs);
}


#ifdef debug
signed main() {}
#endif

컴파일 시 표준 에러 (stderr) 메시지

roads.cpp: In function 'std::vector<long long int> calc(long long int, std::vector<std::pair<long long int, long long int> >, std::vector<long long int>)':
roads.cpp:25:1: warning: control reaches end of non-void function [-Wreturn-type]
   25 | }
      | ^
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...