제출 #268152

#제출 시각아이디문제언어결과실행 시간메모리
268152wdjpngSplit the Attractions (IOI19_split)C++17
컴파일 에러
0 ms0 KiB
#include <bits/stdc++.h> #define int long long #define rep(i,n) for(int i = 0; i < n; i++) #define all(a) a.begin(), a.end() using namespace std; const int maxn=200000; int out[maxn]; bool vis[maxn]; int c=0; vector<int>val(3); vector<int>s; vector<vector<int>>E; void dfs(int i){ if(vis[i]){return;} vis[i]=true; c++; if(c<=s[0]){ out[i]=val[0]; } else if(c<=s[0]+s[1]){ out[i]=val[1]; } else{ out[i]=val[2]; } for(int w : E[i]){ dfs(i); } } vector<int> find_split(int n, int a, int b, int c, vector<int>p, vector<int>q){ vector<int>s1={a,b,c}; s=s1; sort(all(s)); rep(i, p.size()){ E[p[i]].push_back(q[i]); E[q[i]].push_back(p[i]); } rep(i, 3){ rep(j, 3){ if(s1[i]==s[j]){ val[j]=i+1; } } } dfs(0); rep(i, n){ cout << out[i] <<" "; } }

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

split.cpp: In function 'void dfs(long long int)':
split.cpp:28:13: warning: unused variable 'w' [-Wunused-variable]
   28 |     for(int w : E[i]){
      |             ^
split.cpp: In function 'std::vector<long long int> find_split(long long int, long long int, long long int, long long int, std::vector<long long int>, std::vector<long long int>)':
split.cpp:4:35: warning: comparison of integer expressions of different signedness: 'long long int' and 'std::vector<long long int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
    4 | #define rep(i,n) for(int i = 0; i < n; i++)
......
   37 |     rep(i, p.size()){
      |         ~~~~~~~~~~~                
split.cpp:37:5: note: in expansion of macro 'rep'
   37 |     rep(i, p.size()){
      |     ^~~
split.cpp:54:1: warning: no return statement in function returning non-void [-Wreturn-type]
   54 | }
      | ^
/tmp/cc73zQby.o: In function `main':
grader.cpp:(.text.startup+0x27d): undefined reference to `find_split(int, int, int, int, std::vector<int, std::allocator<int> >, std::vector<int, std::allocator<int> >)'
collect2: error: ld returned 1 exit status