結果
| 問題 |
No.3018 目隠し宝探し
|
| ユーザー |
Cafe1942
|
| 提出日時 | 2025-01-25 13:13:41 |
| 言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 1,528 bytes |
| コンパイル時間 | 945 ms |
| コンパイル使用メモリ | 90,944 KB |
| 実行使用メモリ | 25,984 KB |
| 平均クエリ数 | 2.73 |
| 最終ジャッジ日時 | 2025-01-25 22:38:23 |
| 合計ジャッジ時間 | 4,082 ms |
|
ジャッジサーバーID (参考情報) |
judge6 / judge8 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 1 |
| other | AC * 19 WA * 2 |
ソースコード
#include <iostream>
#include <iomanip>//小数点出力用
//cout << fixed << setprecision(10) << ans;
#include <cmath>
#include <algorithm>
#include <vector>
#include <queue>
#include <stack>
#include <set>
#include <map>
using ll = long long;
using namespace std;
#define modP 998244353
bool chkrng0idx(int pos, int sup) { return (0 <= pos && pos < sup); }
int clk4(int num) { return (num - 2) * (num % 2); }
void yn(bool tf) { cout << (tf ? "Yes\n" : "No\n"); }
int squareRoot(long long x) {
int left = 1;
int right = 1000001;
int mid;
while (right - left > 1) {
mid = (right + left) / 2;
if ((long long)mid * (long long)mid <= x) {
left = mid;
}
else {
right = mid;
}
}
return left;
}
int main() {
ios::sync_with_stdio(false);
cin.tie(nullptr);
int H;cin >> H;
int W;cin >> W;
cout << "? 1 1" << endl;
int d1;cin >> d1;
if (min(H, W) == 1) {
if (H == 1) {
cout << "! 1 " << squareRoot(d1) + 1 << endl;
}
else {
cout << "! " << squareRoot(d1) + 1 << " 1" << endl;
}
return 0;
}
cout << "? 1 " << W << endl;
int d2;cin >> d2;
for (int i = 1;i <= H;i++) {
for (int j = 1;j <= W;j++) {
if ((i - 1) * (i - 1) + (j - 1) * (j - 1) == d1 && (i - 1) * (i - 1) + (j - W) * (j - W) == d2) {
cout << "! " << i << " " << j << endl;
return 0;
}
}
}
return 0;
}
Cafe1942