QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#685038#8284. Cats and FishJoyeuse_Ordre#WA 0ms3892kbC++141.2kb2024-10-28 17:14:452024-10-28 17:14:46

Judging History

This is the latest submission verdict.

  • [2024-10-28 17:14:46]
  • Judged
  • Verdict: WA
  • Time: 0ms
  • Memory: 3892kb
  • [2024-10-28 17:14:45]
  • Submitted

answer

#include <bits/stdc++.h>
using namespace std;

inline int read() {
    int x = 0, f = 1;
    char ch = getchar();
    while (!isdigit(ch)) {
        if (ch == '-')
            f = -1;
        ch = getchar();
    }
    while (isdigit(ch)) {
        x = x * 10 + ch - '0';
        ch = getchar();
    }
    return x * f;
}

const int maxn = 1e5 + 5;
int n, m, x;
int c[maxn], nextfintime[maxn];

int main() {
    m = read(); n = read(); x = read();
    for (int i = 1; i <= n; i++)
        c[i] = read();
    sort(c + 1, c + n + 1);
    for (int i = 0; i <= x; i++) {
        for (int j = 1; j <= n; j++) {
            if (nextfintime[j]) nextfintime[j]--;
            if (!nextfintime[j] && m) {
                nextfintime[j] = c[j];
                m--;
            }
        }
        // printf("time: %d\n", i);
        // for (int j = 1; j <= n; j++) {
        //     printf("cat %d: %d\n", j, nextfintime[j]);
        // }

    }
    int imcomcnt = 0;
    for (int i = 1; i <= n; i++)
        if (nextfintime[i]) {
            imcomcnt++;
            // cout << i << ' ' << nextfintime[i] << " ";
        }
    printf("%d %d\n", m, imcomcnt);
    return 0;
}

Details

Tip: Click on the bar to expand more detailed information

Test #1:

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

input:

2 1 1
1

output:

0 1

result:

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