Submission #1005098

# Submission time Handle Problem Language Result Execution time Memory
1005098 2024-06-22T07:11:08 Z Mardonbekhazratov Race (IOI11_race) C++17
0 / 100
1 ms 2396 KB
#include "race.h"
#include<bits/stdc++.h>

using namespace std;

int n;
vector<vector<pair<int,int>>>v;

int best_path(int N, int K, int H[][2], int L[]){
	n=N;
	vector<int>pref(n);
	pref[0]=0;
	v.resize(n);
	for(int i=0;i<n-1;i++){
		v[H[i][0]].push_back({H[i][1],L[i]});
		v[H[i][1]].push_back({H[i][0],L[i]});
		pref[i+1]=pref[i]+L[i];
	}
	int ans=n;
	for(int i=0;i<n-1;i++){
		int pos=lower_bound(pref.begin(),pref.end(),pref[i]+K)-pref.begin();
		if(pos!=n && pref[pos]-pref[i]==K) ans=min(ans,pos-i);
	}
	return ans==n ? -1 : ans+1;
}
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 2396 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 2396 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 2396 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 2396 KB Output isn't correct
2 Halted 0 ms 0 KB -