제출 #335648

#제출 시각아이디문제언어결과실행 시간메모리
335648couplefire전선 연결 (IOI17_wiring)C++17
컴파일 에러
0 ms0 KiB
#include <bits/stdc++.h>
using namespace std;

int find_best(int n) {
    if(n == 1) return 0;
    int mx = 0;
	for(int i = 0; i<20; i++){
        srand(time(0));
        vector<int> vv = ask(rand()%n);
        mx = max(mx, vv.front()+vv.back());
    }
    int cur = 0;
    for(int i = 0; i<mx; i++){
        int lo = cur, hi = n-1;
        while(lo < hi){
            int mid = lo+(hi-lo)/2;
            vector<int> vv = ask(mid);
            int a = vv.front(), b = vv.back();
            if(a+b < mx) hi = mid;
            else if(a == i) lo = mid+1;
            else hi = mid-1;
        }
        vector<int> vvv = ask(lo);
        if(vvv.front()+vvv.back() == 0) return lo;
        cur = lo+1; 
    }
	return 0;
}

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

wiring.cpp: In function 'int find_best(int)':
wiring.cpp:9:26: error: 'ask' was not declared in this scope
    9 |         vector<int> vv = ask(rand()%n);
      |                          ^~~
wiring.cpp:17:30: error: 'ask' was not declared in this scope
   17 |             vector<int> vv = ask(mid);
      |                              ^~~
wiring.cpp:23:27: error: 'ask' was not declared in this scope
   23 |         vector<int> vvv = ask(lo);
      |                           ^~~