QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#874611#2742. ComboWansur#5 0ms3840kbC++201.1kb2025-01-28 12:16:282025-01-28 12:16:33

Judging History

This is the latest submission verdict.

  • [2025-01-28 12:16:33]
  • Judged
  • Verdict: 5
  • Time: 0ms
  • Memory: 3840kb
  • [2025-01-28 12:16:28]
  • Submitted

answer

#include "combo.h"
#include <bits/stdc++.h>

using namespace std;
typedef long long ll;

const int maxn = 2e5 + 12;

mt19937 rng(48319442);

string guess_sequence(int n) {
    string t = "ABXY", ans = "";
    if(press("AB")) {
        if(press("A")) ans += "A";
        else ans += "B";
    }
    else {
        if(press("X")) ans += "X";
        else ans += "Y";
    }
    for(int i = 0; i < 4; i++) {
        if(t[i] == ans[0]) {
            t.erase(t.begin() + i);
            break;
        }
    }

    for(int i = 1; i < n - 1; i++) {
        string q = ans;
        q += t[1];
        for(int j = 0; j < 3; j++) {
            q += ans + t[0] + t[j];
        }
        int val = press(q);
        if(val == i + 1) {
            ans += t[1];
        }
        else if(val == i + 2) {
            ans += t[0];
        }
        else {
            ans += t[2];
        }
    }

    if(n > 2) {
        if(press(ans + t[0]) == n) {
            ans += t[0];
        }
        else if(press(ans + t[1]) == n) {
            ans += t[1];
        }
        else ans += t[2];
    }
    return ans;
}

详细

Subtask #1:

score: 5
Accepted

Test #1:

score: 5
Accepted
time: 0ms
memory: 3840kb

input:

ABB

output:

Accepted: 4

result:

points 1.0 Correct

Test #2:

score: 5
Accepted
time: 0ms
memory: 3712kb

input:

ABX

output:

Accepted: 5

result:

points 1.0 Correct

Test #3:

score: 5
Accepted
time: 0ms
memory: 3840kb

input:

ABY

output:

Accepted: 5

result:

points 1.0 Correct

Test #4:

score: 5
Accepted
time: 0ms
memory: 3840kb

input:

AXB

output:

Accepted: 4

result:

points 1.0 Correct

Test #5:

score: 5
Accepted
time: 0ms
memory: 3840kb

input:

AXX

output:

Accepted: 5

result:

points 1.0 Correct

Test #6:

score: 5
Accepted
time: 0ms
memory: 3840kb

input:

AXY

output:

Accepted: 5

result:

points 1.0 Correct

Test #7:

score: 5
Accepted
time: 0ms
memory: 3840kb

input:

AYB

output:

Accepted: 4

result:

points 1.0 Correct

Test #8:

score: 5
Accepted
time: 0ms
memory: 3840kb

input:

AYX

output:

Accepted: 5

result:

points 1.0 Correct

Test #9:

score: 5
Accepted
time: 0ms
memory: 3840kb

input:

AYY

output:

Accepted: 5

result:

points 1.0 Correct

Test #10:

score: 5
Accepted
time: 0ms
memory: 3840kb

input:

BAA

output:

Accepted: 4

result:

points 1.0 Correct

Test #11:

score: 5
Accepted
time: 0ms
memory: 3840kb

input:

BAX

output:

Accepted: 5

result:

points 1.0 Correct

Test #12:

score: 5
Accepted
time: 0ms
memory: 3840kb

input:

BAY

output:

Accepted: 5

result:

points 1.0 Correct

Test #13:

score: 5
Accepted
time: 0ms
memory: 3840kb

input:

BXA

output:

Accepted: 4

result:

points 1.0 Correct

Test #14:

score: 5
Accepted
time: 0ms
memory: 3840kb

input:

BXX

output:

Accepted: 5

result:

points 1.0 Correct

Test #15:

score: 5
Accepted
time: 0ms
memory: 3840kb

input:

BXY

output:

Accepted: 5

result:

points 1.0 Correct

Test #16:

score: 5
Accepted
time: 0ms
memory: 3840kb

input:

BYA

output:

Accepted: 4

result:

points 1.0 Correct

Test #17:

score: 5
Accepted
time: 0ms
memory: 3840kb

input:

BYX

output:

Accepted: 5

result:

points 1.0 Correct

Test #18:

score: 5
Accepted
time: 0ms
memory: 3840kb

input:

BYY

output:

Accepted: 5

result:

points 1.0 Correct

Test #19:

score: 5
Accepted
time: 0ms
memory: 3840kb

input:

XAA

output:

Accepted: 4

result:

points 1.0 Correct

Test #20:

score: 5
Accepted
time: 0ms
memory: 3840kb

input:

XAB

output:

Accepted: 5

result:

points 1.0 Correct

Test #21:

score: 5
Accepted
time: 0ms
memory: 3840kb

input:

XAY

output:

Accepted: 5

result:

points 1.0 Correct

Test #22:

score: 5
Accepted
time: 0ms
memory: 3840kb

input:

XBA

output:

Accepted: 4

result:

points 1.0 Correct

Test #23:

score: 5
Accepted
time: 0ms
memory: 3840kb

input:

XBB

output:

Accepted: 5

result:

points 1.0 Correct

Test #24:

score: 5
Accepted
time: 0ms
memory: 3840kb

input:

XBY

output:

Accepted: 5

result:

points 1.0 Correct

Test #25:

score: 5
Accepted
time: 0ms
memory: 3840kb

input:

XYA

output:

Accepted: 4

result:

points 1.0 Correct

Test #26:

score: 5
Accepted
time: 0ms
memory: 3840kb

input:

XYB

output:

Accepted: 5

result:

points 1.0 Correct

Test #27:

score: 5
Accepted
time: 0ms
memory: 3840kb

input:

XYY

output:

Accepted: 5

result:

points 1.0 Correct

Test #28:

score: 5
Accepted
time: 0ms
memory: 3840kb

input:

YAA

output:

Accepted: 4

result:

points 1.0 Correct

Test #29:

score: 5
Accepted
time: 0ms
memory: 3840kb

input:

YAB

output:

Accepted: 5

result:

points 1.0 Correct

Test #30:

score: 5
Accepted
time: 0ms
memory: 3840kb

input:

YAX

output:

Accepted: 5

result:

points 1.0 Correct

Test #31:

score: 5
Accepted
time: 0ms
memory: 3840kb

input:

YBA

output:

Accepted: 4

result:

points 1.0 Correct

Test #32:

score: 5
Accepted
time: 0ms
memory: 3840kb

input:

YBB

output:

Accepted: 5

result:

points 1.0 Correct

Test #33:

score: 5
Accepted
time: 0ms
memory: 3840kb

input:

YBX

output:

Accepted: 5

result:

points 1.0 Correct

Test #34:

score: 5
Accepted
time: 0ms
memory: 3840kb

input:

YXA

output:

Accepted: 4

result:

points 1.0 Correct

Test #35:

score: 5
Accepted
time: 0ms
memory: 3840kb

input:

YXB

output:

Accepted: 5

result:

points 1.0 Correct

Test #36:

score: 5
Accepted
time: 0ms
memory: 3840kb

input:

YXX

output:

Accepted: 5

result:

points 1.0 Correct

Subtask #2:

score: 0
Wrong Answer

Test #37:

score: 95
Accepted
time: 0ms
memory: 3840kb

input:

A

output:

Accepted: 2

result:

points 1.0 Correct. Query Count: 2 (no more than n+2).

Test #38:

score: 95
Accepted
time: 0ms
memory: 3840kb

input:

B

output:

Accepted: 2

result:

points 1.0 Correct. Query Count: 2 (no more than n+2).

Test #39:

score: 95
Accepted
time: 0ms
memory: 3840kb

input:

X

output:

Accepted: 2

result:

points 1.0 Correct. Query Count: 2 (no more than n+2).

Test #40:

score: 95
Accepted
time: 0ms
memory: 3840kb

input:

Y

output:

Accepted: 2

result:

points 1.0 Correct. Query Count: 2 (no more than n+2).

Test #41:

score: 0
Wrong Answer
time: 0ms
memory: 3840kb

input:

AB

output:

Wrong Answer: wrong guess

result:

wrong answer