Submission #409895

#TimeUsernameProblemLanguageResultExecution timeMemory
409895Dan4LifeRice Hub (IOI11_ricehub)C++17
Compilation error
0 ms0 KiB
#include "grader.c" #include <bits/stdc++.h> using namespace std; #define ll long long int besthub(int n, int m, int a[], ll k) { ll ans = 0; for(int i = 0; i < n; i++){ multiset<int> S; S.clear(); for(int j = 0; j < n; j++) S.insert(abs(a[i]-a[j])); ll K = k, cnt = 0; while(!S.empty() and K>=(*S.begin())) cnt++, K-=(*S.begin()), S.erase(S.begin()); if(ans<cnt)ans=cnt; } return ans; } int main() { ll n, m, a[100], k; cin >> n >> m >> k; for(int i = 0; i < n; i++) cin >> a[i]; cout << besthub(n,m,a,k); }

Compilation message (stderr)

ricehub.cpp:21:5: error: redefinition of 'int main()'
   21 | int main() {
      |     ^~~~
In file included from ricehub.cpp:1:
grader.c:24:5: note: 'int main()' previously defined here
   24 | int main()
      |     ^~~~
ricehub.cpp: In function 'int main()':
ricehub.cpp:24:22: error: cannot convert 'long long int*' to 'int*'
   24 |  cout << besthub(n,m,a,k);
      |                      ^
      |                      |
      |                      long long int*
ricehub.cpp:6:31: note:   initializing argument 3 of 'int besthub(int, int, int*, long long int)'
    6 | int besthub(int n, int m, int a[], ll k)
      |                           ~~~~^~~