제출 #1000717

#제출 시각아이디문제언어결과실행 시간메모리
1000717Nomio경주 (Race) (IOI11_race)C++17
9 / 100
3026 ms2396 KiB
#include<bits/stdc++.h> using namespace std; int best_path(int n, int k, int H[][2], int L[]) { // vector<int> adj[n + 1]; // for(int i = 0; i < n - 1; i++) { // int a, b; // a = H[i][0]; // b = H[i][1]; // a++; // b++; // adj[a].push_back(b); // adj[b].push_back(a); // } int S[n + 1] {}; for(int i = 0; i < n - 1; i++) { S[i + 2] = S[i + 1] + L[i]; } int mn = n; for(int i = 2; i <= n; i++) { for(int j = 1; j <= i - 1; j++) { if(S[i] - S[j] == k) { mn = min(mn, i - j); } } } if(mn == n) mn = -1; return mn; } //int main() { // cout << best_path(3, 3, {{0, 1}, {1, 2}}, {1, 1}) << '\n'; // return 0; //}
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...