QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#533338#5087. Shuffle Gameskrghariapa#WA 0ms3848kbC++171.1kb2024-08-25 20:32:322024-08-25 20:32:32

Judging History

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

  • [2024-08-25 20:32:32]
  • 评测
  • 测评结果:WA
  • 用时:0ms
  • 内存:3848kb
  • [2024-08-25 20:32:32]
  • 提交

answer

#include<bits/stdc++.h>
#define fastio ios_base::sync_with_stdio(false);cin.tie(NULL);
using namespace std;
using ll = long long;

int main(){
    map <string, int> pos;
    string x[502];
    string p1[502];
    string p2[502];
    int n, p, q, ans;
    cin>>n>>p>>q;

    for(int i = 0; i < n; i++){
        cin>>x[i];
    }
    for(int i = 0; i < p; i++){
        cin>>p1[i];
        pos[p1[i]] = 1;
    }
    for(int i = 0; i < q; i++){
        cin>>p2[i];
        pos[p2[i]] = 2;
    }

    ans = n;
    int cnt1 = 0, cnt2 = 0;
    for(int i = 0; i < n; i++){
        if(pos[x[i]] == 1){
            while(p1[cnt1] != x[i] && cnt1 < p){
                // cout<<x[i]<<" "<<p1[cnt1]<<endl;
                pos[p1[cnt1]] = 0;
                ans--;
                cnt1++;
            }
            cnt1++;
        }
        if(pos[x[i]] == 2){
            while(p2[cnt2] != x[i] && cnt2 < q){
                // cout<<x[i]<<" "<<p2[cnt2]<<endl;
                pos[p2[cnt2]] = 0;
                ans--;
                cnt2++;
            }
            cnt2++;
        }
    }
    cout<<ans<<endl;
}

Details

Tip: Click on the bar to expand more detailed information

Test #1:

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

input:

5 2 3
CJ D5 HA C2 S7
D5 HA
CJ S7 C2

output:

4

result:

ok single line: '4'

Test #2:

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

input:

6 3 3
C9 HK SQ SQ H2 CA
CA HK SQ
H2 C9 SQ

output:

4

result:

ok single line: '4'

Test #3:

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

input:

7 3 4
S9 C10 DJ S6 S7 SA DQ
DJ S6 S7
S9 C10 SA DQ

output:

7

result:

ok single line: '7'

Test #4:

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

input:

10 1 9
CJ CJ CJ CJ CJ CJ CJ CJ CJ CJ
CJ
CJ CJ CJ CJ CJ CJ CJ CJ CJ

output:

10

result:

ok single line: '10'

Test #5:

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

input:

10 4 6
D2 D2 D2 D2 D2 D2 D2 D2 D2 D2
D2 D2 D2 D2
D2 D2 D2 D2 D2 D2

output:

10

result:

ok single line: '10'

Test #6:

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

input:

10 3 7
C7 C9 S6 C8 SK C3 DJ S7 H4 CA
S6 C8 C3
C7 C9 SK DJ S7 H4 CA

output:

10

result:

ok single line: '10'

Test #7:

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

input:

10 8 2
HQ H2 C10 D5 C5 C6 C6 S4 DJ D8
HQ H2 C10 D5 C5 C6 S4 DJ
C6 D8

output:

8

result:

wrong answer 1st lines differ - expected: '10', found: '8'