Submission #944125

#TimeUsernameProblemLanguageResultExecution timeMemory
944125beepbeepsheepMeetings (IOI18_meetings)C++17
4 / 100
326 ms2900 KiB
#include "meetings.h" #include <bits/stdc++.h> using namespace std; #define ll long long const ll inf=1e18; std::vector<long long> minimum_costs(std::vector<int> H, std::vector<int> L, std::vector<int> R) { ll n=H.size(); ll q=L.size(); vector<ll> ans; ll arr[3005]; for (int i=0;i<q;i++){ ll tot=inf; for (int j=L[i];j<=R[i];j++){ ll curr=0; memset(arr,0,sizeof(arr)); arr[j]=H[j]; for (int k=j-1;k>=L[i];k--){ arr[k]=max<ll>(arr[k+1],H[k]); } for (int k=j+1;k<=R[i];k++){ arr[k]=max<ll>(arr[k-1],H[k]); } for (int k=L[i];k<=R[i];k++) curr+=arr[k]; tot=min(tot,curr); } ans.emplace_back(tot); } return ans; }

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:8:8: warning: unused variable 'n' [-Wunused-variable]
    8 |     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...