QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#126164 | #6668. Trokuti | hxhuoxinghx | 0 | 30ms | 3676kb | C++14 | 3.9kb | 2023-07-18 10:54:54 | 2023-07-18 10:54:55 |
Judging History
answer
#include <iostream>
#include <vector>
#include <utility>
#include <cstdlib>
#include <ctime>
using namespace std;
constexpr int NODECNT = 100;
constexpr int FIRSTTRY = 2733;
constexpr int QUERYCNT = 3399;
struct Query {
int a, b, c;
Query() = default;
Query(int _a, int _b, int _c) {
if(_a < _b && _b < _c) a = _a, b = _b, c = _c;
if(_a < _c && _c < _b) a = _a, b = _c, c = _b;
if(_b < _a && _a < _c) a = _b, b = _a, c = _c;
if(_b < _c && _c < _a) a = _b, b = _c, c = _a;
if(_c < _a && _a < _b) a = _c, b = _a, c = _b;
if(_c < _b && _b < _a) a = _c, b = _b, c = _a;
}
bool operator==(const Query& rhs) const {
return a == rhs.a && b == rhs.b && c == rhs.c;
}
int ask()
{
cout << "? " << a + 1 << " " << b + 1 << " " << c + 1 << endl;
int res;
cin >> res;
return res;
}
};
vector<pair<Query, int> > query;
int ans[NODECNT][NODECNT];
void check(Query q, int res)
{
if(res == 0)
{
ans[q.a][q.b] = ans[q.b][q.a] = ans[q.a][q.c] = ans[q.c][q.a] = ans[q.b][q.c] = ans[q.c][q.b] = 0;
}
if(res == 3)
{
ans[q.a][q.b] = ans[q.b][q.a] = ans[q.a][q.c] = ans[q.c][q.a] = ans[q.b][q.c] = ans[q.c][q.b] = 1;
}
if(res == 1)
{
if(ans[q.a][q.b] == 0 && ans[q.a][q.c] == 0) ans[q.b][q.c] = ans[q.c][q.b] = 1;
if(ans[q.a][q.b] == 0 && ans[q.b][q.c] == 0) ans[q.a][q.c] = ans[q.c][q.a] = 1;
if(ans[q.a][q.c] == 0 && ans[q.b][q.c] == 0) ans[q.a][q.b] = ans[q.b][q.a] = 1;
if(ans[q.a][q.b] == 1) ans[q.a][q.c] = ans[q.c][q.a] = ans[q.b][q.c] = ans[q.c][q.b] = 0;
if(ans[q.a][q.c] == 1) ans[q.a][q.b] = ans[q.b][q.a] = ans[q.b][q.c] = ans[q.c][q.b] = 0;
if(ans[q.b][q.c] == 1) ans[q.a][q.b] = ans[q.b][q.a] = ans[q.a][q.c] = ans[q.c][q.a] = 0;
}
if(res == 2)
{
if(ans[q.a][q.b] == 1 && ans[q.a][q.c] == 1) ans[q.b][q.c] = ans[q.c][q.b] = 0;
if(ans[q.a][q.b] == 1 && ans[q.b][q.c] == 1) ans[q.a][q.c] = ans[q.c][q.a] = 0;
if(ans[q.a][q.c] == 1 && ans[q.b][q.c] == 1) ans[q.a][q.b] = ans[q.b][q.a] = 0;
if(ans[q.a][q.b] == 0) ans[q.a][q.c] = ans[q.c][q.a] = ans[q.b][q.c] = ans[q.c][q.b] = 1;
if(ans[q.a][q.c] == 0) ans[q.a][q.b] = ans[q.b][q.a] = ans[q.b][q.c] = ans[q.c][q.b] = 1;
if(ans[q.b][q.c] == 0) ans[q.a][q.b] = ans[q.b][q.a] = ans[q.a][q.c] = ans[q.c][q.a] = 1;
}
}
int main()
{
for(int i = 0; i < NODECNT; i++)
{
for(int j = 0; j < NODECNT; j++)
{
if(i != j) ans[i][j] = -1;
}
}
srand(time(0));
for(int i = 0; i < FIRSTTRY; i++)
{
bool flag = true;
Query q;
while(flag)
{
q = Query(rand() % NODECNT, rand() % NODECNT, rand() % NODECNT);
if(q.a == q.b || q.a == q.c || q.b == q.c) continue;
flag = false;
for(pair<Query, int> pqi : query)
{
if(q == pqi.first)
{
flag = true;
break;
}
}
}
query.push_back({q, q.ask()});
}
for(pair<Query, int> pqi : query)
{
check(pqi.first, pqi.second);
}
for(pair<Query, int> pqi : query)
{
check(pqi.first, pqi.second);
}
for(int i = FIRSTTRY; i < QUERYCNT; i++)
{
bool flag = true;
Query q;
while(flag)
{
q = Query(rand() % NODECNT, rand() % NODECNT, rand() % NODECNT);
if(q.a == q.b || q.a == q.c || q.b == q.c) continue;
if(ans[q.a][q.b] != -1 && ans[q.a][q.c] != -1 && ans[q.b][q.c] != -1) continue;
flag = false;
for(pair<Query, int> pqi : query)
{
if(q == pqi.first)
{
flag = true;
break;
}
}
}
query.push_back({q, q.ask()});
check(q, query.back().second);
for(pair<Query, int> pqi : query)
{
check(pqi.first, pqi.second);
}
flag = true;
for(int i = 0; flag && i < NODECNT; i++)
{
for(int j = 0; flag && j < NODECNT; j++)
{
if(ans[i][j] == -1) flag = false;
}
}
if(flag) break;
}
cout << "!" << endl;
for(int i = 0; i < NODECNT; i++)
{
for(int j = 0; j < NODECNT; j++)
{
cout << ans[i][j];
}
cout << endl;
}
}
詳細信息
Subtask #1:
score: 0
Wrong Answer
Test #1:
score: 0
Wrong Answer
time: 30ms
memory: 3676kb
input:
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 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 ...
output:
? 2 50 78 ? 17 21 84 ? 19 70 80 ? 78 82 99 ? 4 47 93 ? 11 68 81 ? 43 63 78 ? 2 11 51 ? 32 54 89 ? 58 78 80 ? 35 79 94 ? 3 62 96 ? 21 31 68 ? 47 51 81 ? 73 81 97 ? 29 36 84 ? 3 6 78 ? 18 31 69 ? 52 68 71 ? 2 29 73 ? 59 82 96 ? 20 68 91 ? 3 10 70 ? 9 43 83 ? 41 56 93 ? 41 76 91 ? 68 70 79 ? 27 51 96 ?...
result:
wrong answer Token parameter [name=ans_i] equals to "000000000000000000000000000000...0000000000000000000000000000000", doesn't correspond to pattern "[01]{100,100}"