Submission #1109899

#TimeUsernameProblemLanguageResultExecution timeMemory
1109899ozner77Rice Hub (IOI11_ricehub)C++17
0 / 100
4 ms1016 KiB
#include <bits/stdc++.h> using namespace std; int besthub(int R,int L,int X[],long long B){ vector<int> V(L+1,0); long long ans=0; long long res=1; for(int i=0;i<R;i++){ V[X[i]]++; } for(int i=1;i<=B;i++){ ans+=V[i]; } long long maxsum=ans; for(int i=B+1;i<=L;i++){ ans-=V[i-B]; ans+=V[i]; if(ans>maxsum){ res=i; maxsum=ans; } } return maxsum; }

Compilation message (stderr)

ricehub.cpp: In function 'int besthub(int, int, int*, long long int)':
ricehub.cpp:6:15: warning: variable 'res' set but not used [-Wunused-but-set-variable]
    6 |     long long res=1;
      |               ^~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...