Submission #1067857

#TimeUsernameProblemLanguageResultExecution timeMemory
1067857Muhammad_AneeqMeetings (IOI18_meetings)C++17
19 / 100
1510 ms786432 KiB
#include <vector> using namespace std; vector<long long> minimum_costs(vector<int> H, vector<int> L,vector<int> R) { int n=H.size(); vector<long long>ans(L.size(),1e15); vector<int>qu[n]={}; for (int i=0;i<L.size();i++) { for (int j=L[i];j<=R[i];j++) qu[j].push_back(i); } int val[n]={}; long long pre[n+1]={}; for (int i=0;i<n;i++) { if (qu[i].size()==0) continue; int mx=H[i]; val[i]=mx; for (int j=i-1;j>=0;j--) { mx=max(mx,H[j]); val[j]=mx; } mx=H[i]; for (int j=i+1;j<n;j++) { mx=max(mx,H[j]); val[j]=mx; } for (int j=1;j<=n;j++) pre[j]=pre[j-1]+val[j-1]; for (auto j:qu[i]) ans[j]=min(ans[j],pre[R[j]+1]-pre[L[j]]); } 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:19: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
    8 |     for (int i=0;i<L.size();i++)
      |                  ~^~~~~~~~~
#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...