제출 #707491

#제출 시각아이디문제언어결과실행 시간메모리
707491josanneo22자매 도시 (APIO20_swap)C++17
0 / 100
1 ms296 KiB
//#include "swap.h"
#include<bits/stdc++.h>
#include <vector>
using namespace std;
vector<vector<pair<int,int>>> adj;
long long sm = 0;
int cycle = 1;
void init(int N, int M, std::vector<int> U, std::vector<int> V, std::vector<int> W) {
    int n, m; n = N; m = M;
    for (int i = 0; i < n; i++) {
        adj[U[i]].push_back(make_pair(V[i], W[i]));
        sm += (long long)W[i];
    }
    for (int i = 0; i < n; i++) {
        if (adj[i].size() == 1) cycle = 0;
    }
}

int getMinimumFuelCapacity(int X, int Y) {
    if (cycle == 1) cout << sm << '\n';
    else cout << "-1\n";
}

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

swap.cpp: In function 'void init(int, int, std::vector<int>, std::vector<int>, std::vector<int>)':
swap.cpp:9:12: warning: variable 'm' set but not used [-Wunused-but-set-variable]
    9 |     int n, m; n = N; m = M;
      |            ^
swap.cpp: In function 'int getMinimumFuelCapacity(int, int)':
swap.cpp:22:1: warning: no return statement in function returning non-void [-Wreturn-type]
   22 | }
      | ^
#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...