QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#800357#9783. Duloc Networkucup-team5928#WA 1ms3660kbC++201.4kb2024-12-06 09:28:002024-12-06 09:28:01

Judging History

This is the latest submission verdict.

  • [2024-12-06 09:28:01]
  • Judged
  • Verdict: WA
  • Time: 1ms
  • Memory: 3660kb
  • [2024-12-06 09:28:00]
  • Submitted

answer

#include <bits/stdc++.h>
using namespace std;

mt19937_64 rng(chrono::system_clock::now().time_since_epoch().count());
long long random(long long l, long long r){
   return uniform_int_distribution<long long>(l,r)(rng);
}

int main() {
    int n; cin >> n;
    int st = random(0, n-1);
    vector<int> curr(1, st);
    vector<int> lft;
    for(int i = 1; i < n; i++) {
        if(st == i) continue;
        lft.push_back(i);
    }

    vector<int> gr(n, 0);
    string zeros = string(n, '0');

    for(int i = 0; i < n; i++) {
        zeros[i] = '1';
        cout << "? " << zeros << endl;
        cin >> gr[i];
        zeros[i] = '0';
    }

    bool cmp = true;
    for(int i = 0; i < n-1; i++) {
        bool found = false;
        shuffle(lft.begin(), lft.end(), rng);

        string msk = string(n, '0');
        for(int x : curr) msk[x] = '1';

        for(int j = 0; j < (int) lft.size(); j++) {
            int x = lft[j];
            msk[x] = '1';

            cout << "? " << msk << endl;
            int res; cin >> res;
            if(res < gr[0] + gr[x]) {
                found = true;
                gr[0] = res;
                curr.push_back(x);
                lft.erase(lft.begin() + j);
                break;
            }
            msk[x] = '0';
        }

        if(!found) {
            cmp = false;
            break;
        }
    }

    cout << "! " << cmp << endl;
	
    return 0;
}



詳細信息

Test #1:

score: 100
Accepted
time: 0ms
memory: 3596kb

input:

4
1
3
2
2
2
1
0

output:

? 1000
? 0100
? 0010
? 0001
? 1100
? 1101
? 1111
! 1

result:

ok Correct answer with 7 queries.

Test #2:

score: 0
Accepted
time: 0ms
memory: 3656kb

input:

2
0
0

output:

? 10
? 01
! 0

result:

ok Correct answer with 2 queries.

Test #3:

score: 0
Accepted
time: 0ms
memory: 3660kb

input:

4
1
3
2
2
2
1
0

output:

? 1000
? 0100
? 0010
? 0001
? 1010
? 1011
? 1111
! 1

result:

ok Correct answer with 7 queries.

Test #4:

score: 0
Accepted
time: 0ms
memory: 3632kb

input:

2
0
0

output:

? 10
? 01
! 0

result:

ok Correct answer with 2 queries.

Test #5:

score: 0
Accepted
time: 0ms
memory: 3620kb

input:

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

output:

? 10000000000000000000000000000000000000000000000000
? 01000000000000000000000000000000000000000000000000
? 00100000000000000000000000000000000000000000000000
? 00010000000000000000000000000000000000000000000000
? 00001000000000000000000000000000000000000000000000
? 000001000000000000000000000000000...

result:

ok Correct answer with 153 queries.

Test #6:

score: -100
Wrong Answer
time: 1ms
memory: 3628kb

input:

50
10
13
8
6
13
8
10
8
8
8
9
13
15
11
9
10
14
6
16
10
15
10
7
8
10
10
10
13
10
15
9
10
11
5
16
10
14
11
10
9
9
15
11
10
7
11
12
10
9
10
20
22
21
20
25
25
29
33
35
35
37
37
37
37
37
36
35
34
33
32
31
30
29
28
27
26
25
24
23
22
21
20
19
18
17
16
15
14
13
12
11
10
9
8
7
6
5
4
3
2
1

output:

? 10000000000000000000000000000000000000000000000000
? 01000000000000000000000000000000000000000000000000
? 00100000000000000000000000000000000000000000000000
? 00010000000000000000000000000000000000000000000000
? 00001000000000000000000000000000000000000000000000
? 000001000000000000000000000000000...

result:

wrong answer Wrong answer.