結果

問題 No.2753 鳩の巣原理
ユーザー aradarad
提出日時 2024-05-10 22:47:32
言語 C++23
(gcc 12.3.0 + boost 1.83.0)
結果
WA  
実行時間 -
コード長 1,371 bytes
コンパイル時間 5,297 ms
コンパイル使用メモリ 314,832 KB
実行使用メモリ 25,836 KB
平均クエリ数 7.90
最終ジャッジ日時 2024-05-10 22:47:43
合計ジャッジ時間 10,504 ms
ジャッジサーバーID
(参考情報)
judge5 / judge4
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 WA -
testcase_01 WA -
testcase_02 WA -
testcase_03 WA -
testcase_04 WA -
testcase_05 WA -
testcase_06 WA -
testcase_07 WA -
testcase_08 WA -
testcase_09 WA -
testcase_10 WA -
testcase_11 WA -
testcase_12 WA -
testcase_13 WA -
testcase_14 WA -
testcase_15 WA -
testcase_16 WA -
testcase_17 WA -
testcase_18 WA -
testcase_19 WA -
testcase_20 WA -
testcase_21 AC 25 ms
24,812 KB
testcase_22 AC 25 ms
25,196 KB
testcase_23 AC 25 ms
25,196 KB
testcase_24 AC 24 ms
24,556 KB
testcase_25 AC 24 ms
25,580 KB
testcase_26 AC 24 ms
24,812 KB
testcase_27 AC 24 ms
25,196 KB
testcase_28 AC 24 ms
24,556 KB
testcase_29 WA -
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
using namespace std;
#include <atcoder/all>
using namespace atcoder;
using ll = long long;
using VI = vector<int>;
using VVI = vector<VI>;
using VL = vector<ll>;
using VVL = vector<VL>;
using VD = vector<double>;
using VVD = vector<VD>;
using VS = vector<string>;
using P = pair<ll,ll>;
using VP = vector<P>;
#define rep(i, n) for (ll i = 0; i < ll(n); i++)
#define out(x) cout << x << endl
#define dout(x) cout << fixed << setprecision(10) << x << endl
#define all(a) (a).begin(),(a).end()
#define rall(a) (a).rbegin(),(a).rend()
#define sz(x) (int)(x.size())
#define re0 return 0
#define pcnt __builtin_popcountll
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
constexpr int inf = 1e9;
constexpr ll INF = 1e18;
//using mint = modint1000000007;
using mint = modint998244353;
int di[4] = {1,0,-1,0};
int dj[4] = {0,1,0,-1};

int main(){
    ll n;
    cin >> n;
    ll ok = 0,ng = n+1;
    map<ll,ll> mp;
    mp[0] = 0;
    mp[n+1] = n+1;
    while(abs(ok-ng)>1){
        ll mid = (ok+ng)/2;
        cout << "? " << mid << endl;
        ll r;
        cin >> r;
        mp[mid] = r;
        if(mp[mid]-mp[ok] >= mid-ok) ok = mid;
        else ng = mid;
    }
    cout << "Yes " << ok << ' ' << ok+1 << endl;
}
0