QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#126359#5146. SkillsLiuxizaiWA 5ms3624kbC++142.3kb2023-07-18 14:08:192023-07-18 14:09:22

Judging History

你现在查看的是最新测评结果

  • [2023-08-10 23:21:45]
  • System Update: QOJ starts to keep a history of the judgings of all the submissions.
  • [2023-07-18 14:09:22]
  • 评测
  • 测评结果:WA
  • 用时:5ms
  • 内存:3624kb
  • [2023-07-18 14:08:19]
  • 提交

answer

#include<bits/stdc++.h>
#define File(name) freopen(#name".in", "r", stdin); freopen(#name".out", "w", stdout);
using namespace std;
using ll = long long;
using ull = unsigned long long;
template<typename T>
inline T read(){
    T n = 0; int f = 1; char ch = getchar();
    while(!isdigit(ch)){
        if(ch == '-') f = -1;
        ch = getchar();
    }
    while(isdigit(ch)){
        n = n * 10 + ch - '0';
        ch = getchar();
    }
    return f * n;
}
template<typename T>
void write(T n){
    if(n / 10) write(n / 10);
    putchar(n % 10 + '0');
}
void input() {}
template<typename Type, typename... Types>
void input(Type &arg, Types&... args){
    arg = read<Type>();
    input(args...);
}
namespace Main{
    const int N = 105;
    map<array<int, 3>, int> mp;
    bool g[N][N];
    int query(array<int, 3> a){
        sort(a.begin(), a.end());
        if(mp.count(a)) return mp[a];
        cout << "? " << a[0] << ' ' << a[1] << ' ' << a[2] << endl;
        cin >> mp[a];
        return mp[a];
    }
    int count(int rt, int a, int b, int c){
        int c1 = query({a, b, c}), c2 = query({rt, a, b}), c3 = query({rt, a, c}), c4 = query({rt, b, c});
        return (c1 + c2 + c3 + c4) / 2 - c1;
    }
    void solve(int rt, int a, int b, int c, int d){
        int c1 = count(rt, a, b, c), c2 = count(rt, a, b, d), c3 = count(rt, a, c, d), c4 = count(rt, b, c, d);
        int tot = (c1 + c2 + c3 + c4) / 3;
        g[rt][a] = g[a][rt] = tot - c4;
        g[rt][b] = g[b][rt] = tot - c3;
        g[rt][c] = g[c][rt] = tot - c2;
        g[rt][d] = g[d][rt] = tot - c1;
    }
    void Main(){
        const int n = 100;
        for(int i = 2; i <= n; i += 4){
            if(i + 3 > n) solve(1, n - 3, n - 2, n - 1, n);
            else solve(1, i, i + 1, i + 2, i + 3);
        }
        for(int i = 2; i <= n; i++){
            for(int j = i + 1; j <= n; j++){
                g[i][j] = g[j][i] = query({1, i, j}) - g[1][i] - g[1][j];
            }
        }
        cout << '!' << endl;
        for(int i = 1; i <= n; i++){
            for(int j = 1; j <= n; j++){
                cout << g[i][j];
            }
            cout << endl;
        }
        return;
    }
} // namespace Main
int main(){
    Main::Main();
    return 0;
}

详细

Test #1:

score: 0
Wrong Answer
time: 5ms
memory: 3624kb

input:

2
3
1 1 10
1 10 1
10 1 1
5
1 2 3
6 5 4
7 8 9
12 11 10
13 14 15

output:

? 2 3 4
? 1 2 3
? 1 2 4
? 1 3 4
? 2 3 5
? 1 2 5
? 1 3 5
? 2 4 5
? 1 4 5
? 3 4 5
? 6 7 8
? 1 6 7
? 1 6 8
? 1 7 8
? 6 7 9
? 1 6 9
? 1 7 9
? 6 8 9
? 1 8 9
? 7 8 9
? 10 11 12
? 1 10 11
? 1 10 12
? 1 11 12
? 10 11 13
? 1 10 13
? 1 11 13
? 10 12 13
? 1 12 13
? 11 12 13
? 14 15 16
? 1 14 15
? 1 14 16
? 1 1...

result:

wrong output format Expected integer, but "?" found