Submission #413180

#TimeUsernameProblemLanguageResultExecution timeMemory
413180Ahmadsm2005Meetings (IOI18_meetings)C++14
0 / 100
366 ms381788 KiB
#include "meetings.h" //#include "grader.cpp" #include<bits/stdc++.h> using namespace std; vector<long long>LL,RR; vector<int>h; long long ACC[5001][5001],DP[5001][5001]; long long query(int L,int R){ long long miner=(int)2e18; for(int i=L;i<=R;i++){ //cout<<R<<' '<<i<<' '<<DP[R][i]<<endl; miner=min(miner,DP[L][i]+DP[R][i]-DP[i][i]); } return miner; } vector<long long>minimum_costs(vector<int>H,vector<int>L,vector<int>R){ h=H; vector<long long>ANS; for(int i=0;i<H.size();i++){ int maxer=0; for(int l=i;l<H.size();l++) maxer=max(maxer,H[l]),ACC[i][l]=maxer; } for(int i=0;i<H.size();i++){ long long CUR=0; for(int l=0;l<=i;l++) CUR+=ACC[l][i]; for(int l=0;l<H.size();l++) DP[l][i]=CUR,CUR-=ACC[l][i]; CUR=0; for(int l=i;l<H.size();l++) CUR+=ACC[i][l],DP[l][i]=CUR; } for(int i=0;i<L.size();i++) ANS.push_back(query(L[i],R[i])); 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:19:14: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   19 | for(int i=0;i<H.size();i++){
      |             ~^~~~~~~~~
meetings.cpp:21:14: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   21 | for(int l=i;l<H.size();l++)
      |             ~^~~~~~~~~
meetings.cpp:24:14: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   24 | for(int i=0;i<H.size();i++){
      |             ~^~~~~~~~~
meetings.cpp:28:14: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   28 | for(int l=0;l<H.size();l++)
      |             ~^~~~~~~~~
meetings.cpp:31:14: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   31 | for(int l=i;l<H.size();l++)
      |             ~^~~~~~~~~
meetings.cpp:34:14: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   34 | 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...