Submission #100055

#TimeUsernameProblemLanguageResultExecution timeMemory
100055helloworldworldRoller Coaster Railroad (IOI16_railroad)C++14
0 / 100
2017 ms4280 KiB
#include "railroad.h" #include <bits/stdc++.h> using namespace std; long long plan_roller_coaster(std::vector<int> s, std::vector<int> t) { int n = (int) s.size(); int arr[n]; for(int i=0;i<n;i++) arr[i]=i; long long mini,cur; for(int i=1;i<n;i++){ if(t[i-1]>s[i]) cur+=t[i-1]-s[i]; } mini=cur; while(next_permutation(arr,arr+n)){ for(int i=1;i<n;i++){ if(t[i-1]>s[i]) cur+=t[i-1]-s[i]; } if(mini>cur) mini=cur; } return mini; }

Compilation message (stderr)

railroad.cpp: In function 'long long int plan_roller_coaster(std::vector<int>, std::vector<int>)':
railroad.cpp:13:16: warning: 'cur' may be used uninitialized in this function [-Wmaybe-uninitialized]
             cur+=t[i-1]-s[i];
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...