Submission #1230108

#TimeUsernameProblemLanguageResultExecution timeMemory
1230108lioowFinding Routers (IOI20_routers)C++20
Compilation error
0 ms0 KiB
#include "routers.h"
#include <vector>
#include <cassert>
#include <cstdio>
#include <algorithm>
using namespace std;
#define pb push_back

std::vector<int> find_routers(int l, int n, int q) {
    vector<int>ans(n+1);
    ans[0]=0;
    for(int i=1;i<=n-1;i++){
    	int l=ans[i-1]+1;
    	int r=n-1;
    	int an=-1;
    	while(l<=r){
    		int mid=(l+r)/2;
    		int nw=use_detector(mid);
    		if(x>=i){
    			an=mid;
    			r=mid-1;
			} else {
				if(x==i-1) lol=ans[i-1]+2*(lol-ans[i-1]);
				l=mid+1;
			}
		}
		ans[i]=lol;
	}
	return ans;
}

Compilation message (stderr)

routers.cpp: In function 'std::vector<int> find_routers(int, int, int)':
routers.cpp:19:20: error: 'x' was not declared in this scope
   19 |                 if(x>=i){
      |                    ^
routers.cpp:23:44: error: 'lol' was not declared in this scope
   23 |                                 if(x==i-1) lol=ans[i-1]+2*(lol-ans[i-1]);
      |                                            ^~~
routers.cpp:27:24: error: 'lol' was not declared in this scope
   27 |                 ans[i]=lol;
      |                        ^~~