結果
問題 | No.594 壊れた宝物発見機 |
ユーザー |
![]() |
提出日時 | 2021-02-19 09:47:55 |
言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
結果 |
TLE
|
実行時間 | - |
コード長 | 1,265 bytes |
コンパイル時間 | 3,740 ms |
コンパイル使用メモリ | 191,788 KB |
最終ジャッジ日時 | 2025-01-18 22:45:28 |
ジャッジサーバーID (参考情報) |
judge1 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 1 TLE * 19 |
コンパイルメッセージ
main.cpp: In lambda function: main.cpp:21:22: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result] 21 | scanf("%d", &D); | ~~~~~^~~~~~~~~~
ソースコード
#include <bits/stdc++.h>using namespace std;#define FOR(i,a,b) for(int i=(a);i<(b);++i)#define REP(i,n) FOR(i,0,n)#define ALL(v) begin(v),end(v)template<typename A, typename B> inline bool chmax(A & a, const B & b) { if (a < b) { a = b; return true; } return false; }template<typename A, typename B> inline bool chmin(A & a, const B & b) { if (a > b) { a = b; return true; } return false; }using ll = long long;using pii = pair<int, int>;constexpr ll INF = 1ll<<30;constexpr ll longINF = 1ll<<60;constexpr ll MOD = 1000000007;constexpr bool debug = false;//---------------------------------//int main() {auto query = [](int X, int Y, int Z) -> int {printf("? %d %d %d\n", X, Y, Z);fflush(stdout);int D;scanf("%d", &D);return D;};int l[3] {}, r[3] {};REP(i, 3) {l[i] = -102;r[i] = 102;int lv = -1, rv = -1;auto q = [&](int x) {int arg[3];REP(j, 3) arg[j] = i == j ? x : l[j];return query(arg[0], arg[1], arg[2]);};while (r[i] - l[i] > 1) {const int m1 = (2 * l[i] + r[i]) / 3, m2 = (l[i] + 2 * r[i]) / 3;const int y1 = q(m1), y2 = q(m2);if (y1 < y2) r[i] = m2, rv = y2;else l[i] = m1, lv = y1;}if (lv > rv) swap(l[i], r[i]);}printf("! %d %d %d\n", l[0], l[1], l[2]);}