제출 #885382

#제출 시각아이디문제언어결과실행 시간메모리
885382eilouvre늑대인간 (IOI18_werewolf)C++17
컴파일 에러
0 ms0 KiB
#include <iostream> #include <vector> std::vector<int> check_validity(int N, std::vector<int>& X, std::vector<int>& Y, std::vector<int>& S, std::vector<int>& E, std::vector<int>& L, std::vector<int>& R) { std::vector<int> A(S.size(), 1); // Initialize with all trips as possible std::vector<int> low_populated_cities(N + 1, 0); std::vector<int> high_populated_cities(N + 1, 0); for (int i = 0; i < L.size(); ++i) { low_populated_cities[L[i]] += 1; high_populated_cities[R[i] + 1] += 1; } for (int i = 1; i <= N; ++i) { low_populated_cities[i] += low_populated_cities[i - 1]; high_populated_cities[i] += high_populated_cities[i - 1]; } for (int i = 0; i < S.size(); ++i) { int si = S[i]; int ei = E[i]; int low_count = low_populated_cities[ei] - low_populated_cities[si - 1]; int high_count = high_populated_cities[ei] - high_populated_cities[si - 1]; if (low_count > high_count) { A[i] = 0; } } return A; }

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

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:10:23: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   10 |     for (int i = 0; i < L.size(); ++i) {
      |                     ~~^~~~~~~~~~
werewolf.cpp:20:23: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   20 |     for (int i = 0; i < S.size(); ++i) {
      |                     ~~^~~~~~~~~~
/usr/bin/ld: /tmp/ccoWPXfb.o: in function `main':
grader.cpp:(.text.startup+0x377): undefined reference to `check_validity(int, std::vector<int, std::allocator<int> >, std::vector<int, std::allocator<int> >, std::vector<int, std::allocator<int> >, std::vector<int, std::allocator<int> >, std::vector<int, std::allocator<int> >, std::vector<int, std::allocator<int> >)'
collect2: error: ld returned 1 exit status