답안 #529744

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
529744 2022-02-23T14:56:29 Z c28dnv9q3 Monster Game (JOI21_monster) C++17
컴파일 오류
0 ms 0 KB
#include <bits/stdc++.h>


template<typename F>
int binsearch(int low, int high, F f) {

    if(f(low)) {
        return low;
    }

    while(high > low+1)
    {
        int m = (low + high) / 2;
        if(f(m)) {
            high = m;
        } else {
            low = m;
        }
    }
    return high;
}


int main()
{
    int n; 
    int m;
    std::cin >> n;
    std::cin >> m;
    std::vector<int> a(m);
    for(int i = 0; i < m; i++)
    {
        std::cin >> a[i];
    }

    std::cout << binsearch(1, 1000000005, [&] (int x) 
    {
        int j = 0;
        for(int i = 0; i < m; i++)
        {
            j += std::ceil((float)a[i]/x);
        }
        return j <= n;
    });
}

Compilation message

/usr/bin/ld: /tmp/ccnEiHiq.o: in function `main':
stub.cpp:(.text.startup+0x0): multiple definition of `main'; /tmp/ccwfHYcq.o:monster.cpp:(.text.startup+0x0): first defined here
/usr/bin/ld: /tmp/ccnEiHiq.o: in function `main':
stub.cpp:(.text.startup+0xb3): undefined reference to `Solve(int)'
collect2: error: ld returned 1 exit status