QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#398811#8284. Cats and FishHHY_zZhu#WA 0ms3684kbC++23857b2024-04-25 18:28:222024-04-25 18:28:23

Judging History

This is the latest submission verdict.

  • [2024-04-25 18:28:23]
  • Judged
  • Verdict: WA
  • Time: 0ms
  • Memory: 3684kb
  • [2024-04-25 18:28:22]
  • Submitted

answer

#include<bits/stdc++.h>
using namespace std;
#define pb push_back
#define V vector
typedef long long LL;
const int mod = 998244353;
LL qpow(int x, LL k) {
    LL ans = 1;
    while(k) {
        if(k & 1) ans = ans * x % mod;
        x = 1LL * x * x % mod;
        k >>= 1;
    }
    return ans;
}
LL a[5005];
void solve() {
    int m,n,x;
    cin>>m>>n>>x;
    for(int i=1;i<=n;i++){
        cin>>a[i];
    }
    sort(a+1,a+1+n);
    int c0=m,c1=0;

    for(int i=1;i<=x;i++){
        for(int j=1;j<=n;j++){
            if(i%a[j]==1%a[j]){
                if(c0>0)
                c0--,c1++;
            }
            if(i%a[j]==0){
                if(c1>0)
                c1--;
            }
        }
    }
    cout<<c0<<' '<<c1<<'\n';
}

int main() {
    int t = 1; 
    // cin >> t;
    while(t--) solve();
}

Details

Tip: Click on the bar to expand more detailed information

Test #1:

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

input:

2 1 1
1

output:

1 0

result:

ok 2 number(s): "1 0"

Test #2:

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

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: 3604kb

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: 3680kb

input:

1 1 10
1

output:

0 0

result:

ok 2 number(s): "0 0"

Test #5:

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

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: 3608kb

input:

8 2 7
12 13

output:

6 2

result:

ok 2 number(s): "6 2"

Test #7:

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

input:

1 1 1
2

output:

0 1

result:

ok 2 number(s): "0 1"

Test #8:

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

input:

12 2 11
8 3

output:

6 2

result:

ok 2 number(s): "6 2"

Test #9:

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

input:

2 2 12
24 1

output:

0 0

result:

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