제출 #1078552

#제출 시각아이디문제언어결과실행 시간메모리
1078552TB_모임들 (IOI18_meetings)C++17
19 / 100
5550 ms6520 KiB
#include <bits/stdc++.h> using namespace std; #define ll long long #define fo(i, n) for(ll i = 0; i<(n); i++) #define pb push_back #define F first #define S second #define deb(x) cout << #x << " = " << (x) << endl #define deb2(x, y) cout << #x << " = " << (x) << ", " << #y << " = " << (y) << endl typedef vector<ll> vl; typedef vector<vl> vvl; vl v; struct Node{ Node *lnode, *rnode; ll l, r; Node(ll l, ll r) : l(l), r(r){ if(r-l==1){ }else{ } } }; ll rec(ll lo, ll hi){ if(hi-lo<=0) return 0; if(hi-lo<=1) return v[lo]; ll maxval = 0; for(int i = lo; i<hi; i++){ maxval= max(maxval, v[i]); } vl temp = {lo-1}; for(int i = lo; i<hi; i++){ if(v[i] == maxval) temp.pb(i); } temp.pb(hi); ll ans = 1e18; fo(i, ((ll)temp.size())-1){ ans = min(ans, (hi-lo-(temp[i+1]-temp[i]-1ll))*maxval+rec(temp[i]+1, temp[i+1])); } // deb2(lo, hi); // deb(ans); return ans; } vector<long long> minimum_costs(vector<int> H, vector<int> L, vector<int> R) { int q = L.size(); ll n = H.size(); vl C; // fo(i, n) v.pb(H[i]); // Node st(0, n); fo(i, q){ v.clear(); for(ll j = L[i]; j<=R[i]; j++){ v.pb(H[j]); } C.pb(rec(0, v.size())); } return C; }

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

meetings.cpp: In function 'std::vector<long long int> minimum_costs(std::vector<int>, std::vector<int>, std::vector<int>)':
meetings.cpp:56:8: warning: unused variable 'n' [-Wunused-variable]
   56 |     ll n = H.size();
      |        ^
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...