Submission #985535

#TimeUsernameProblemLanguageResultExecution timeMemory
985535ag_1204Cyberland (APIO23_cyberland)C++17
Compilation error
0 ms0 KiB
#include<bits/stdc++.h> using namespace std; void balance(multiset<int> s, multiset<int> t) { while (s.size() > t.size() + 1) { t.insert(*s.rbegin()); s.erase(prev(s.end())); } while (t.size() > s.size()) { s.insert(*t.begin()); t.erase(t.begin()); } } int sequence(int N, std::vector<int> A) { int ans=0; for (int i=0;i<N;i++) { map<int,int> m; multiset<int> low, high; for (int j=i;j<N;j++) { if (low.empty() || A[j]<=*low.rbegin()) { low.insert(A[j]); } else { high.insert(A[j]); } balance(low,high); m[A[j]]++; int m1 = *low.rbegin(); int m2 = (low.size()+high.size())%2==0?*high.begin():m1; int occ1 = m[m1], occ2=m[m2]; ans = max(ans,(max(m1,m2))); } } return ans; }

Compilation message (stderr)

cyberland.cpp: In function 'int sequence(int, std::vector<int>)':
cyberland.cpp:30:17: warning: unused variable 'occ1' [-Wunused-variable]
   30 |             int occ1 = m[m1], occ2=m[m2];
      |                 ^~~~
cyberland.cpp:30:31: warning: unused variable 'occ2' [-Wunused-variable]
   30 |             int occ1 = m[m1], occ2=m[m2];
      |                               ^~~~
/usr/bin/ld: /tmp/ccihmtrm.o: in function `main':
grader.cpp:(.text.startup+0x696): undefined reference to `solve(int, int, int, int, std::vector<int, std::allocator<int> >, std::vector<int, std::allocator<int> >, std::vector<int, std::allocator<int> >, std::vector<int, std::allocator<int> >)'
collect2: error: ld returned 1 exit status