제출 #1058594

#제출 시각아이디문제언어결과실행 시간메모리
1058594qwusha사탕 분배 (IOI21_candies)C++17
컴파일 에러
0 ms0 KiB
#include <bits/stdc++.h> using namespace std; typedef long long ll; #define fi first #define se second typedef long double ld; const ld eps = 1e-8; mt19937 rnd(chrono::high_resolution_clock::now().time_since_epoch().count()); const ll inf = 1e18; const ll mod = 1e9 + 7; #include "candies.h" vector<int> distribute_candies(vector<int> &c, vector<int> &l, vector<int> &r, vector<int> &v) { int n = c.size(); vector<int> res(n); for (int qw = 0; qw < l.size(); qw++) { for (int i = l[qw]; i <= r[qw]; i++) { if (v[qw] > 0) { res[i] = min(res[i] + v[qw], c[i]); } else { res[i] = max(res[i] - v[qw], 0); } } } return res; }

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

candies.cpp: In function 'std::vector<int> distribute_candies(std::vector<int>&, std::vector<int>&, std::vector<int>&, std::vector<int>&)':
candies.cpp:17:25: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   17 |     for (int qw = 0; qw < l.size(); qw++) {
      |                      ~~~^~~~~~~~~~
/usr/bin/ld: /tmp/cc2VgxCd.o: in function `main':
grader.cpp:(.text.startup+0x30e): undefined reference to `distribute_candies(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