Submission #1137658

#TimeUsernameProblemLanguageResultExecution timeMemory
1137658ghammazhassanCOVID tests (CEOI24_covid)C++20
Compilation error
0 ms0 KiB
// #include <bits/stdc++.h> #include <iostream> #include <cmath> #include <algorithm> #include <map> #include <vector> #include <iomanip> #include <string> #include <queue> #include <set> using namespace std; #define int long long #define endl "\n"; const int N=2e5+5; const int M=1e9+7; int n; double p; void solve2() { string s,r; for (int i=0;i<n;i++){ s+='0'; r+='0'; } for (int i=0;i<n;i++){ s[i]='1'; cout << "Q " << s << endl; char u; cin >> u; if (u=='P'){ r[i]='1'; } s[i]='0'; } cout << "A " << r << endl; char e; cin >> e; if (e=='C'){ return; } else{ exit(0); } } void solve() { string s,w; for (int i=0;i<n;i++){ s+='0'; w+='1'; } int co=max((1/p)/4,(double)1); int l=0,r=min(co,n-1); while (l<n){ for (int i=l;i<=r;i++){ s[i]='1'; } cout << "Q "+s << endl; char k; cin >> k; for (int i=l;i<=r;i++){ s[i]='0'; } if (k=='N'){ for (int i=l;i<=r;i++){ w[i]='0'; } l=r+1; r=min(l+co,n-1); } else{ if (l!=r){ r=(l+r)/max(co,2); } else{ l=r+1; r=min(l+co,n-1); } } } cout << "A " << w << endl; char e; cin >> e; if (e=='C'){ return; } else{ exit(0); } } signed main() { cout << fixed<<setprecision(9); int t=1; cin >> n >> p >> t; if (t==1){ solve2(); return 0; } for (int _=1;_<=t;_++){ solve(); } }

Compilation message (stderr)

Main.cpp: In function 'void solve()':
Main.cpp:73:44: error: no matching function for call to 'max(long long int&, int)'
   73 |                                 r=(l+r)/max(co,2);
      |                                         ~~~^~~~~~
In file included from /usr/include/c++/11/bits/char_traits.h:39,
                 from /usr/include/c++/11/ios:40,
                 from /usr/include/c++/11/ostream:38,
                 from /usr/include/c++/11/iostream:39,
                 from Main.cpp:2:
/usr/include/c++/11/bits/stl_algobase.h:254:5: note: candidate: 'template<class _Tp> constexpr const _Tp& std::max(const _Tp&, const _Tp&)'
  254 |     max(const _Tp& __a, const _Tp& __b)
      |     ^~~
/usr/include/c++/11/bits/stl_algobase.h:254:5: note:   template argument deduction/substitution failed:
Main.cpp:73:44: note:   deduced conflicting types for parameter 'const _Tp' ('long long int' and 'int')
   73 |                                 r=(l+r)/max(co,2);
      |                                         ~~~^~~~~~
In file included from /usr/include/c++/11/bits/char_traits.h:39,
                 from /usr/include/c++/11/ios:40,
                 from /usr/include/c++/11/ostream:38,
                 from /usr/include/c++/11/iostream:39,
                 from Main.cpp:2:
/usr/include/c++/11/bits/stl_algobase.h:300:5: note: candidate: 'template<class _Tp, class _Compare> constexpr const _Tp& std::max(const _Tp&, const _Tp&, _Compare)'
  300 |     max(const _Tp& __a, const _Tp& __b, _Compare __comp)
      |     ^~~
/usr/include/c++/11/bits/stl_algobase.h:300:5: note:   template argument deduction/substitution failed:
Main.cpp:73:44: note:   deduced conflicting types for parameter 'const _Tp' ('long long int' and 'int')
   73 |                                 r=(l+r)/max(co,2);
      |                                         ~~~^~~~~~
In file included from /usr/include/c++/11/string:52,
                 from /usr/include/c++/11/bits/locale_classes.h:40,
                 from /usr/include/c++/11/bits/ios_base.h:41,
                 from /usr/include/c++/11/ios:42,
                 from /usr/include/c++/11/ostream:38,
                 from /usr/include/c++/11/iostream:39,
                 from Main.cpp:2:
/usr/include/c++/11/bits/stl_algo.h:3461:5: note: candidate: 'template<class _Tp> constexpr _Tp std::max(std::initializer_list<_Tp>)'
 3461 |     max(initializer_list<_Tp> __l)
      |     ^~~
/usr/include/c++/11/bits/stl_algo.h:3461:5: note:   template argument deduction/substitution failed:
Main.cpp:73:44: note:   mismatched types 'std::initializer_list<_Tp>' and 'long long int'
   73 |                                 r=(l+r)/max(co,2);
      |                                         ~~~^~~~~~
In file included from /usr/include/c++/11/string:52,
                 from /usr/include/c++/11/bits/locale_classes.h:40,
                 from /usr/include/c++/11/bits/ios_base.h:41,
                 from /usr/include/c++/11/ios:42,
                 from /usr/include/c++/11/ostream:38,
                 from /usr/include/c++/11/iostream:39,
                 from Main.cpp:2:
/usr/include/c++/11/bits/stl_algo.h:3467:5: note: candidate: 'template<class _Tp, class _Compare> constexpr _Tp std::max(std::initializer_list<_Tp>, _Compare)'
 3467 |     max(initializer_list<_Tp> __l, _Compare __comp)
      |     ^~~
/usr/include/c++/11/bits/stl_algo.h:3467:5: note:   template argument deduction/substitution failed:
Main.cpp:73:44: note:   mismatched types 'std::initializer_list<_Tp>' and 'long long int'
   73 |                                 r=(l+r)/max(co,2);
      |                                         ~~~^~~~~~