QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#660664#9470. Cats and Fishucup-team1001#AC ✓0ms3792kbC++20977b2024-10-20 12:35:402024-10-20 12:35:40

Judging History

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

  • [2024-10-20 12:35:40]
  • 评测
  • 测评结果:AC
  • 用时:0ms
  • 内存:3792kb
  • [2024-10-20 12:35:40]
  • 提交

answer

#include "bits/stdc++.h"


using namespace std;
using i64 = long long;

const i64 mod = 1e9 + 7;
const i64 inf = 1e18;
#define endl '\n'


void solve() {

}

int main() {
    int n, m, x;
    while (cin >> m >> n >> x) {
        vector<int> v(n + 1);
        int left = m;
        // 结束时间 速度
        priority_queue<pair<int, int>, vector<pair<int, int>>, greater<>> q;
        for (int i = 1; i <= n; i++) {
            cin >> v[i];
            q.push({0, v[i]});
        }
        while (!q.empty()) {
            if (q.top().first >= x) {
                break;
            }
            if (left == 0) {
                break;
            }
            auto [t, s] = q.top();
            q.pop();
            q.emplace(t + s, s);
            left--;
        }
        while (!q.empty() && q.top().first <= x) {
            q.pop();
        }
        cout << left << " " << q.size() << endl;


    }
    return 0;
}

详细

Test #1:

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

input:

2 1 1
1
8 3 5
1 3 4
4 5 1
5 4 3 2 1

output:

1 0
0 1
0 3

result:

ok 3 lines

Test #2:

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

input:

1 1 10
1
14 3 10
1 40 50
8 2 7
12 13
1 1 1
2
12 2 11
8 3
2 2 12
24 1
562 8 232
17 26 800 12 77 32 11 2
562 8 1
17 26 800 12 77 32 11 1
3656 13 123
1887 26 800 12 77 32 11 1 77 32 77 32 155

output:

0 0
2 2
6 2
0 1
6 2
0 1
368 7
554 7
3484 12

result:

ok 9 lines