Submission #1109899

# Submission time Handle Problem Language Result Execution time Memory
1109899 2024-11-08T03:14:38 Z ozner77 Rice Hub (IOI11_ricehub) C++17
0 / 100
4 ms 1016 KB
#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

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 time Memory Grader output
1 Correct 1 ms 336 KB Output is correct
2 Incorrect 1 ms 336 KB Output isn't correct
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 336 KB Output is correct
2 Incorrect 1 ms 336 KB Output isn't correct
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 336 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 4 ms 1016 KB Output isn't correct
2 Halted 0 ms 0 KB -