Submission #1074225

#TimeUsernameProblemLanguageResultExecution timeMemory
1074225TB_모임들 (IOI18_meetings)C++17
0 / 100
1 ms348 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;



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(ind, q){
        ll best = 1e18;
        for(ll meet = L[ind]; meet<=R[ind]; ind++){
            ll hi = H[meet];
            ll current = -hi;
            for(ll i = meet; i>=L[ind]; ind--){
                hi = max(hi, (ll)H[i]);
                current+=hi;
            }
            hi = H[meet];
            for(ll i = meet; i<=R[ind]; ind++){
                hi = max(hi, (ll)H[i]);
                current+=hi;
            }
            best=max(best, current);
        }
        C.pb(best);
    }
    return C;
}



// int main(){

//     vector<int> st = {1, 2, 1, 2, 1, 2};
//     create_circuit(2, st);

//     return 0;
// }


Compilation message (stderr)

meetings.cpp: In function 'std::vector<long long int> minimum_costs(std::vector<int>, std::vector<int>, std::vector<int>)':
meetings.cpp:19:8: warning: unused variable 'n' [-Wunused-variable]
   19 |     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...