Submission #1261249

#TimeUsernameProblemLanguageResultExecution timeMemory
1261249Zbyszek99Worm Worries (BOI18_worm)C++20
Compilation error
0 ms0 KiB
#include <bits/stdc++.h> #include <ext/pb_ds/assoc_container.hpp> #include <ext/pb_ds/tree_policy.hpp> #define ll long long #define ld long double #define ull unsigned long long #define ff first #define ss second #define pii pair<int,int> #define pll pair<long long, long long> #define vi vector<int> #define vl vector<long long> #define pb push_back #define rep(i, b) for(int i = 0; i < (b); ++i) #define rep2(i,a,b) for(int i = a; i <= (b); ++i) #define rep3(i,a,b,c) for(int i = a; i <= (b); i+=c) #define count_bits(x) __builtin_popcountll((x)) #define all(x) (x).begin(),(x).end() #define siz(x) (int)(x).size() #define forall(it,x) for(auto& it:(x)) using namespace __gnu_pbds; using namespace std; typedef tree<int, null_type, less<int>, rb_tree_tag,tree_order_statistics_node_update> ordered_set; mt19937 mt;void random_start(){mt.seed(chrono::time_point_cast<chrono::milliseconds>(chrono::high_resolution_clock::now()).time_since_epoch().count());} ll los(ll a, ll b) {return a + (mt() % (b-a+1));} const int INF = 1e9+50; const ll INF_L = 1e18+40; const ll MOD = 1e9+7; ld c = (3-(ld)sqrt(5))/(ld)2; ll n,m,k,q; map<ll,int> query_map; int ask(int x) { int y = 1; int z = 1; if(x < 1 || x > n || y < 1 || y > m || z < 1 || z > k) return 0; int h = x-1 + (y-1)*n + (z-1)*n*m; if(query_map.find(h) != query_map.end()) return query_map[h]; cout << "? " << x << " " << y << " " << z << endl; cin >> query_map[h]; return query_map[h]; } void solve(int l, int r, int q1, int q2) { if(q1 == q2) { q1++; if(q1 > r) q1-=2; } if(q1 > q2) swap(q1,q2); if(r-l+1 <= 2) { rep2(i,l,r) { if(ask(i) >= ask(i-1) && ask(i) >= ask(i+1)) { cout << "! " << i << " 1 1\n"; return; } } } int v1 = ask(q1); int v2 = ask(q2); if(v1 > v2) { solve(l,q2-1,q1,l+(ld)(r-l+1)*c); } else { solve(q1+1,r,q2,min(r,r-(ld)(r-l+1)*c+1)); } } int main() { cin >> n >> m >> k >> q; ll l = (ld)n*c; ll r = min((ld)n,n-(ld)n*c+1); // cout << l << " " << r << " " << (ld)n*c << " " << c << " lr\n"; solve(1,n,l,r); };

Compilation message (stderr)

worm.cpp: In function 'void solve(int, int, int, int)':
worm.cpp:74:28: error: no matching function for call to 'min(int&, long double)'
   74 |         solve(q1+1,r,q2,min(r,r-(ld)(r-l+1)*c+1));
      |                         ~~~^~~~~~~~~~~~~~~~~~~~~
In file included from /usr/include/c++/11/bits/specfun.h:45,
                 from /usr/include/c++/11/cmath:1935,
                 from /usr/include/x86_64-linux-gnu/c++/11/bits/stdc++.h:41,
                 from worm.cpp:1:
/usr/include/c++/11/bits/stl_algobase.h:230:5: note: candidate: 'template<class _Tp> constexpr const _Tp& std::min(const _Tp&, const _Tp&)'
  230 |     min(const _Tp& __a, const _Tp& __b)
      |     ^~~
/usr/include/c++/11/bits/stl_algobase.h:230:5: note:   template argument deduction/substitution failed:
worm.cpp:74:28: note:   deduced conflicting types for parameter 'const _Tp' ('int' and 'long double')
   74 |         solve(q1+1,r,q2,min(r,r-(ld)(r-l+1)*c+1));
      |                         ~~~^~~~~~~~~~~~~~~~~~~~~
In file included from /usr/include/c++/11/bits/specfun.h:45,
                 from /usr/include/c++/11/cmath:1935,
                 from /usr/include/x86_64-linux-gnu/c++/11/bits/stdc++.h:41,
                 from worm.cpp:1:
/usr/include/c++/11/bits/stl_algobase.h:278:5: note: candidate: 'template<class _Tp, class _Compare> constexpr const _Tp& std::min(const _Tp&, const _Tp&, _Compare)'
  278 |     min(const _Tp& __a, const _Tp& __b, _Compare __comp)
      |     ^~~
/usr/include/c++/11/bits/stl_algobase.h:278:5: note:   template argument deduction/substitution failed:
worm.cpp:74:28: note:   deduced conflicting types for parameter 'const _Tp' ('int' and 'long double')
   74 |         solve(q1+1,r,q2,min(r,r-(ld)(r-l+1)*c+1));
      |                         ~~~^~~~~~~~~~~~~~~~~~~~~
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/istream:38,
                 from /usr/include/c++/11/sstream:38,
                 from /usr/include/c++/11/complex:45,
                 from /usr/include/c++/11/ccomplex:39,
                 from /usr/include/x86_64-linux-gnu/c++/11/bits/stdc++.h:54,
                 from worm.cpp:1:
/usr/include/c++/11/bits/stl_algo.h:3449:5: note: candidate: 'template<class _Tp> constexpr _Tp std::min(std::initializer_list<_Tp>)'
 3449 |     min(initializer_list<_Tp> __l)
      |     ^~~
/usr/include/c++/11/bits/stl_algo.h:3449:5: note:   template argument deduction/substitution failed:
worm.cpp:74:28: note:   mismatched types 'std::initializer_list<_Tp>' and 'int'
   74 |         solve(q1+1,r,q2,min(r,r-(ld)(r-l+1)*c+1));
      |                         ~~~^~~~~~~~~~~~~~~~~~~~~
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/istream:38,
                 from /usr/include/c++/11/sstream:38,
                 from /usr/include/c++/11/complex:45,
                 from /usr/include/c++/11/ccomplex:39,
                 from /usr/include/x86_64-linux-gnu/c++/11/bits/stdc++.h:54,
                 from worm.cpp:1:
/usr/include/c++/11/bits/stl_algo.h:3455:5: note: candidate: 'template<class _Tp, class _Compare> constexpr _Tp std::min(std::initializer_list<_Tp>, _Compare)'
 3455 |     min(initializer_list<_Tp> __l, _Compare __comp)
      |     ^~~
/usr/include/c++/11/bits/stl_algo.h:3455:5: note:   template argument deduction/substitution failed:
worm.cpp:74:28: note:   mismatched types 'std::initializer_list<_Tp>' and 'int'
   74 |         solve(q1+1,r,q2,min(r,r-(ld)(r-l+1)*c+1));
      |                         ~~~^~~~~~~~~~~~~~~~~~~~~