제출 #306141

#제출 시각아이디문제언어결과실행 시간메모리
306141lolicon버섯 세기 (IOI20_mushrooms)C++14
컴파일 에러
0 ms0 KiB
#include <bits/stdc++.h> #include "mushrooms.h" using namespace std; int use_machine(vector<int> a) { return 0; } int count_mushrooms(int n) { int cnt = 0; int k = sqrt(n); vector<int> arr(n, 0); for(int i = 1; i < 2 * k; i++) { vector<int> m = {0, i}; if(use_machine(m)) { arr[i] = 1; cnt++; } } int ret = 2 * k - cnt; if(cnt >= k) { // 1 is more vector<int> keep; for(int i = 0; i < 2 * k; i++) { if(arr[i] == 1) keep.push_back(i); } int block = (int)keep.size() - 1; assert(block + 1 >= k); for(int i = 2 * k; i < n; i += block) { vector<int> ask; ask.push_back(0); for(int j = 0, k = 1; j + i < n && j < block; j++) { ask.push_back(j + i); ask.push_back(keep[k]); k++; } ret += use_machine(ask) / 2; } } else { // 0 is more vector<int> keep; for(int i = 0; i < 2 * k; i++) { if(arr[i] == 0) keep.push_back(i); } int block = keep.size() - 1; assert(block + 1 >= k); for(int i = 2 * k; i < n; i += block) { vector<int> ask; ask.push_back(0); for(int j = 0, k = 1; j + i < n && j < block; j++) { ask.push_back(j + i); ask.push_back(keep[k]); k++; } ret += ((int)ask.size() / 2) - use_machine(ask) / 2; } } // [0, 2 * k) return ret; }

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

/tmp/cclsBtCZ.o: In function `use_machine(std::vector<int, std::allocator<int> >)':
stub.cpp:(.text+0x200): multiple definition of `use_machine(std::vector<int, std::allocator<int> >)'
/tmp/ccQeN9Fk.o:mushrooms.cpp:(.text+0x0): first defined here
collect2: error: ld returned 1 exit status