QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#61672 | #2615. Surround the Cat | Booksnow | Compile Error | / | / | C++14 | 2.7kb | 2022-11-14 15:47:32 | 2022-11-14 15:47:33 |
Judging History
你现在查看的是最新测评结果
- [2023-08-10 23:21:45]
- System Update: QOJ starts to keep a history of the judgings of all the submissions.
- [2022-11-14 15:47:33]
- 评测
- 测评结果:Compile Error
- 用时:0ms
- 内存:0kb
- [2022-11-14 15:47:32]
- 提交
answer
#include <bits/stdc++.h>
#define st first
#define nd second
#define db double
#define re register
#define pb push_back
#define mk make_pair
#define int long long
#define ldb long double
#define pii pair<int, int>
#define ull unsigned long long
#define mst(a, b) memset(a, b, sizeof(a))
using namespace std;
const int N = 1e5 + 10, INF = 1e15;
const int bl[54][2] = {{9, 0}, {9, 1}, {9, 2}, {9, 3}, {9, 4}, {9, 5}, {9, 6}, {9, 7}, {9, 8}, {9, 9}, {8, 9}, {7, 9}, {6, 9}, {5, 9}, {4, 9}, {3, 9}, {2, 9}, {1, 9}, {0, 9}, {-1, 8}, {-2, 7}, {-3, 6}, {-4, 5}, {-5, 4}, {-6, 3}, {-7, 2}, {-8, 1}, {-9, 0}, {-9, -1}, {-9, -2}, {-9, -3}, {-9, -4}, {-9, -5}, {-9, -6}, {-9, -7}, {-9, -8}, {-9, -9}, {-8, -9}, {-7, -9}, {-6, -9}, {-5, -9}, {-4, -9}, {-3, -9}, {-2, -9}, {-1, -9}, {0, -9}, {1, -8}, {2, -7}, {3, -6}, {4, -5}, {5, -4}, {6, -3}, {7, -2}, {8, -1}};
inline int read()
{
int s = 0, w = 1;
char ch = getchar();
while(ch < '0' || ch > '9') { if(ch == '-') w *= -1; ch = getchar(); }
while(ch >= '0' && ch <= '9') s = s * 10 + ch - '0', ch = getchar();
return s * w;
}
bool vis[54];
map<pii, bool> mp;
inline int dis(int ax, int ay, int bx, int by) //计算位置
{
//从 (ax,ay) 到 (bx,by) 的最短步数
int dx = ax - bx, dy = ay - by, res = 0;
if(dx < 0 && dy < 0) ax -= max(dx, dy), ay -= max(dx, dy), res = abs(max(dx, dy));
if(dx > 0 && dy > 0) ax -= min(dx, dy), ay -= min(dx, dy), res = abs(min(dx, dy));
dx = ax - bx, dy = ay - by;
res = res + abs(dx), res = res + abs(dy);
return res;
}
inline void query(int x, int y)
{
int mi = INF, k;
vector<int> v;
for(re int i = 0; i < 54; i++){
if(vis[i]) continue;
int d = dis(x, y, bl[i][0], bl[i][1]);
if(d < mi) mi = d, v.clear(), v.pb(i);
else if(d == mi) v.pb(i);
}
mi = INF;
for(re int i : v){
int res = 0;
for(re int j : v) if(i != j) res = res + dis(bl[i][0], bl[i][1], bl[j][0], bl[j][1]);
if(res < mi) mi = res, k = i;
}
vis[k] = true, mp[mk(bl[k][0], bl[k][1])] = true;
cout << bl[k][0] << " " << bl[k][1] << "\n", cout.flush();
}
vector<pii> v;
inline void DFS(int x, int y)
{
if(mp[mk(x, y)]) return;
v.pb(mk(x, y)), mp[mk(x, y)] = true;
DFS(x + 1, y + 1), DFS(x - 1, y - 1);
DFS(x + 1, y), DFS(x - 1, y), DFS(x, y + 1), DFS(x, y - 1);
}
signed main()
{
for(re int i = 0, x, y; i < 54; i++) cin >> x >> y, query(x, y); //围起来动不了
DFS(0, 0);
while(1){
int x = read(), y = read();
int kx = INF, ky = INF;
for(re pii x : v){
if(mp[mk(x.st, x.nd)] || (x.st == x && x.nd == y)) continue;
kx = x.st, ky = x.nd; break;
}
if(kx == INF) break;
cout << kx << " " << ky << "\n", cout.flush();
}
return 0;
}
详细
answer.code: In function ‘int main()’: answer.code:71:38: error: no match for ‘operator==’ (operand types are ‘long long int’ and ‘std::pair<long long int, long long int>’) 71 | if(mp[mk(x.st, x.nd)] || (x.st == x && x.nd == y)) continue; | ^~ ~ | | | std::pair<long long int, long long int> In file included from /usr/include/c++/11/regex:63, from /usr/include/x86_64-linux-gnu/c++/11/bits/stdc++.h:110, from answer.code:1: /usr/include/c++/11/bits/regex.h:1037:5: note: candidate: ‘template<class _BiIter> bool std::__cxx11::operator==(const std::__cxx11::sub_match<_BiIter>&, const std::__cxx11::sub_match<_BiIter>&)’ 1037 | operator==(const sub_match<_BiIter>& __lhs, const sub_match<_BiIter>& __rhs) | ^~~~~~~~ /usr/include/c++/11/bits/regex.h:1037:5: note: template argument deduction/substitution failed: answer.code:71:41: note: mismatched types ‘const std::__cxx11::sub_match<_BiIter>’ and ‘long long int’ 71 | if(mp[mk(x.st, x.nd)] || (x.st == x && x.nd == y)) continue; | ^ In file included from /usr/include/c++/11/regex:63, from /usr/include/x86_64-linux-gnu/c++/11/bits/stdc++.h:110, from answer.code:1: /usr/include/c++/11/bits/regex.h:1133:5: note: candidate: ‘template<class _Bi_iter, class _Ch_traits, class _Ch_alloc> bool std::__cxx11::operator==(std::__cxx11::__sub_match_string<_Bi_iter, _Ch_traits, _Ch_alloc>&, const std::__cxx11::sub_match<_BiIter>&)’ 1133 | operator==(const __sub_match_string<_Bi_iter, _Ch_traits, _Ch_alloc>& __lhs, | ^~~~~~~~ /usr/include/c++/11/bits/regex.h:1133:5: note: template argument deduction/substitution failed: answer.code:71:41: note: mismatched types ‘std::__cxx11::__sub_match_string<_Bi_iter, _Ch_traits, _Ch_alloc>’ and ‘long long int’ 71 | if(mp[mk(x.st, x.nd)] || (x.st == x && x.nd == y)) continue; | ^ In file included from /usr/include/c++/11/regex:63, from /usr/include/x86_64-linux-gnu/c++/11/bits/stdc++.h:110, from answer.code:1: /usr/include/c++/11/bits/regex.h:1208:5: note: candidate: ‘template<class _Bi_iter, class _Ch_traits, class _Ch_alloc> bool std::__cxx11::operator==(const std::__cxx11::sub_match<_BiIter>&, std::__cxx11::__sub_match_string<_Bi_iter, _Ch_traits, _Ch_alloc>&)’ 1208 | operator==(const sub_match<_Bi_iter>& __lhs, | ^~~~~~~~ /usr/include/c++/11/bits/regex.h:1208:5: note: template argument deduction/substitution failed: answer.code:71:41: note: mismatched types ‘const std::__cxx11::sub_match<_BiIter>’ and ‘long long int’ 71 | if(mp[mk(x.st, x.nd)] || (x.st == x && x.nd == y)) continue; | ^ In file included from /usr/include/c++/11/regex:63, from /usr/include/x86_64-linux-gnu/c++/11/bits/stdc++.h:110, from answer.code:1: /usr/include/c++/11/bits/regex.h:1300:5: note: candidate: ‘template<class _Bi_iter> bool std::__cxx11::operator==(const typename std::iterator_traits<_Iter>::value_type*, const std::__cxx11::sub_match<_BiIter>&)’ 1300 | operator==(typename iterator_traits<_Bi_iter>::value_type const* __lhs, | ^~~~~~~~ /usr/include/c++/11/bits/regex.h:1300:5: note: template argument deduction/substitution failed: answer.code:71:41: note: ‘std::pair<long long int, long long int>’ is not derived from ‘const std::__cxx11::sub_match<_BiIter>’ 71 | if(mp[mk(x.st, x.nd)] || (x.st == x && x.nd == y)) continue; | ^ In file included from /usr/include/c++/11/regex:63, from /usr/include/x86_64-linux-gnu/c++/11/bits/stdc++.h:110, from answer.code:1: /usr/include/c++/11/bits/regex.h:1375:5: note: candidate: ‘template<class _Bi_iter> bool std::__cxx11::operator==(const std::__cxx11::sub_match<_BiIter>&, const typename std::iterator_traits<_Iter>::value_type*)’ 1375 | operator==(const sub_match<_Bi_iter>& __lhs, | ^~~~~~~~ /usr/include/c++/11/bits/regex.h:1375:5: note: template argument deduction/substitution failed: answer.code:71:41: note: mismatched types ‘const std::__cxx11::sub_match<_BiIter>’ and ‘long long int’ 71 | if(mp[mk(x.st, x.nd)] || (x.st == x && x.nd == y)) continue; | ^ In file included from /usr/include/c++/11/regex:63, from /usr/include/x86_64-linux-gnu/c++/11/bits/stdc++.h:110, from answer.code:1: /usr/include/c++/11/bits/regex.h:1468:5: note: candidate: ‘template<class _Bi_iter> bool std::__cxx11::operator==(const typename std::iterator_traits<_Iter>::value_type&, const std::__cxx11::sub_match<_BiIter>&)’ 1468 | operator==(typename iter...