結果

問題 No.1429 Simple Dowsing
ユーザー 夜
提出日時 2021-03-14 22:47:24
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 25 ms / 2,000 ms
コード長 889 bytes
コンパイル時間 780 ms
コンパイル使用メモリ 96,336 KB
実行使用メモリ 24,492 KB
平均クエリ数 3.00
最終ジャッジ日時 2023-09-24 10:09:06
合計ジャッジ時間 2,333 ms
ジャッジサーバーID
(参考情報)
judge14 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 25 ms
23,412 KB
testcase_01 AC 25 ms
24,348 KB
testcase_02 AC 25 ms
23,628 KB
testcase_03 AC 25 ms
24,000 KB
testcase_04 AC 25 ms
24,036 KB
testcase_05 AC 25 ms
24,492 KB
testcase_06 AC 25 ms
24,492 KB
testcase_07 AC 24 ms
24,024 KB
testcase_08 AC 25 ms
23,388 KB
testcase_09 AC 24 ms
24,324 KB
testcase_10 AC 24 ms
23,652 KB
testcase_11 AC 25 ms
24,012 KB
testcase_12 AC 25 ms
23,808 KB
testcase_13 AC 25 ms
24,312 KB
testcase_14 AC 25 ms
23,652 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
main.cpp: 関数 ‘int main()’ 内:
main.cpp:39:46: 警告: ‘y1’ may be used uninitialized [-Wmaybe-uninitialized]
   39 |                 if ((x - x1) * (x - x1) + (y - y1) * (y - y1) == d1) {
      |                                           ~~~^~~~~
main.cpp:22:17: 備考: ‘y1’ はここで定義されています
   22 |         int x1, y1;
      |                 ^~
main.cpp:39:24: 警告: ‘x1’ may be used uninitialized [-Wmaybe-uninitialized]
   39 |                 if ((x - x1) * (x - x1) + (y - y1) * (y - y1) == d1) {
      |                     ~~~^~~~~
main.cpp:22:13: 備考: ‘x1’ はここで定義されています
   22 |         int x1, y1;
      |             ^~

ソースコード

diff #

#include <iostream>
#include <string>
#include <algorithm>
#include <vector>
#include <iomanip>
#include <cmath>
#include <stdio.h>
#include <queue>
#include <deque>
#include <cstdio>
#include <set>
#include <map>
#include <bitset>
#include <stack>
#include <cctype>
using namespace std;
vector<pair<int, int>> vec;
int main() {
	cout << "? 0 0" << endl;
	int d, d1;
	cin >> d;
	int x1, y1;
	bool bo = true;
	for (int i = 0; i <= 100; i++) {
		for (int j = 0; j <= 100; j++) {
			if (i * i + j * j == d) {
				if (bo) {
					x1 = i, y1 = j;
					cout << "? " << i << " " << j << endl;
					cin >> d1;
					bo = false;
				}
				vec.emplace_back(make_pair(i, j));
			}
		}
	}
	for (int i = 0; i < vec.size(); i++) {
		int x = vec[i].first, y = vec[i].second;
		if ((x - x1) * (x - x1) + (y - y1) * (y - y1) == d1) {
			cout << "! " << x << " " << y << endl;
			return 0;
		}
	}
	return 0;
}
0