結果

問題 No.3011 あ、俺こいつの役やりたい!
ユーザー mie sakuranosaki
提出日時 2025-01-25 19:43:26
言語 C++23
(gcc 13.3.0 + boost 1.87.0)
結果
AC  
実行時間 31 ms / 2,000 ms
コード長 4,066 bytes
コンパイル時間 4,364 ms
コンパイル使用メモリ 237,088 KB
実行使用メモリ 25,984 KB
平均クエリ数 11.50
最終ジャッジ日時 2025-01-26 00:03:43
合計ジャッジ時間 8,039 ms
ジャッジサーバーID
(参考情報)
judge13 / judge7
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 44
権限があれば一括ダウンロードができます

ソースコード

diff #

#pragma region headers

#include <algorithm>
#include <bit>
#include <bitset>
#include <iomanip>
#include <iostream>
#include <map>
// #include <queue>
#include <set>
#include <string>
#include <unordered_map>
#include <unordered_set>
#include <vector>
// #include <sstream>

#include <cmath>
#include <functional>
// #include <numbers>
#include <numeric>
// #include <bit>
// #include <boost/multiprecision/cpp_dec_float.hpp>

#pragma endregion

#pragma region pre

#ifndef _MSC_VER

#pragma GCC target("avx2")
#pragma GCC optimize("O3")
#pragma GCC optimize("unroll-loops")

#endif


using namespace std;
using namespace std::literals;

#include <atcoder/all>
using namespace atcoder;

using ll  = long long;
using pll = pair<ll, ll>;
using str = std::string;

template<typename T>
using vec = std::vector<T>;

#define rep(i, n) for (int i = 0; i < static_cast<int>(n); i++)
#define reps(i, n, s) for (int i = static_cast<int>(s); i < static_cast<int>(n); i++)
#define all(x) std::begin(x), std::end(x)

template<typename T>
inline bool chmax(T& a, T b) {
	return ((a < b) ? (a = b, true) : (false));
}
template<typename T>
inline bool chmin(T& a, T b) {
	return ((a > b) ? (a = b, true) : (false));
}

int constexpr intmax = numeric_limits<int>().max();
int constexpr intmin = numeric_limits<int>().min();
ll constexpr llmax   = numeric_limits<ll>().max();
ll constexpr llmin   = numeric_limits<ll>().min();

std::ostream& operator<<(std::ostream& os, const atcoder::modint1000000007& obj) {
	return os << obj.val();
}

std::ostream& operator<<(std::ostream& os, const atcoder::modint998244353& obj) {
	return os << obj.val();
}

template<typename T, typename U>
std::ostream& operator<<(std::ostream& os, const pair<T, U>& obj) {
	return os << "(" << obj.first << ", " << obj.second << ")";
}

template<typename... Args>
void print(Args... args) {
	auto t = tie(args...);
	apply([](auto&&... args) { ((cout << args << ' '), ...); }, t);
	cout << '\n';
}

template<typename... Args>
void prints(Args... args) {
	auto t = tie(args...);
	apply([](auto&&... args) { ((cout << args << ' '), ...); }, t);
	cout << ' ';
}

template<typename T>
void printv(const T& container, int width = 3) {
	for (auto it = container.begin(); it != container.end(); ++it) {
		cout << setw(width - 1) << *it << " ";
	}
	cout << endl;
}

template<typename T>
void printv2(const T& container, int width = 3) {
	for (auto it = container.begin(); it != container.end(); ++it) {
		for (auto it2 = it->begin(); it2 != it->end(); ++it2) {
			cout << setw(width - 1) << *it2 << " ";
		}
		cout << endl;
	}
}

template<typename T>
void printv3(const T& container, int width = 3) {
	for (auto it = container.begin(); it != container.end(); ++it) {
		for (auto it2 = it->begin(); it2 != it->end(); ++it2) {
			for (auto it3 = it->begin(); it3 != it->end(); ++it3) {
				cout << setw(width - 1) << *it3 << " ";
			}
			cout << endl;
		}
		cout << endl
			 << endl;
	}
}

template<typename T>
std::vector<T> create_vec(const T& value, size_t size) {
	return std::vector<T>(size, value);
}

template<typename T, typename... Dims>
auto create_vec(const T& value, size_t first, Dims... dims) {
	return std::vector<decltype(create_vec<T>(value, dims...))>(first, create_vec(value, dims...));
}

void yesno(bool cond) {
	cout << (cond ? "Yes" : "No") << endl;
}

void init_io() {
	std::ios_base::sync_with_stdio(false);
	std::cin.tie(nullptr);
	cout << std::setprecision(24);
}

#pragma endregion

#include <random>
std::random_device seed_gen;
std::mt19937 engine(seed_gen());

ll getRandom(ll min, ll max) { // [min ... max]
	std::uniform_int_distribution<ll> dist(min, max);
	return dist(engine);
}

class Solution {
public:
	using mint = modint998244353;
	// using mint = atcoder::modint1000000007;

	void run() {
		ll n;

		ll l = 0;
		ll r = 1000000000;

		while (r - l > 1) {
			ll mid = l + (r - l) / 2;
			cout << mid << endl;
			ll result;
			cin >> result;
			if (result == 0) {
				r = mid;
			}
			else {
				return;
			}
		}
	}
};

int main() {
	init_io();
	Solution().run();
	return 0;
}
0