結果
| 問題 |
No.3018 目隠し宝探し
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2025-01-03 21:05:17 |
| 言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 3,327 bytes |
| コンパイル時間 | 1,809 ms |
| コンパイル使用メモリ | 174,444 KB |
| 実行使用メモリ | 26,072 KB |
| 平均クエリ数 | 2.68 |
| 最終ジャッジ日時 | 2025-01-25 22:13:15 |
| 合計ジャッジ時間 | 4,977 ms |
|
ジャッジサーバーID (参考情報) |
judge7 / judge3 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 1 |
| other | AC * 16 WA * 5 |
コンパイルメッセージ
main.cpp: In function ‘ll zaatu(std::vector<long long int>&)’:
main.cpp:65:78: warning: structured bindings only available with ‘-std=c++17’ or ‘-std=gnu++17’ [-Wc++17-extensions]
65 | ll zaatu(vector<ll>&A){map<ll,ll>m;for(auto&&x:A)m[x]=0;ll ret = 0;for(auto&&[key,val]:m)val=ret++;for(auto&&x:A)x=m[x];return ret;}
| ^
ソースコード
#include <bits/stdc++.h>
//
using namespace std;
typedef long long ll;
typedef long double ld;
using Graph = vector<vector<ll>>;
template <typename T>
bool chmax(T &a, const T &b)
{
if (a < b)
{
a = b;
return true;
}
return false;
}
template <typename T>
bool chmin(T &a, const T &b)
{
if (a > b)
{
a = b;
return true;
}
return false;
}
#define reps(i, a, n) for (ll i = (a); i < (ll)(n); ++i)
#define rep(i, n) reps(i, 0, n)
#define rrep(i, n) for (ll i = (ll)(n)-1; i >= 0; i--)
#define rreps(i ,a, n) for (ll i = (ll)(n)-1; i >=(ll) a; i--)
#define ALL(box) (box).begin(), (box).end()
#define all(box) (box).begin(), (box).end()
#define RALL(box) (box).rbegin(), (box).rend()
#define rall(box) (box).rbegin(), (box).rend()
ll inf=((1LL<<62)-(1LL<<31))/15;
ll sum = 0;
ll num = 0;
int pum = 0;
ll mum = 0;
int min1 = 1000000;
int max1 = 0;
ll min2 = inf;
ll max2 = -inf;
ll MOD1 = 1000000007;
ll MOD = 998244353;
int dx[4] = {0, 1, 0, -1};
int dy[4] = {1, 0, -1, 0}; // 右、下、左、上
int dx8[8] = {0, 1, 1, 1, 0, -1, -1, -1};
int dy8[8] = {1, 1, 0, -1, -1, -1, 0, 1};
// sort(box.rbegin(), box.rend());
// printf("%.7Lf", n);
// reverse(t.begin(), t.end());
// unique(box.begin(), box.end());
// auto It = lower_bound(ALL(box), n);以上 4
// auto It = upper_bound(ALL(box), n);含まない上 7
// cout << box.end() - It ; 末尾までの距離
// cout << It - a.begin() ; 先頭までの距離
// auto It =box.upper_bound( k);set,multiset
// pqueue < int, vector<int>, greater<int>> q;
// priority_queue<pii, vector<pii>, greater<pii>> pq;//小さい順
// segtree<ll, op, e> seg(N);
// lazy_segtree<S, op, e, F, mapping, composition, id> seg(N);
// box.erase(unique(all(box), box.end());
// st.erase(st.find(5));
ll zaatu(vector<ll>&A){map<ll,ll>m;for(auto&&x:A)m[x]=0;ll ret = 0;for(auto&&[key,val]:m)val=ret++;for(auto&&x:A)x=m[x];return ret;}
ll H,W,K;
vector<ll> Graph_kyori(const Graph& G,ll first){
ll N=G.size();
vector<ll> dist(N,inf);
dist[first]=0;
queue<ll> st;
st.push(first);
while(!st.empty()){
int a=st.front();st.pop();
for(auto x:G[a]){
if(dist[x]==inf){
dist[x]=dist[a]+1;
st.push(x);
}
}
}
return dist;
}
void Query(ll& i,ll& j,ll& Q){
cout <<'?'<<" "<<i<<" "<<j<<endl;
cin>>Q;
}
ll Euclidean_distance(ll i,ll j,ll i_tmp,ll j_tmp){
return (i-i_tmp)*(i-i_tmp)+(j-j_tmp)*(j-j_tmp);
}
int main(){
ll H,W;
cin>>H>>W;
ll I_1,J_1,Q_1;//1回目
ll I_2,J_2,Q_2;//2回目
if(H==1&&W==1) {
cout <<"!"<<" "<<1<<" "<<1<<endl;
}
else if(H==1) {
I_1=1;J_1=1;
Query(I_1,J_1,Q_1);
cout <<"!"<<" "<<1<<" "<<(ll)sqrt(Q_1)<<endl;
}
else if(W==1) {
I_1=1;J_1=1;
Query(I_1,J_1,Q_1);
cout <<"!"<<" "<<(ll)sqrt(Q_1)<<" "<<1<<endl;
}
else{
I_1=1;J_1=1;
Query(I_1,J_1,Q_1);
I_2=1;J_2=W;
Query(I_2,J_2,Q_2);
for(ll i=1;i<=H;i++){
for(ll j=1;j<=W;j++){
if(Q_1==Euclidean_distance(I_1,J_1,i,j)&&Q_2==Euclidean_distance(I_2,J_2,i,j)){
cout <<"!"<<" "<<i<<" "<<j<<endl;
return 0;
}
}
}
}
}