제출 #295532

#제출 시각아이디문제언어결과실행 시간메모리
295532zoooma13늑대인간 (IOI18_werewolf)C++14
컴파일 에러
0 ms0 KiB
#include <bits/stdc++.h> #include "werewolf.h" #include "grader.cpp" using namespace std; vector <vector <int>> adj; vector <int> a ,pos; int gt(int u ,int p=-1){ a.push_back(u); if(adj[u].size() == 1 && ~p) return u; if(adj[u][0] != p) return gt(adj[u][0] ,u); return gt(adj[u][1] ,u); } int getlastzero(int l ,int r ,int q){ for(int i=r; i>=l; i--) if(a[i] < q) return i; return -1; } int getfirsttwo(int l ,int r ,int q){ for(int i=l; i<=r; i++) if(a[i] > q) return i; return -1; } vector<int> check_validity(int N, vector<int> X, vector<int> Y,vector<int> S, vector<int> E,vector<int> L, vector<int> R) { assert(X.size() == N-1); adj.resize(N); for(int i=0; i<X.size(); i++){ adj[X[i]].push_back(Y[i]); adj[Y[i]].push_back(X[i]); } int lf = gt(0); a.clear(); gt(lf); pos.resize(N); for(int i=0; i<N; i++) pos[a[i]] = i; ///bld vector <int> ret(R.size()); for(int q = 0; q < R.size(); q++){ int l = pos[S[q]] ,r = pos[E[q]]; if(r < l) continue; int last0 = getlastzero(l ,r ,L[q]); int first2 = getfirsttwo(l ,r ,R[q]); if(last0==-1&&first2==-1) ret[q] = 1; else if(last0 == -1) ret[q] = first2 != l; else if(first2 == -1) ret[q] = 1; else ret[q] = (first2 >= last0+2); } reverse(a.begin() ,a.end()); for(int i=0; i<N; i++) pos[a[i]] = i; ///bld for(int q = 0; q < R.size(); q++){ int l = pos[S[q]] ,r = pos[E[q]]; if(r < l) continue; int last0 = getlastzero(l ,r ,L[q]); int first2 = getfirsttwo(l ,r ,R[q]); if(last0==-1&&first2==-1) ret[q] = 1; else if(last0 == -1) ret[q] = first2 != l; else if(first2 == -1) ret[q] = 1; else ret[q] = (first2 >= last0+2); } return ret; }

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

In file included from /usr/include/c++/9/cassert:44,
                 from /usr/include/x86_64-linux-gnu/c++/9/bits/stdc++.h:33,
                 from werewolf.cpp:1:
werewolf.cpp: In function 'std::vector<int> check_validity(int, std::vector<int>, std::vector<int>, std::vector<int>, std::vector<int>, std::vector<int>, std::vector<int>)':
werewolf.cpp:29:21: warning: comparison of integer expressions of different signedness: 'std::vector<int>::size_type' {aka 'long unsigned int'} and 'int' [-Wsign-compare]
   29 |     assert(X.size() == N-1);
      |            ~~~~~~~~~^~~~~~
werewolf.cpp:31:19: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   31 |     for(int i=0; i<X.size(); i++){
      |                  ~^~~~~~~~~
werewolf.cpp:43:22: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   43 |     for(int q = 0; q < R.size(); q++){
      |                    ~~^~~~~~~~~~
werewolf.cpp:60:22: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   60 |     for(int q = 0; q < R.size(); q++){
      |                    ~~^~~~~~~~~~
/tmp/ccOYszn8.o: In function `main':
grader.cpp:(.text.startup+0x0): multiple definition of `main'
/tmp/ccUPgR44.o:werewolf.cpp:(.text.startup+0x0): first defined here
collect2: error: ld returned 1 exit status