제출 #570119

#제출 시각아이디문제언어결과실행 시간메모리
570119Garguy22도로 폐쇄 (APIO21_roads)C++17
컴파일 에러
0 ms0 KiB
#include <bits/stdc++.h> using namespace std; typedef long long ll; typedef vector<ll> vi; #define pb push_back; vi minimum_closure_costs(int N, vi U, vi V, vi W){ ll temp = 0; vi ans; sort(W.begin()W.end()); ans.pb(0); for(int i = 0; i < n; i++){ temp += w[i]; ans.pb(temp); } reverse(ans.begin(), ans.end()); return ans; }

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

roads.cpp: In function 'vi minimum_closure_costs(int, vi, vi, vi)':
roads.cpp:11:16: error: expected ')' before 'W'
   11 |  sort(W.begin()W.end());
      |      ~         ^
      |                )
roads.cpp:11:23: error: no matching function for call to 'sort(std::vector<long long int>::iterator)'
   11 |  sort(W.begin()W.end());
      |                       ^
In file included from /usr/include/c++/10/algorithm:62,
                 from /usr/include/x86_64-linux-gnu/c++/10/bits/stdc++.h:65,
                 from roads.cpp:1:
/usr/include/c++/10/bits/stl_algo.h:4849:5: note: candidate: 'template<class _RAIter> void std::sort(_RAIter, _RAIter)'
 4849 |     sort(_RandomAccessIterator __first, _RandomAccessIterator __last)
      |     ^~~~
/usr/include/c++/10/bits/stl_algo.h:4849:5: note:   template argument deduction/substitution failed:
roads.cpp:11:23: note:   candidate expects 2 arguments, 1 provided
   11 |  sort(W.begin()W.end());
      |                       ^
In file included from /usr/include/c++/10/algorithm:62,
                 from /usr/include/x86_64-linux-gnu/c++/10/bits/stdc++.h:65,
                 from roads.cpp:1:
/usr/include/c++/10/bits/stl_algo.h:4880:5: note: candidate: 'template<class _RAIter, class _Compare> void std::sort(_RAIter, _RAIter, _Compare)'
 4880 |     sort(_RandomAccessIterator __first, _RandomAccessIterator __last,
      |     ^~~~
/usr/include/c++/10/bits/stl_algo.h:4880:5: note:   template argument deduction/substitution failed:
roads.cpp:11:23: note:   candidate expects 3 arguments, 1 provided
   11 |  sort(W.begin()W.end());
      |                       ^
In file included from /usr/include/c++/10/algorithm:74,
                 from /usr/include/x86_64-linux-gnu/c++/10/bits/stdc++.h:65,
                 from roads.cpp:1:
/usr/include/c++/10/pstl/glue_algorithm_defs.h:292:1: note: candidate: 'template<class _ExecutionPolicy, class _RandomAccessIterator, class _Compare> __pstl::__internal::__enable_if_execution_policy<_ExecutionPolicy, void> std::sort(_ExecutionPolicy&&, _RandomAccessIterator, _RandomAccessIterator, _Compare)'
  292 | sort(_ExecutionPolicy&& __exec, _RandomAccessIterator __first, _RandomAccessIterator __last, _Compare __comp);
      | ^~~~
/usr/include/c++/10/pstl/glue_algorithm_defs.h:292:1: note:   template argument deduction/substitution failed:
roads.cpp:11:23: note:   candidate expects 4 arguments, 1 provided
   11 |  sort(W.begin()W.end());
      |                       ^
In file included from /usr/include/c++/10/algorithm:74,
                 from /usr/include/x86_64-linux-gnu/c++/10/bits/stdc++.h:65,
                 from roads.cpp:1:
/usr/include/c++/10/pstl/glue_algorithm_defs.h:296:1: note: candidate: 'template<class _ExecutionPolicy, class _RandomAccessIterator> __pstl::__internal::__enable_if_execution_policy<_ExecutionPolicy, void> std::sort(_ExecutionPolicy&&, _RandomAccessIterator, _RandomAccessIterator)'
  296 | sort(_ExecutionPolicy&& __exec, _RandomAccessIterator __first, _RandomAccessIterator __last);
      | ^~~~
/usr/include/c++/10/pstl/glue_algorithm_defs.h:296:1: note:   template argument deduction/substitution failed:
roads.cpp:11:23: note:   candidate expects 3 arguments, 1 provided
   11 |  sort(W.begin()W.end());
      |                       ^
roads.cpp:6:12: error: statement cannot resolve address of overloaded function
    6 | #define pb push_back;
      |            ^
roads.cpp:12:6: note: in expansion of macro 'pb'
   12 |  ans.pb(0);
      |      ^~
roads.cpp:12:9: warning: statement has no effect [-Wunused-value]
   12 |  ans.pb(0);
      |        ~^~
roads.cpp:13:21: error: 'n' was not declared in this scope
   13 |  for(int i = 0; i < n; i++){
      |                     ^
roads.cpp:14:11: error: 'w' was not declared in this scope
   14 |   temp += w[i];
      |           ^
roads.cpp:6:12: error: statement cannot resolve address of overloaded function
    6 | #define pb push_back;
      |            ^
roads.cpp:15:7: note: in expansion of macro 'pb'
   15 |   ans.pb(temp);
      |       ^~
roads.cpp:15:10: warning: statement has no effect [-Wunused-value]
   15 |   ans.pb(temp);
      |         ~^~~~~