QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#24143 | #2615. Surround the Cat | galaxias# | Compile Error | / | / | C++11 | 3.0kb | 2022-03-26 17:20:57 | 2022-05-18 04:15: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-05-18 04:15:33]
- 评测
- 测评结果:Compile Error
- 用时:0ms
- 内存:0kb
- [2022-03-26 17:20:57]
- 提交
answer
#include<bits/stdc++.h>
#define int long long
using namespace std;
int dx[] = {0,1,-1,0,1,-1};
int dy[] = {1,0,0,-1,1,-1};
int ddx[] = {1,2,1,-1,-2,-1};
int ddy[] = {-1,1,2,1,-1,-2};
map<pair<int,int>, int> mp;
bool isedge(int x, int y) {
if(x == 9) {
for(int i=0;i<=9;i++) {
if(y == i) return true;
}
}
if(y == 9) {
for(int i=0;i<=9;i++) {
if(x == i) return true;
}
}
for(int i=0;i<=9;i++) {
if(x == 0-i && y == 9-i) return true;
}
for(int i=0;i<=9;i++) {
if(x == 0+i && y == -9+i) return true;
}
if(x == -9) {
for(int i=0;i<=9;i++) {
if(y == -i) return true;
}
}
if(y == -9) {
for(int i=-9;i<=0;i++) {
if(x == i) return true;
}
}
return false;
}
bool dfs1(int x, int y) {
for(int i=0;i<6;i++) {
int xx = x+dx[i];
int yy = y+dy[i];
if(isedge(xx,yy)) return true;
}
return false;
}
bool dfs2(int x, int y) {
for(int i=0;i<6;i++) {
int xx = x+dx[i];
int yy = y+dy[i];
if(dfs1(xx,yy)) return true;
}
return false;
}
pair<int,int> findvis() {
for(int i=0;i<=9;i++) {
if(!mp.count(make_pair(9,i))) return make_pair(9,i);
}
for(int i=0;i<=9;i++) {
if(!mp.count(make_pair(i,9))) return make_pair(i,9);
}
for(int i=0;i<=9;i++) {
if(!mp.count(make_pair(0-i,9-i))) return make_pair(0-i,9-i);
}
for(int i=0;i<=9;i++) {
if(!mp.count(make_pair(-9,-i))) return make_pair(-9,-i);
}
for(int i=0;i<=9;i++) {
if(!mp.count(make_pair(-9+i,-9))) return make_pair(-9+i,-9);
}
for(int i=0;i<=9;i++) {
if(!mp.count(make_pair(0+i,-9+i))) return make_pair(0+i,-9+i);
}
}
pair<int,int> query(int x, int y) {
cout << x << " " << y << endl;
cout.fflush();
mp[make_pair(x,y)] = 1;
int xx,yy;
cin >> xx >> yy;
return make_pair(xx,yy);
}
signed main() {
int qw, wq;
pair<int,int> cur;
cin >> wq >> qw;
query(9,1);
query(8,9);
query(-1,8);
query(-9,-1);
query(-8,-9);
cur = query(1,-8);
for(int i=0;i<48;i++) {
if(dfs1(cur.first,cur.second)) {
int ok = 0;
for(int i=0;i<6;i++) {
int xx = cur.first+dx[i];
int yy = cur.second+dy[i];
if(isedge(xx,yy) && !mp.count(make_pair(xx,yy))) {
query(xx,yy);
ok=1;
break;
}
}
if(!ok) {
pair<int,int> tmp = findvis();
query(tmp.first,tmp.second);
}
}else if(dfs2(cur.first,cur.second)) {
int ok = 0;
for(int i=0;i<6;i++) {
int xx = cur.first+ddx[i];
int yy = cur.second+ddy[i];
if(isedge(xx,yy) && !mp.count(make_pair(xx,yy))) {
query(xx,yy);
ok=1;
break;
}
}
if(!ok) {
pair<int,int> tmp = findvis();
query(tmp.first,tmp.second);
}
}else {
pair<int,int> tmp = findvis();
query(tmp.first,tmp.second);
}
}
}
/*
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
*/
詳細信息
answer.code: In function ‘std::pair<long long int, long long int> query(long long int, long long int)’: answer.code:92:14: error: ‘std::ostream’ {aka ‘class std::basic_ostream<char>’} has no member named ‘fflush’; did you mean ‘flush’? 92 | cout.fflush(); | ^~~~~~ | flush answer.code: In function ‘std::pair<long long int, long long int> findvis()’: answer.code:88:1: warning: control reaches end of non-void function [-Wreturn-type] 88 | } | ^