QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#325974#5592. Family Visitsanpans#WA 0ms3580kbC++14910b2024-02-12 06:20:212024-02-12 06:20:21

Judging History

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

  • [2024-02-12 06:20:21]
  • 评测
  • 测评结果:WA
  • 用时:0ms
  • 内存:3580kb
  • [2024-02-12 06:20:21]
  • 提交

answer

#include <iostream>
#include <vector>
#include <algorithm>
#include <cstdio>
#include <queue>

using namespace std;

int n, d;
int m[1000], c[1000];

int main() {
    cin >> n >> d;
    int pointer = 0;
    while (pointer < n) {
        cin >> m[pointer] >> c[pointer];
        pointer++;
    }
    pointer = 0;
    int ret = 0, curr = 0, visit;
    while (pointer++ < d) {
        priority_queue<int> s;
        int mess = 0;
        cin >> visit;
        while (visit - 1 >= curr) {
            s.push(c[curr]);
            mess += m[curr++];
        }
        while (!s.empty()) {
            mess -= s.top();
            cout << s.top() << endl;
            s.pop();
            ret++;
            if (mess <= 0) break;
        }
        if (mess > 0) {
            cout << -1 << endl;
            return 0;
        }
    }
    cout << ret << endl;
    return 0;
}

详细

Test #1:

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

input:

6 2
1 2
2 1
1 4
3 2
3 6
2 3
3
6

output:

4
6
3
3

result:

wrong answer 1st lines differ - expected: '3', found: '4'