QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#809727#9873. Last Chance: Threads of DespairYUKIIWA 0ms3524kbC++141.5kb2024-12-11 16:58:212024-12-11 16:58:28

Judging History

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

  • [2024-12-11 16:58:28]
  • 评测
  • 测评结果:WA
  • 用时:0ms
  • 内存:3524kb
  • [2024-12-11 16:58:21]
  • 提交

answer

#include <iostream>
#include <vector>
#include <algorithm>

using namespace std;

using ll = unsigned long long;

int main() {
    char const* yes = "Yes", * no = "No";
    int n, size1, size2, temp, deadline, hurt;
    vector<int> vec1, vec2;
    cin >> n;
    while (n--) {
        cin >> size1 >> size2;
        for (int i = 0; i < size1; ++i) {
            cin >> temp;
            vec1.push_back(temp);
        }
        for (int i = 0; i < size2; ++i) {
            cin >> temp;
            vec2.push_back(temp);
        }

        sort(vec1.begin(), vec1.end());
        sort(vec2.begin(), vec2.end());

        hurt = size1 + 1;
        deadline = 0;
        for (int i = 0; i < size1 && vec1[i] == 1; ++i) {
            --hurt;
            ++deadline;
        }
        int idx1 = 0, idx2 = 0;
        while (hurt) {
            while (idx1 < size1 && vec1[idx1] <= deadline) {
                cout << vec1[idx1] << ' ' << deadline << endl;
                ++idx1, ++deadline;
            }
            while (idx2 < size2 && vec2[idx2] <= deadline) {
                ++idx2, ++deadline;
            }
            if (idx2 == size2 || idx1 == size1) {
                break;
            }
            --hurt, --vec1[idx1], --vec2[idx2];
        }
        if (idx2 == size2) {
            cout << yes << endl;
        } else {
            cout << no << endl;
        }
        vec1.clear(), vec2.clear();
    }
    return 0;
}

Details

Tip: Click on the bar to expand more detailed information

Test #1:

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

input:

3
3 2
1 1 4
2 6
3 2
1 1 4
2 7
2 1
100 100
2

output:

1 2
1 3
4 4
Yes
1 2
1 3
4 4
No
Yes

result:

wrong output format YES or NO expected, but 1 found [1st token]