제출 #789785

#제출 시각아이디문제언어결과실행 시간메모리
789785Minindu206Roller Coaster Railroad (IOI16_railroad)C++14
11 / 100
2067 ms4172 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 = s.size(); long long ans = LLONG_MAX; vector<int> perm(s); iota(perm.begin(), perm.end(), 0); do { long long cur = 0LL; int st = t[perm[0]]; // for(int i=0;i<n;i++) // cout << perm[i] << " "; // cout << '\n'; for(int i=1;i<n;i++) { int dis = t[perm[i - 1]] - s[perm[i]]; cur += (dis > 0 ? dis : 0); // cout << (dis > 0 ? dis : 0) << " "; } // cout << '\n'; ans = min(ans, cur); } while (next_permutation(perm.begin(), perm.end())); return ans; }

컴파일 시 표준 에러 (stderr) 메시지

railroad.cpp: In function 'long long int plan_roller_coaster(std::vector<int>, std::vector<int>)':
railroad.cpp:12:13: warning: unused variable 'st' [-Wunused-variable]
   12 |         int st = t[perm[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...