結果
| 問題 | No.1429 Simple Dowsing |
| コンテスト | |
| ユーザー |
milkcoffee
|
| 提出日時 | 2021-03-14 14:12:34 |
| 言語 | C++14 (gcc 15.2.0 + boost 1.89.0) |
| 結果 |
AC
|
| 実行時間 | 17 ms / 2,000 ms |
| コード長 | 2,614 bytes |
| 記録 | |
| コンパイル時間 | 1,020 ms |
| コンパイル使用メモリ | 181,856 KB |
| 実行使用メモリ | 28,720 KB |
| 平均クエリ数 | 3.00 |
| 最終ジャッジ日時 | 2026-04-01 01:29:20 |
| 合計ジャッジ時間 | 2,211 ms |
|
ジャッジサーバーID (参考情報) |
judge1_0 / judge2_0 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | AC * 15 |
コンパイルメッセージ
main.cpp: In function 'int main()':
main.cpp:108:5: warning: 'x' may be used uninitialized [-Wmaybe-uninitialized]
108 | if(x==0) p=-1;
| ^~
main.cpp:95:14: note: 'x' was declared here
95 | ll n,m,k,x,y,p=1,flag=0,max=0;
| ^
In file included from /home/linuxbrew/.linuxbrew/Cellar/gcc/15.2.0_1/include/c++/15/ostream:42,
from /home/linuxbrew/.linuxbrew/Cellar/gcc/15.2.0_1/include/c++/15/istream:43,
from /home/linuxbrew/.linuxbrew/Cellar/gcc/15.2.0_1/include/c++/15/sstream:42,
from /home/linuxbrew/.linuxbrew/Cellar/gcc/15.2.0_1/include/c++/15/complex:50,
from /home/linuxbrew/.linuxbrew/Cellar/gcc/15.2.0_1/include/c++/15/ccomplex:43,
from /home/linuxbrew/.linuxbrew/Cellar/gcc/15.2.0_1/include/c++/15/x86_64-pc-linux-gnu/bits/stdc++.h:133,
from main.cpp:1:
In member function 'std::basic_ostream<_CharT, _Traits>::__ostream_type& std::basic_ostream<_CharT, _Traits>::operator<<(long long int) [with _CharT = char; _Traits = std::char_traits<char>]',
inlined from 'int main()' at main.cpp:109:27:
/home/linuxbrew/.linuxbrew/Cellar/gcc/15.2.0_1/include/c++/15/bits/ostream.h:212:25: warning: 'y' may be used uninitialized [-Wmaybe-uninitialized]
212 | { return _M_insert(__n); }
| ~~~~~~~~~^~~~~
main.cpp: In function 'int main()':
main.cpp:95:16: note: 'y' was declared here
95 | ll n,m,k,x,y,p=1,flag=0,max=0;
| ^
ソースコード
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define forin(in ,n) for(ll i=0; i<n; i++) cin>>in[i]
#define forout(out) for(ll i=0; i<(ll)out.size(); i++) cout<<out[i]<<endl
#define rep(i, n) for (ll i = 0; i < n; ++i)
#define rep_up(i, a, n) for (ll i = a; i < n; ++i)
#define rep_down(i, a, n) for (ll i = a; i >= n; --i)
#define P pair<ll, ll>
#define all(v) v.begin(), v.end()
#define fi first
#define se second
#define vvvll vector<vector<vector<ll>>>
#define vvll vector<vector<ll>>
#define vll vector<ll>
#define pqll priority_queue<ll>
#define pqllg priority_queue<ll, vector<ll>, greater<ll>>
constexpr ll INF = (1ll << 60);
constexpr ll mod = 1000000007;
constexpr double pi = 3.14159265358979323846;
template <typename T>
inline bool chmax(T &a, T b) {
if (a < b) {
a = b;
return 1;
}
return 0;
}
template <typename T>
inline bool chmin(T &a, T b) {
if (a > b) {
a = b;
return 1;
}
return 0;
}
template <typename T>
void pt(T val) {
cout << val << "\n";
}
template <typename T>
void pt_vll(vector<T> &v) {
ll vs = v.size();
rep(i, vs) {
cout << v[i];
if (i == vs - 1)
cout << "\n";
else
cout << " ";
}
}
ll mypow(ll a, ll n) {
ll ret = 1;
if(n==0) return 1;
if(a==0) return 0;
rep(i, n) {
if (ret > (ll)(1e18 + 10) / a) return -1;
ret *= a;
}
return ret;
}
long long modpow(long long a, long long n, long long mod) {
long long res = 1;
while (n > 0) {
if (n & 1) res = res * a % mod;
a = a * a % mod;
n >>= 1;
}
return res;
}
long long modinv(long long a, long long m) {
long long b = m, u = 1, v = 0;
while (b) {
long long t = a / b;
a -= t * b; swap(a, b);
u -= t * v; swap(u, v);
}
u %= m;
if (u < 0) u += m;
return u;
}
ll dig(ll n) {//桁数
ll res = 0;
while(n > 0) {
res ++;
n /= 10;
}
return res;
}
int main() {
ll n,m,k,x,y,p=1,flag=0,max=0;
cout<<"? "<<50<<" "<<50<<endl;
cin>>n;
rep(i,101){
rep(j,101){
if((i-50)*(i-50)+(j-50)*(j-50)==n&&flag==0){
x=i;
y=j;
flag=1;
break;
}
}
}
if(x==0) p=-1;
cout<<"? "<<x-p<<" "<<y<<endl;
cin>>m;
rep(i,101){
rep(j,101){
if((i-50)*(i-50)+(j-50)*(j-50)==n&&(i-x+p)*(i-x+p)+(j-y)*(j-y)==m){
cout<<"! "<<i<<" "<<j<<endl;
return 0;
}
}
}
}
milkcoffee