Submission #413199

#TimeUsernameProblemLanguageResultExecution timeMemory
413199Ahmadsm2005Meetings (IOI18_meetings)C++14
0 / 100
443 ms381716 KiB
#include "meetings.h" //#include "grader.cpp" #pragma GCC optimize("trapv") #include<bits/stdc++.h> using namespace std; vector<long long>LL,RR; 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){ 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<=i;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:18:14: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   18 | for(int i=0;i<H.size();i++){
      |             ~^~~~~~~~~
meetings.cpp:20:14: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   20 | for(int l=i;l<H.size();l++)
      |             ~^~~~~~~~~
meetings.cpp:23:14: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   23 | for(int i=0;i<H.size();i++){
      |             ~^~~~~~~~~
meetings.cpp:30:14: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   30 | for(int l=i;l<H.size();l++)
      |             ~^~~~~~~~~
meetings.cpp:33:14: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   33 | 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...