結果
問題 | No.2753 鳩の巣原理 |
ユーザー | GOTKAKO |
提出日時 | 2024-05-10 21:53:22 |
言語 | C++17 (gcc 12.3.0 + boost 1.83.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 2,335 bytes |
コンパイル時間 | 1,829 ms |
コンパイル使用メモリ | 201,412 KB |
実行使用メモリ | 25,464 KB |
平均クエリ数 | 11.00 |
最終ジャッジ日時 | 2024-05-10 21:53:45 |
合計ジャッジ時間 | 5,178 ms |
ジャッジサーバーID (参考情報) |
judge3 / judge5 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 23 ms
25,220 KB |
testcase_01 | WA | - |
testcase_02 | AC | 24 ms
25,220 KB |
testcase_03 | WA | - |
testcase_04 | AC | 20 ms
24,836 KB |
testcase_05 | AC | 20 ms
24,844 KB |
testcase_06 | WA | - |
testcase_07 | WA | - |
testcase_08 | AC | 20 ms
24,796 KB |
testcase_09 | AC | 20 ms
24,940 KB |
testcase_10 | AC | 22 ms
25,196 KB |
testcase_11 | AC | 20 ms
24,940 KB |
testcase_12 | AC | 20 ms
24,940 KB |
testcase_13 | AC | 20 ms
25,184 KB |
testcase_14 | WA | - |
testcase_15 | WA | - |
testcase_16 | AC | 20 ms
25,196 KB |
testcase_17 | WA | - |
testcase_18 | AC | 20 ms
24,556 KB |
testcase_19 | AC | 21 ms
24,812 KB |
testcase_20 | AC | 19 ms
25,452 KB |
testcase_21 | AC | 19 ms
24,812 KB |
testcase_22 | WA | - |
testcase_23 | WA | - |
testcase_24 | AC | 23 ms
24,812 KB |
testcase_25 | WA | - |
testcase_26 | WA | - |
testcase_27 | WA | - |
testcase_28 | AC | 20 ms
25,184 KB |
testcase_29 | AC | 21 ms
24,556 KB |
コンパイルメッセージ
main.cpp: In function 'int main()': main.cpp:76:51: warning: 'ans2' may be used uninitialized [-Wmaybe-uninitialized] 76 | cout << "Yes" << " " << ans1+1 << " " << ans2+1 << endl; | ^ main.cpp:61:29: note: 'ans2' was declared here 61 | int turn = 0,L = 0,ans1,ans2; | ^~~~ main.cpp:76:39: warning: 'ans1' may be used uninitialized [-Wmaybe-uninitialized] 76 | cout << "Yes" << " " << ans1+1 << " " << ans2+1 << endl; | ^~~ main.cpp:61:24: note: 'ans1' was declared here 61 | int turn = 0,L = 0,ans1,ans2; | ^~~~
ソースコード
#include <bits/stdc++.h> using namespace std; long long mod = 998244353; //入力が必ずmod未満の時に使う. struct mint{ long long v = 0; mint(){} mint(int a){v = a;} mint(long long a){v = a;} mint(unsigned long long a){v = a;} long long val(){return v;} void modu(){v %= mod;} mint repeat2mint(const long long a,long long b){ mint ret = 1,p = a; while(b){ if(b&1) ret *= p; p *= p; b >>= 1; } return ret; }; mint operator+(const mint b){return mint(v)+=b;} mint operator-(const mint b){return mint(v)-=b;} mint operator*(const mint b){return mint(v)*=b;} mint operator/(const mint b){return mint(v)/=b;} mint operator+=(const mint b){ v += b.v; if(v >= mod) v -= mod; return *this; } mint operator-=(const mint b){ v -= b.v; if(v < 0) v += mod; return *this; } mint operator*=(const mint b){v = v*b.v%mod; return *this;} mint operator/=(mint b){ if(b == 0) assert(false); int left = mod-2; while(left){if(left&1) *this *= b; b *= b; left >>= 1;} return *this; } mint operator++(int){*this += 1; return *this;} mint operator--(int){*this -= 1; return *this;} bool operator==(const mint b){return v == b.v;} bool operator!=(const mint b){return v != b.v;} bool operator>(const mint b){return v > b.v;} bool operator>=(const mint b){return v >= b.v;} bool operator<(const mint b){return v < b.v;} bool operator<=(const mint b){return v <= b.v;} mint pow(const long long x){return repeat2mint(v,x);} mint inv(){return mint(1)/v;} }; int main() { ios_base::sync_with_stdio(false); cin.tie(nullptr); int N; cin >> N; int low = 0,high = N; int turn = 0,L = 0,ans1,ans2; while(high-low > 1){ int mid = (low+high)/2; turn++; cout << "? " << mid+1 << endl; int now; cin >> now; if(mid-low > now-L){ if(mid-low == 1){ans1 = low,ans2 = mid;} high = mid; } else{ if(high-mid == 1){ans1 = mid,ans2 = high;} low = mid,L = now; } } while(turn < 10){cout << "? 1" << endl; cin >> high; turn++;} cout << "Yes" << " " << ans1+1 << " " << ans2+1 << endl; }