QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#565118#8469. Comedy’s Not Omnipotentucup-team1231#WA 107ms4188kbC++142.0kb2024-09-15 20:19:152024-09-15 20:19:16

Judging History

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

  • [2024-09-15 20:19:16]
  • 评测
  • 测评结果:WA
  • 用时:107ms
  • 内存:4188kb
  • [2024-09-15 20:19:15]
  • 提交

answer

#include <bits/stdc++.h>
using namespace std;
#define MOD 1000000007
typedef vector<int> vi;
#define pb push_back

int ans[100000];
int query(vi v) {
    int z;
    cout << "? " << v.size();
    for (int z: v) cout << " " << z+1;
    cout << endl;
    cin >> z;
    return z; 
}
int main() {
    int n;
    cin >> n;

    vi things;
    int c = 0;
    fill(ans,ans+n,-1);
    while (c+3 < n) {
        vi u;
        if (!things.empty()) u.pb(things.back()),things.pop_back();
        auto clean = [&]() {
            int i;
            int o = u[0];
            for (i = (int) things.size()-1; i >= 0; i--) {
                ans[things[i]] = 1-ans[o];
                o = things[i];
            }
            things.clear();
        };
        while (u.size() < 4) u.pb(c++);
        int z = query({u[0],u[1],u[2]});
        if ((z == 0) || (z == 3)) {
            ans[u[0]] = ans[u[1]] = ans[u[2]] = z/3,c--;
            clean();
            continue;
        }
        int y = query({u[2],u[3]});
        if ((y == 0) || (y == 2)) {
            ans[u[2]] = ans[u[3]] = y/2;
            if ((z-ans[u[2]] == 0) || (z-ans[u[2]] == 2)) {
                ans[u[0]] = ans[u[1]] = (z-ans[u[2]])/2;
                clean();
                continue;
            }
            else {
                things.pb(u[0]);
                things.pb(u[1]);
                continue;
            }
        }
        int x = query({u[1],u[3]});
        ans[u[0]] = (z+x-1) & 1;
        ans[u[1]] = ((z+x-1) & 2) >> 1;
        ans[u[2]] = z-ans[u[0]]-ans[u[1]];
        ans[u[3]] = 1-ans[u[2]];
        clean();
    }
    while (c < n) ans[c] = query({c}),c++;
    if (!things.empty()) {
        int i;
        ans[things[0]] = query({things[0]});
        for (i = 1; i < things.size(); i++) ans[things[i]] = 1-ans[things[i-1]];
    }
    int i;
    cout << "= ";
    for (i = 0; i < n; i++) cout << ans[i];
    cout << endl;

    return 0;
}

詳細信息

Test #1:

score: 0
Wrong Answer
time: 107ms
memory: 4188kb

input:

100000
2
1
1
2
2
2
2
3
2
1
1
2
1
2
2
1
2
1
1
1
3
3
2
2
1
0
0
2
1
0
2
1
1
1
1
0
2
2
2
0
1
0
1
1
1
2
1
1
3
2
0
1
1
1
0
0
1
1
1
3
0
2
1
2
2
2
2
1
1
2
1
1
1
0
2
2
0
0
2
2
2
1
1
1
1
0
2
1
1
2
0
0
3
1
0
2
1
2
2
0
0
2
1
1
0
2
0
2
1
2
3
0
2
2
3
0
0
2
0
1
0
1
0
1
1
2
3
1
0
2
1
1
1
1
1
3
2
0
2
2
3
2
2
2
2
2
2...

output:

? 3 1 2 3
? 2 3 4
? 2 2 4
? 3 5 6 7
? 2 7 8
? 3 6 9 10
? 2 10 11
? 3 9 12 13
? 3 14 15 16
? 2 16 17
? 2 15 17
? 3 18 19 20
? 2 20 21
? 2 19 21
? 3 22 23 24
? 2 24 25
? 2 23 25
? 3 26 27 28
? 2 28 29
? 2 27 29
? 3 30 31 32
? 3 33 34 35
? 3 36 37 38
? 2 38 39
? 3 37 40 41
? 2 41 42
? 3 40 43 44
? 3 45...

result:

wrong answer Too many queries: 60773