제출 #570224

#제출 시각아이디문제언어결과실행 시간메모리
570224ChrisM2309도로 폐쇄 (APIO21_roads)C++14
컴파일 에러
0 ms0 KiB
#include "roads.h" #include <bits/stdc++.h> using namespace std; typedef pair<int,int> ii; typedef long long ll; typedef vector<int> vi; typedef vector<ll> vll; typedef vector<vi> vvi; typedef vector<ii> vii; typedef vector<vii> wgraf; typedef pair<int,ii> edge; #define UNVISITED 0 #define VISITED 1 #define INF 1000000000 #define pb push_back #define F first #define S second #define all(x) (x).begin(), (x).end() std::vector<long long> minimum_closure_costs(int N, std::vector<int> U, std::vector<int> V, std::vector<int> W) { vi ans(N); sort(all(W)); ll sum 0; for (auto i : W) sum += i; ans.pb(sum); for (int i = 1; i < W.size(); i++){ sum -= W[i]; ans.pb(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:25:9: error: expected initializer before numeric constant
   25 |  ll sum 0;
      |         ^
roads.cpp:26:19: error: 'sum' was not declared in this scope
   26 |  for (auto i : W) sum += i;
      |                   ^~~
roads.cpp:27:9: error: 'sum' was not declared in this scope
   27 |  ans.pb(sum);
      |         ^~~
roads.cpp:28:20: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   28 |  for (int i = 1; i < W.size(); i++){
      |                  ~~^~~~~~~~~~
roads.cpp:32:10: error: could not convert 'ans' from 'vector<int>' to 'vector<long long int>'
   32 |   return ans;
      |          ^~~
      |          |
      |          vector<int>