Submission #1162847

#TimeUsernameProblemLanguageResultExecution timeMemory
1162847tsengangRace (IOI11_race)C++17
0 / 100
0 ms324 KiB
#include <bits/stdc++.h>
#include "race.h"
using namespace std;
#define ll int
#define ff first
#define ss second
#define all(x) (x).begin(), (x).end()
#define pb push_back
#define ertunt return
#define vodka void
int best_path(int N,int K,int H[][2],int L[]){
    int pre[N+1];
    pre[0] = 0;
    for(ll i = 1; i <= N; i++){
        pre[i] = pre[i-1];
        pre[i] += L[i-1];
    }
    int ans = 1e19;
    for(ll i = 0; i <= N; i++){
        for(ll j = i; j <= N; j++){
            if(pre[j]-pre[i] == K){
                ans = min(ans,j-i);
            }
        }
    }
    ertunt ans;
}

Compilation message (stderr)

race.cpp: In function 'int best_path(int, int, int (*)[2], int*)':
race.cpp:18:15: warning: overflow in conversion from 'double' to 'int' changes value from '1.0e+19' to '2147483647' [-Woverflow]
   18 |     int ans = 1e19;
      |               ^~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...