QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#422020#8284. Cats and Fishucup-team228#WA 1ms3948kbC++202.2kb2024-05-26 16:39:342024-05-26 16:39:34

Judging History

This is the latest submission verdict.

  • [2024-05-26 16:39:34]
  • Judged
  • Verdict: WA
  • Time: 1ms
  • Memory: 3948kb
  • [2024-05-26 16:39:34]
  • Submitted

answer

#include <bits/stdc++.h>

using namespace std;

typedef long long ll;

string to_string(string a) { return '"' + a + '"'; }
string to_string(char a) { return "'" + string(1, a) + "'"; }
string to_string(const char* a) { return to_string((string) a); }
string to_string(bool a) { return a ? "true" : "false"; }
template <class T1, class T2>
string to_string(pair<T1, T2> a) {
    return "(" + to_string(a.first) + ", " + to_string(a.second) + ")";
}
template <class T>
string to_string(T a) {
    bool first = true; string res = "{";
    for (const auto& i : a) {
        if (!first) res += ", ";
        first = false;
        res += to_string(i);
    }
    res += "}";
    return res;
}
void debug_out() { cerr << endl; }
template <class T1, class... T2>
void debug_out(T1 a, T2... b) {
    cerr << " " << to_string(a);
    debug_out(b...);
}

#ifdef LOCAL
#define out(...) cerr << "[" << #__VA_ARGS__ << "]:", debug_out(__VA_ARGS__)
#else
#define out(...) 42
#endif

clock_t start_time; void start_timer() { start_time = clock(); }
double get_time() { return (double) (clock() - start_time) / CLOCKS_PER_SEC; }

void Solve();

int main() {
    ios_base::sync_with_stdio(0); cin.tie(0);
#ifdef LOCAL
    freopen("../input.txt", "r", stdin);
#endif
    start_timer();
    Solve();
#ifdef LOCAL
    cerr << fixed << setprecision(3);
    cerr << endl << "Time spent: " << get_time() << endl;
#endif
    return 0;
}

typedef pair<int, int> pii;

void Solve() {
    int m, n, x;
    cin >> m >> n >> x;
    vector<int> c(n);
    for (int i = 0; i < n; ++i) {
        cin >> c[i];
    }
    sort(c.begin(), c.end());
    set<pii> S;
    S.insert({x, -1});
    for (int i = 0; i < n && m > 0; ++i, --m) {
        S.insert({c[i], c[i]});
    }
    while (!S.empty()) {
        auto [t, d] = *S.begin();
        S.erase(S.begin());
        if (d == -1) {
            int p = m;
            while (!S.empty() && S.begin()->first == t) {
                S.erase(S.begin());
            }
            int q = S.size();
            cout << p << ' ' << q << '\n';
            return;
        }
        if (m > 0) {
            S.insert({t + d, d});
            --m;
        }
    }
    cout << "0 0\n";
}

详细

Test #1:

score: 100
Accepted
time: 1ms
memory: 3708kb

input:

2 1 1
1

output:

1 0

result:

ok 2 number(s): "1 0"

Test #2:

score: 0
Accepted
time: 1ms
memory: 3656kb

input:

8 3 5
1 3 4

output:

0 1

result:

ok 2 number(s): "0 1"

Test #3:

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

input:

4 5 1
5 4 3 2 1

output:

0 3

result:

ok 2 number(s): "0 3"

Test #4:

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

input:

1 1 10
1

output:

0 0

result:

ok 2 number(s): "0 0"

Test #5:

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

input:

14 3 10
1 40 50

output:

2 2

result:

ok 2 number(s): "2 2"

Test #6:

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

input:

8 2 7
12 13

output:

6 2

result:

ok 2 number(s): "6 2"

Test #7:

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

input:

1 1 1
2

output:

0 1

result:

ok 2 number(s): "0 1"

Test #8:

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

input:

12 2 11
8 3

output:

6 2

result:

ok 2 number(s): "6 2"

Test #9:

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

input:

2 2 12
24 1

output:

0 1

result:

ok 2 number(s): "0 1"

Test #10:

score: 0
Accepted
time: 1ms
memory: 3912kb

input:

562 8 232
17 26 800 12 77 32 11 2

output:

368 7

result:

ok 2 number(s): "368 7"

Test #11:

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

input:

562 8 1
17 26 800 12 77 32 11 1

output:

554 7

result:

ok 2 number(s): "554 7"

Test #12:

score: -100
Wrong Answer
time: 0ms
memory: 3872kb

input:

3656 13 123
1887 26 800 12 77 32 11 1 77 32 77 32 155

output:

3492 8

result:

wrong answer 1st numbers differ - expected: '3484', found: '3492'