Submission #626298

#TimeUsernameProblemLanguageResultExecution timeMemory
626298sword060Radio Towers (IOI22_towers)C++17
0 / 100
4086 ms1444 KiB
#include <bits/stdc++.h> #include "towers.h" using namespace std; int a[100005]; void init(int N,vector<int> H){ for(int i=0;i<H.size();i++)a[i]=H[i]; } int max_towers(int L, int R, int D){ int ret=1; for(int i=L+1;i<R;i++){ int c1=0,c2=0; for(int j=i-1;j>=L;j--){ if(abs(a[i]-a[j])>D)break; c1++; } for(int j=i+1;j<=R;j++){ if(abs(a[i]-a[j])>D)break; c2++; } ret=max(ret,c1+c2); } return ret; }

Compilation message (stderr)

towers.cpp: In function 'void init(int, std::vector<int>)':
towers.cpp:6:15: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
    6 |  for(int i=0;i<H.size();i++)a[i]=H[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...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...