제출 #581634

#제출 시각아이디문제언어결과실행 시간메모리
581634zaneyuFinding Routers (IOI20_routers)C++14
컴파일 에러
0 ms0 KiB
#include "routers.h"
#include<bits/stdc++.h>
using namespace std;
#define f first
#define s second
map<int,int> mp;
void find_lampposts(int L, int N, int A[]) {
    A[0]=0;
	for(int i=1;i<N;i++){
	    int l=A[i-1],r=L;
	    for(auto x:mp){
	        if(x.s==i-1) l=x.f;
	    }
	    for(auto x:mp){
	        if(x.s>=i){
	            r=x.f;
	            break;
	        }
	    }
	    while(l<r){
	        int mid=(l+r+1)/2;
	        if(!mp.count(mid)) mp[mid]=nearest_lamppost(mid);
	        if(mp[mid]==i-1) l=mid;
	        else r=mid-1;
	    }
	    A[i]=A[i-1]+(l-A[i-1])*2;
	}
}

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

routers.cpp: In function 'void find_lampposts(int, int, int*)':
routers.cpp:22:37: error: 'nearest_lamppost' was not declared in this scope
   22 |          if(!mp.count(mid)) mp[mid]=nearest_lamppost(mid);
      |                                     ^~~~~~~~~~~~~~~~