Submission #115424

#TimeUsernameProblemLanguageResultExecution timeMemory
115424dsjongMeetings (IOI18_meetings)C++14
19 / 100
695 ms398896 KiB
#include "meetings.h" #include <bits/stdc++.h> using namespace std; long long rsq[5005][5005]; vector<long long> minimum_costs(vector<int> H, vector<int> L, vector<int> R){ vector<long long>ret; int N=H.size(); memset(rsq,0,sizeof rsq); for(int i=0;i<N;i++){ int maxi=H[i]; rsq[i][i]=H[i]; for(int j=i-1;j>=0;j--){ maxi=max(maxi,H[j]); rsq[i][j]=rsq[i][j+1]+maxi; } maxi=H[i]; for(int j=i+1;j<N;j++){ maxi=max(maxi,H[j]); rsq[i][j]=rsq[i][j-1]+maxi; } } for(int q=0;q<L.size();q++){ int l=L[q],r=R[q]; long long res=LONG_LONG_MAX; for(int i=l;i<=r;i++){ res=min(res,rsq[i][l]+rsq[i][r]-H[i]); } ret.push_back(res); } return ret; }

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:22:15: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
  for(int q=0;q<L.size();q++){
              ~^~~~~~~~~
#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...