제출 #555957

#제출 시각아이디문제언어결과실행 시간메모리
555957aryan12도로 폐쇄 (APIO21_roads)C++17
5 / 100
87 ms14244 KiB
#include "roads.h" #include <bits/stdc++.h> using namespace std; const long long MAXN = 1e5 + 5; vector<array<long long, 2> > g[MAXN]; vector<long long> minimum_closure_costs(int N, vector<int> U, vector<int> V, vector<int> W) { long long sum = 0; vector<long long> ok; for(long long i = 0; i < U.size(); i++) { sum += W[i]; ok.push_back(W[i]); // cout << "U[i] = " << U[i] << ", V[i] = " << V[i] << ", W[i] = " << W[i] << "\n"; g[U[i]].push_back({V[i], W[i]}); g[V[i]].push_back({U[i], W[i]}); } sort(ok.begin(), ok.end()); vector<long long> ans; ans.push_back(sum); for(long long i = 1; i < N; i++) { sum -= ok[ok.size() - i]; ans.push_back(sum); } return ans; }

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

roads.cpp: In function 'std::vector<long long int> minimum_closure_costs(int, std::vector<int>, std::vector<int>, std::vector<int>)':
roads.cpp:12:28: warning: comparison of integer expressions of different signedness: 'long long int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   12 |     for(long long i = 0; i < U.size(); i++)
      |                          ~~^~~~~~~~~~
#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...