제출 #1080585

#제출 시각아이디문제언어결과실행 시간메모리
1080585ALeonidouRoller Coaster Railroad (IOI16_railroad)C++17
11 / 100
2044 ms12112 KiB
#include "railroad.h" #include <bits/stdc++.h> using namespace std; #define ll long long #define F first #define S second #define pb push_back #define sz(x) (ll)x.size() typedef vector <ll> vi; typedef pair<ll,ll> ii; typedef vector <ii> vii; #define dbg(x) cout<<#x<<": "<<x<<endl; #define dbg2(x,y) cout<<#x<<": "<<x<<" "<<#y<<": "<<y<<endl; #define dbg3(x,y,z) cout<<#x<<": "<<x<<" "<<#y<<": "<<y<<" "<<#z<<": "<<z<<endl; void printVct(vi &v){ for (ll i =0; i<sz(v); i++){ cout<<v[i]<<" "; } cout<<endl; } #define INF 1000000000000000000 ll plan_roller_coaster(vector <int> ss, vector<int> tt) { ll n = sz(ss); ll n2 = (1 << n); vi s(n), t(n); for(ll i =0; i<n; i++){ s[i] = ss[i]; t[i] = tt[i]; } // printVct(t); // printVct(s); ll ans = INF; vi v(n); for (ll i =0; i<n; i++) v[i] = i; do{ ll c = 0; ll x = 1; for (ll i =0; i<n; i++){ ll idx = v[i]; // dbg3(idx, c, x); // dbg2(s[idx], t[idx]); if (x > s[idx]){ c += x-s[idx]; } x = t[idx]; } // printVct(v); // dbg(c); ans = min(ans, c); }while (next_permutation(v.begin(), v.end())); return ans; } /* 4 1 1 7 4 3 5 8 6 6 */

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

railroad.cpp: In function 'long long int plan_roller_coaster(std::vector<int>, std::vector<int>)':
railroad.cpp:31:8: warning: unused variable 'n2' [-Wunused-variable]
   31 |     ll n2 = (1 << n);
      |        ^~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...