Submission #412877

#TimeUsernameProblemLanguageResultExecution timeMemory
412877Ahmadsm2005Meetings (IOI18_meetings)C++14
0 / 100
22 ms5332 KiB
#include "meetings.h" //#include "grader.cpp" #include<bits/stdc++.h> using namespace std; int sparse[750001][21],LOG[750001]; int query(int L,int R){ int Q=LOG[R-L+1]; return max(sparse[L][Q],sparse[R-(1<<Q)+1][Q]); } vector<long long>minimum_costs(vector<int>H,vector<int>L,vector<int>R){ vector<long long>ANS; LOG[1]=0; for(int i=2;i<=750000;i++) LOG[i]=LOG[i/2]; sparse[0][0]=((H[0]==1)?1:0); for(int i=1;i<H.size();i++) sparse[i][0]=((H[0]==1)?sparse[i][0]+1:0); for(int l=1;l<21;l++){ for(int i=0;i+(1<<(l-1))<H.size();i++){ sparse[i][l]=max(sparse[i][l-1],sparse[i+(1<<(l-1))][l-1]); } } for(int i=0;i<L.size();i++) ANS.push_back((R[i]-L[i]+1)*2-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:16:14: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   16 | for(int i=1;i<H.size();i++)
      |             ~^~~~~~~~~
meetings.cpp:19:25: 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+(1<<(l-1))<H.size();i++){
      |             ~~~~~~~~~~~~^~~~~~~~~
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<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...