제출 #554144

#제출 시각아이디문제언어결과실행 시간메모리
554144Zhora_004도로 폐쇄 (APIO21_roads)C++17
컴파일 에러
0 ms0 KiB
#include "roads.h" #include <iostream> #include <cmath> #include <algorithm> #include <vector> #include <set> #include <unordered_set> #include <queue> #include <deque> #include <string> #include <sstream> #include <iomanip> #include <map> #include <unordered_map> #include <stack> #include <cstdio> #include <climits> #include <tuple> #include <ctime> #include <cstring> #include <numeric> #include <functional> #include <chrono> #include <cassert> #include <bitset> #include <fstream> //#include <bit> //#include <ranges> //#include <numbers> #define sz(a) ((int)((a).size())) // printf("%.10f\n", ans); /*ofstream fout("timeline.out"); ifstream fin("timeline.in");*/ using ll = long long; using namespace std; int n; vector<int> a, b, c; bool task(int id) { if (id == 1) { for (int& i : a) if (i) return 0; return 1; } return 0; } std::vector<long long> minimum_closure_costs(int N, std::vector<int> U, std::vector<int> V, std::vector<int> W) { n = N; a = U; b = V; c = W; if (task(1)) { vector<ll> res; ll sum = 0; for (int& i : c) sum += i; res.push_back(sum); sort(c.begin(), c.end()); reverse(c.begin(), c.end()); for (int k = 0; k < n - 1; i++) { sum -= c[k]; res.push_back(sum); } return res; } }

컴파일 시 표준 에러 (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:62:30: error: 'i' was not declared in this scope
   62 |   for (int k = 0; k < n - 1; i++)
      |                              ^
roads.cpp:69:1: warning: control reaches end of non-void function [-Wreturn-type]
   69 | }
      | ^