結果

問題 No.2357 Guess the Function
ユーザー ninesnines
提出日時 2023-06-23 21:51:46
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
TLE  
実行時間 -
コード長 1,858 bytes
コンパイル時間 13,324 ms
コンパイル使用メモリ 455,092 KB
実行使用メモリ 35,928 KB
最終ジャッジ日時 2023-09-13 16:52:18
合計ジャッジ時間 18,223 ms
ジャッジサーバーID
(参考情報)
judge12 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 TLE -
testcase_01 -- -
testcase_02 -- -
testcase_03 -- -
testcase_04 -- -
testcase_05 -- -
testcase_06 -- -
testcase_07 -- -
testcase_08 -- -
testcase_09 -- -
testcase_10 -- -
権限があれば一括ダウンロードができます

ソースコード

diff #

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

#include <bits/stdc++.h>
using namespace std;

#include <atcoder/all>
using namespace atcoder;

#include <boost/multiprecision/cpp_int.hpp>
namespace mp = boost::multiprecision;
using Bint = mp::cpp_int;

typedef long long ll;
const ll INF = 1e18;

#define rep(i, n) for (ll i = 0; i < (ll)(n); i++)
#define rep2(i, s, n) for (ll i = (s); i < (ll)(n); i++)
#define all(v) v.begin(), v.end()
#define llpow(x, y) (ll) pow(x, y)
#define llacumulate(v) accumulate(all(v), 0LL)
#define endl "\n"

struct Fast
{
    Fast()
    {
        std::cin.tie(0);
        ios::sync_with_stdio(false);
        cout << fixed << setprecision(15);
    }
} fast;

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

#ifdef LOCAL
#include <library/debug_print.hpp>
#define debug(...) debug_print::multi_print(#__VA_ARGS__, __VA_ARGS__)
#else
#define debug(...) (static_cast<void>(0))
#endif

int main()
{
    ll cnt = 0, point = -1, a, b, before = -1;
    while (true)
    {
        cout << "? " << cnt << endl;
        ll t;
        cin >> t;
        if (t == 0)
        {
            if (point == -1)
                point = cnt;
            else
            {
                if (before == -1)
                {
                    point = -1;
                    continue;
                }
                else
                {
                    a = before;
                    b = cnt - point;
                    break;
                }
            }
        }
        cnt++;
        before = t;
    }
    cout << "! " << a << " " << b << endl;
}
0