Submission #359286

#TimeUsernameProblemLanguageResultExecution timeMemory
359286mohamedsobhi777Languages (IOI10_languages)C++14
Compilation error
0 ms0 KiB
#include <bits/stdc++.h> #include "lang.h" #include "grader.h" using namespace std; const int Lang = 56; int lang[Lang + 1][66000]; int ref[Lang + 1][66000]; int *glo; int freq[66000]; set<int> sit[66000]; long long calc(int lan) { for (int i = 0; i < 100; ++i) freq[glo[i]] = 0; long long ret = 0; for (int i = 0; i < 100; ++i) { if (int(sit[glo[i]].size()) > 30) continue; if (ref[lan][glo[i]] < 5) continue; ret += ++freq[glo[i]] * lang[lan][glo[i]]; } return ret; } void excerpt(int *ex) { glo = ex; long long simi = 0; int wnr = 0; for (int i = 0; i < Lang; ++i) { double y = calc(i); if (y > simi) { simi = y; wnr = i; } } int z = language(wnr); for (int i = 0; i < 100; ++i) { // lang[z][ex[i]]++; lang[z][ex[i]] = min(lang[z][ex[i]] + 1, 15); ref[z][ex[i]]++; sit[ex[i]].insert(z); } }

Compilation message (stderr)

lang.cpp: In function 'long long int calc(int)':
lang.cpp:24:19: error: reference to 'ref' is ambiguous
   24 |               if (ref[lan][glo[i]] < 5)
      |                   ^~~
In file included from /usr/include/c++/9/functional:58,
                 from /usr/include/x86_64-linux-gnu/c++/9/bits/stdc++.h:71,
                 from lang.cpp:1:
/usr/include/c++/9/bits/refwrap.h:370:5: note: candidates are: 'template<class _Tp> std::reference_wrapper<_Tp> std::ref(std::reference_wrapper<_Tp>)'
  370 |     ref(reference_wrapper<_Tp> __t) noexcept
      |     ^~~
/usr/include/c++/9/bits/refwrap.h:362:10: note:                 'template<class _Tp> void std::ref(const _Tp&&)'
  362 |     void ref(const _Tp&&) = delete;
      |          ^~~
/usr/include/c++/9/bits/refwrap.h:352:5: note:                 'template<class _Tp> std::reference_wrapper<_Tp> std::ref(_Tp&)'
  352 |     ref(_Tp& __t) noexcept
      |     ^~~
lang.cpp:10:5: note:                 'int ref [57][66000]'
   10 | int ref[Lang + 1][66000];
      |     ^~~
lang.cpp: In function 'void excerpt(int*)':
lang.cpp:50:15: error: reference to 'ref' is ambiguous
   50 |               ref[z][ex[i]]++;
      |               ^~~
In file included from /usr/include/c++/9/functional:58,
                 from /usr/include/x86_64-linux-gnu/c++/9/bits/stdc++.h:71,
                 from lang.cpp:1:
/usr/include/c++/9/bits/refwrap.h:370:5: note: candidates are: 'template<class _Tp> std::reference_wrapper<_Tp> std::ref(std::reference_wrapper<_Tp>)'
  370 |     ref(reference_wrapper<_Tp> __t) noexcept
      |     ^~~
/usr/include/c++/9/bits/refwrap.h:362:10: note:                 'template<class _Tp> void std::ref(const _Tp&&)'
  362 |     void ref(const _Tp&&) = delete;
      |          ^~~
/usr/include/c++/9/bits/refwrap.h:352:5: note:                 'template<class _Tp> std::reference_wrapper<_Tp> std::ref(_Tp&)'
  352 |     ref(_Tp& __t) noexcept
      |     ^~~
lang.cpp:10:5: note:                 'int ref [57][66000]'
   10 | int ref[Lang + 1][66000];
      |     ^~~