Submission #1067850

#TimeUsernameProblemLanguageResultExecution timeMemory
1067850Muhammad_AneeqMeetings (IOI18_meetings)C++17
19 / 100
472 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; long long val[n][n]={}; for (int i=0;i<n;i++) { int mx=H[i]; val[i][i]=mx; for (int j=i-1;j>=0;j--) { mx=max(mx,H[j]); val[i][j]=mx; } mx=H[i]; for (int j=i+1;j<n;j++) { mx=max(mx,H[j]); val[i][j]=mx; } } long long pre[n][n+1]={}; for (int i=0;i<n;i++) for (int j=1;j<=n;j++) pre[i][j]=pre[i][j-1]+val[i][j-1]; for (int i=0;i<L.size();i++) { long long a=1e15; for (int j=L[i];j<=R[i];j++) { a=min(a,pre[j][R[i]+1]-pre[j][L[i]]); } ans.push_back(a); } 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:28:19: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   28 |     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...