QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#90050#5854. Bot TrustChatGPT0 3ms3416kbC++231.1kb2023-03-22 03:15:342023-03-22 03:15:35

Judging History

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

  • [2023-08-10 23:21:45]
  • System Update: QOJ starts to keep a history of the judgings of all the submissions.
  • [2023-03-22 03:15:35]
  • 评测
  • 测评结果:0
  • 用时:3ms
  • 内存:3416kb
  • [2023-03-22 03:15:34]
  • 提交

answer

#include <iostream>
#include <vector>
#include <string>

using namespace std;

int main() {
    int T;
    cin >> T;
    for (int t = 1; t <= T; ++t) {
        int N;
        cin >> N;
        vector<pair<char, int>> buttons(N);
        for (int i = 0; i < N; ++i) {
            cin >> buttons[i].first >> buttons[i].second;
        }

        int time = 0;
        int time_O = 0, time_B = 0;
        int pos_O = 1, pos_B = 1;
        for (int i = 0; i < N; ++i) {
            char robot = buttons[i].first;
            int target = buttons[i].second;
            int time_target = abs(target - (robot == 'O' ? pos_O : pos_B)) + 1;
            int time_other = time_B - time_O;
            if (robot == 'O') {
                time_O += max(time_target, max(0, -time_other)) + 1;
                pos_O = target;
                time = time_O;
            } else {
                time_B += max(time_target, max(0, -time_other)) + 1;
                pos_B = target;
                time = time_B;
            }
        }

        cout << "Case #" << t << ": " << time << endl;
    }
    return 0;
}

Details

Tip: Click on the bar to expand more detailed information

Subtask #1:

score: 0
Wrong Answer

Test #1:

score: 0
Wrong Answer
time: 2ms
memory: 3404kb

input:

20
4 O 2 B 1 B 2 O 4
3 O 5 O 8 B 100
2 B 2 B 1
10 O 12 B 13 B 31 O 33 B 74 O 76 B 98 O 100 O 88 B 84
7 B 87 O 5 O 2 O 11 O 63 O 57 B 15
10 O 28 O 94 B 56 O 1 O 30 B 63 B 83 O 68 O 73 O 98
8 B 71 O 80 B 5 O 25 O 14 B 13 O 95 O 55
6 O 37 B 38 B 54 O 19 B 98 O 63
4 B 39 O 39 O 4 B 2
7 O 85 B 28 B 64 O ...

output:

Case #1: 7
Case #2: 101
Case #3: 6
Case #4: 122
Case #5: 162
Case #6: 381
Case #7: 317
Case #8: 104
Case #9: 79
Case #10: 192
Case #11: 157
Case #12: 10
Case #13: 183
Case #14: 1010
Case #15: 2
Case #16: 104
Case #17: 73
Case #18: 150
Case #19: 210
Case #20: 37

result:

wrong answer 1st lines differ - expected: 'Case #1: 6', found: 'Case #1: 7'

Subtask #2:

score: 0
Wrong Answer

Test #2:

score: 0
Wrong Answer
time: 3ms
memory: 3416kb

input:

100
4 O 2 B 1 B 2 O 4
3 O 5 O 8 B 100
2 B 2 B 1
56 O 19 B 19 O 6 B 5 B 22 O 26 O 13 B 37 O 27 B 23 O 64 B 61 O 21 B 20 B 45 O 47 B 33 O 35 B 18 O 21 B 60 O 63 B 92 O 32 O 3 B 60 O 40 B 95 O 8 B 64 B 86 O 32 B 97 O 22 B 83 O 8 B 47 O 43 O 28 B 31 O 54 B 6 B 47 O 98 O 73 B 76 O 92 B 93 B 67 O 65 O 22 ...

output:

Case #1: 7
Case #2: 101
Case #3: 6
Case #4: 768
Case #5: 878
Case #6: 1940
Case #7: 1990
Case #8: 958
Case #9: 2380
Case #10: 1072
Case #11: 1487
Case #12: 1450
Case #13: 1505
Case #14: 1602
Case #15: 1273
Case #16: 966
Case #17: 1369
Case #18: 2721
Case #19: 1275
Case #20: 816
Case #21: 1323
Case #...

result:

wrong answer 1st lines differ - expected: 'Case #1: 6', found: 'Case #1: 7'