Submission #676281

#TimeUTC-0UsernameProblemLanguageResultExecution timeMemory
6762812022-12-30 05:23:56ToxtaqBigger segments (IZhO19_segments)C++17
0 / 100
0 ms212 KiB
#include <bits/stdc++.h>
using namespace std;
long long check(int mid, vector<long long>&v, vector<long long>&suff){
long long temp = 0, prev = -1, indx = 0, result = 0;
while(temp < mid)temp += v[indx++];
prev = temp;
temp = 0;
if(prev < mid)return 0;
result++;
for(int i = indx;i < v.size();++i){
temp += v[i];
if(prev <= temp){
if(i != v.size() - 1 && suff[i + 1] < temp){
return result + 1;
}
else{
result++;
prev = temp;
temp = 0;
}
}
}
return result;
}
int main()
{
int n;
cin >> n;
vector<long long>v(n), suff(n), pref(n);
for(int i = 0;i < n;++i)cin >> v[i];
 
הההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההה
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX

Compilation message (stderr)

segments.cpp: In function 'long long int check(int, std::vector<long long int>&, std::vector<long long int>&)':
segments.cpp:10:24: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<long long int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   10 |     for(int i = indx;i < v.size();++i){
      |                      ~~^~~~~~~~~~
segments.cpp:13:18: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<long long int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   13 |             if(i != v.size() - 1 && suff[i + 1] < temp){
      |                ~~^~~~~~~~~~~~~~~
#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...