Submission #132957

# Submission time Handle Problem Language Result Execution time Memory
132957 2019-07-20T02:48:35 Z zozder Race (IOI11_race) C++14
0 / 100
3 ms 1144 KB
#include "race.h"
#include <iostream>
#define maxn 200001

int sum[maxn];
int ans=9999999;

int best_path(int n, int K, int H[][2], int L[])
{
	for(int i=0;i<maxn;i++)sum[i]=0;
	for(int i=0;i<n;i++)
	{
		sum[i]+=L[i];
		sum[i+1]+=sum[i];
	}
	
	for(int i=0;i<n;i++)
	for(int j=i+1;j<n;j++)
	{
		if(i==0)
		{
			if(sum[j]==K&&j-i+1<ans)ans=j-i+1;
		}
		else if(sum[j]-sum[i-1]==K&&j-i+1<ans)ans=j-i+1;
	}
	
	return ans;
}
# Verdict Execution time Memory Grader output
1 Correct 3 ms 1144 KB Output is correct
2 Correct 3 ms 1144 KB Output is correct
3 Incorrect 3 ms 1144 KB Output isn't correct
4 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 3 ms 1144 KB Output is correct
2 Correct 3 ms 1144 KB Output is correct
3 Incorrect 3 ms 1144 KB Output isn't correct
4 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 3 ms 1144 KB Output is correct
2 Correct 3 ms 1144 KB Output is correct
3 Incorrect 3 ms 1144 KB Output isn't correct
4 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 3 ms 1144 KB Output is correct
2 Correct 3 ms 1144 KB Output is correct
3 Incorrect 3 ms 1144 KB Output isn't correct
4 Halted 0 ms 0 KB -