Submission #1233688

#TimeUsernameProblemLanguageResultExecution timeMemory
1233688lioowFinding Routers (IOI20_routers)C++20
Compilation error
0 ms0 KiB
#include "routers.h"
#include <bits/stdc++.h>
using namespace std;

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

Compilation message (stderr)

routers.cpp: In function 'std::vector<int> find_routers(int, int, int)':
routers.cpp:29:16: error: could not convert 'ans' from 'int [n]' to 'std::vector<int>'
   29 |         return ans;
      |                ^~~
      |                |
      |                int [n]