Submission #1259581

#TimeUsernameProblemLanguageResultExecution timeMemory
1259581ewirlanWorm Worries (BOI18_worm)C++20
10 / 100
0 ms436 KiB
// #ifndef __SIZEOF_INT128__ #define __SIZEOF_INT128__ #endif #pragma GCC optimize("Ofast") #include <bits/stdc++.h> #include <ext/pb_ds/assoc_container.hpp> #include <ext/pb_ds/tree_policy.hpp> using namespace std; using namespace chrono; using namespace __gnu_pbds; template <typename T> using oset = tree<T, null_type, less_equal<T>, rb_tree_tag, tree_order_statistics_node_update>; #define rep(i, p, k) for(int i(p); i < (k); ++i) #define per(i, p, k) for(int i(p); i > (k); --i) #define sz(x) (int)(x).size() #define sc static_cast typedef long long ll; typedef long double ld; typedef unsigned int uint; typedef unsigned long long ull; typedef __int128_t lll; //#define int ll template <typename T = int> using par = std::pair <T, T>; #define fi first #define se second #define test int _number_of_tests(in()); while(_number_of_tests--) #define all(x) (x).begin(), (x).end() #define rall(x) (x).rbegin(), (x).rend() #define pb emplace_back struct Timer { string name{""}; time_point<high_resolution_clock> end, start{high_resolution_clock::now()}; duration<float, std::milli> dur; Timer() = default; Timer(string nm): name(nm) {} ~Timer() { end = high_resolution_clock::now(); dur= end - start; cout << "@" << name << "> " << dur.count() << " ms" << '\n'; } }; template <typename T = int> inline T in() { static T x; std::cin >> x; return x; } std::string yn(bool b) { if(b) return "YES\n"; else return "NO\n"; } template <typename F, typename S> std::ostream& operator<<(std::ostream& out, const std::pair <F, S>& par); template <typename T> std::ostream& operator<< (std::ostream& out, const std::vector <T>& wek) { for(const auto& i : wek)out << i << ' '; return out; } template <typename F, typename S> std::ostream& operator<<(std::ostream& out, const std::pair <F, S>& par) { out << '{'<<par.first<<", "<<par.second<<"}"; return out; } #define show(x) cerr << #x << " = " << x << '\n'; int w(int x){ cout << "? " << x << " 1 1" << endl; return in(); } std::int32_t main() { std::cout.tie(nullptr); //for luck std::cin.tie(nullptr); std::ios_base::sync_with_stdio(0); int n(in()), m(in()), k(in()), q(in()); if(m == k && k == 1){ int p(0), pv(0), k(n+1), kv(0), s(1 + n/2), sv(w(s)); while(s != p+1 || k != s+1){ int i; if(s - p < k - s)i = (k+s)/2; else i = (p+s)/2; int j(w(i)); if(i < s){ if(j < sv || (j == sv && k-i < s-p)){ p = i; pv = j; } else { k = s; kv = sv; s = i; sv = j; } } else{ if(j < sv || (j == sv && i-p < k-s)){ k = i; kv = j; } else{ p = s; pv = sv; s = i; sv = j; } } } cout << "! " << s << " 1 1" << endl; } return 0; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...