제출 #996248

#제출 시각아이디문제언어결과실행 시간메모리
996248salmonJobs (BOI24_jobs)C++14
컴파일 에러
0 ms0 KiB
#include <bits/stdc++.h> using namespace std; int N; vector<int> root; int h,h1; long long int lst[300100]; int parent[300100]; pair<set<long long int>*,long long int> dfs(int i, int p){ } int main(){ scanf(" %d",&N); for(int i = 1; i <= N; i++){ scanf(" %d",&h); scanf(" %d",&h1); if(h1 == 0){ root.push_back(i); } lst[i] = h; parent[i] = h1; } for(int i : root){ dfs(root,-1); } }

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

Main.cpp: In function 'std::pair<std::set<long long int>*, long long int> dfs(int, int)':
Main.cpp:12:1: warning: no return statement in function returning non-void [-Wreturn-type]
   12 | }
      | ^
Main.cpp: In function 'int main()':
Main.cpp:29:7: error: cannot convert 'std::vector<int>' to 'int'
   29 |   dfs(root,-1);
      |       ^~~~
      |       |
      |       std::vector<int>
Main.cpp:10:49: note:   initializing argument 1 of 'std::pair<std::set<long long int>*, long long int> dfs(int, int)'
   10 | pair<set<long long int>*,long long int> dfs(int i, int p){
      |                                             ~~~~^
Main.cpp:28:10: warning: unused variable 'i' [-Wunused-variable]
   28 |  for(int i : root){
      |          ^
Main.cpp:15:7: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
   15 |  scanf(" %d",&N);
      |  ~~~~~^~~~~~~~~~
Main.cpp:18:8: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
   18 |   scanf(" %d",&h);
      |   ~~~~~^~~~~~~~~~
Main.cpp:19:8: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
   19 |   scanf(" %d",&h1);
      |   ~~~~~^~~~~~~~~~~