QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#372826#3657. Fantasy DraftAymanM04WA 1ms3844kbC++231.3kb2024-03-31 19:40:182024-03-31 19:40:18

Judging History

This is the latest submission verdict.

  • [2024-03-31 19:40:18]
  • Judged
  • Verdict: WA
  • Time: 1ms
  • Memory: 3844kb
  • [2024-03-31 19:40:18]
  • Submitted

answer

#include <bits/stdc++.h>
using namespace std;
int main() {
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);

    int n, k;
    cin >>n >>k;
    vector<queue<string>> pl(n), ans(n);
    for(int i = 0; i < n; i++) {
        int q;
        cin >>q;
        while(q--) {
            string s;
            cin >>s;
            pl[i].push(s);
        }
    }

    map<string, int> encode;
    map<int, string> decode;

    int p;
    cin >>p;

    for(int i = 0; i < p; i++) {
        string s;
        cin >>s;
        encode[s] = i;
        decode[i] = s;
    }

    for(int m = 0; m < k; m++) {

        for(int i = 0; i < n; i++) {
            while(pl[i].size() && encode.find(pl[i].front()) == encode.end())
                pl[i].pop();

            if(pl[i].size()) {
                ans[i].push(pl[i].front());
                decode.erase(encode[pl[i].front()]);
                encode.erase(pl[i].front());
                pl[i].pop();
            }
            else {
                ans[i].push(decode.begin()->second);
                decode.erase(decode.begin());
            }
        }

    }

    for(int i = 0; i < n; i++) {
        while(ans[i].size()) {
            cout <<ans[i].front() <<' ';
            ans[i].pop();
        }
        cout <<'\n';
    }
}

详细

Test #1:

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

input:

2 2
0
0
6
Shoresy
Jonesy
Reilly
Sholtzy
Fisky
Yorkie

output:

Shoresy Reilly 
Jonesy Sholtzy 

result:

ok 2 lines

Test #2:

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

input:

2 2
2 Reilly Shoresy
2 Shoresy Reilly
6
Shoresy
Jonesy
Reilly
Sholtzy
Fisky
Yorkie

output:

Reilly Jonesy 
Shoresy Sholtzy 

result:

ok 2 lines

Test #3:

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

input:

1 1
0
1
Jonesy

output:

Jonesy 

result:

ok single line: 'Jonesy '

Test #4:

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

input:

1 1
1 Jonesy
1
Jonesy

output:

Jonesy 

result:

ok single line: 'Jonesy '

Test #5:

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

input:

1 1
1 Jonesy
2
Reilly
Jonesy

output:

Jonesy 

result:

ok single line: 'Jonesy '

Test #6:

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

input:

1 1
1 Reilly
2
Reilly
Jonesy

output:

Reilly 

result:

ok single line: 'Reilly '

Test #7:

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

input:

1 2
2 Jonesy Reilly
2
Reilly
Jonesy

output:

Jonesy Reilly 

result:

ok single line: 'Jonesy Reilly '

Test #8:

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

input:

1 2
2 Reilly Jonesy
2
Reilly
Jonesy

output:

Reilly Jonesy 

result:

ok single line: 'Reilly Jonesy '

Test #9:

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

input:

3 5
0
0
0
15
Murzyn
Houston
Murray
Guenette
Czarnik
Dollas
Cassels
Dowd
Bourgeois
Eriksson
Pardy
Raymond
Hay
Sarault
Titov

output:

Murzyn Guenette Cassels Eriksson Hay 
Houston Czarnik Dowd Pardy Sarault 
Murray Dollas Bourgeois Raymond Titov 

result:

ok 3 lines

Test #10:

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

input:

2 2
0
0
4
Godynyuk
Riggin
Petrovicky
Huscroft

output:

Godynyuk Petrovicky 
Riggin Huscroft 

result:

ok 2 lines

Test #11:

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

input:

3 2
0
0
0
6
Hannan
Stiles
Gould
Fleury
McCarthy
Negrin

output:

Hannan Fleury 
Stiles McCarthy 
Gould Negrin 

result:

ok 3 lines

Test #12:

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

input:

2 4
0
0
8
Dwyer
Butler
Peters
McCarty
Backstrom
Habscheid
Meyer
Giguere

output:

Dwyer Peters Backstrom Meyer 
Butler McCarty Habscheid Giguere 

result:

ok 2 lines

Test #13:

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

input:

3 5
0
0
0
15
Cavallini
Ingarfield
Hrdina
Desbiens
Albelin
Chernomaz
Korn
Guenette
Joseph
LaVallee
Giguere
Keetley
Bodak
Domenichelli
Hlushko

output:

Cavallini Desbiens Korn LaVallee Bodak 
Ingarfield Albelin Guenette Giguere Domenichelli 
Hrdina Chernomaz Joseph Keetley Hlushko 

result:

ok 3 lines

Test #14:

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

input:

5 3
1 Fleury
0
1 Freer
1 Westgarth
1 Eakins
15
Helenius
Irving
Morris
Roberts
Eakins
Dahlquist
Larose
Petrovicky
Westgarth
Kronwall
Freer
Fleury
Churla
Stempniak
Patrick

output:

Fleury Irving Petrovicky 
Helenius Morris Kronwall 
Freer Roberts Churla 
Westgarth Dahlquist Stempniak 
Eakins Larose Patrick 

result:

ok 5 lines

Test #15:

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

input:

1 2
1 Musil
2
Hanson
Musil

output:

Musil Hanson 

result:

ok single line: 'Musil Hanson '

Test #16:

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

input:

2 3
0
0
6
Hlushko
Kennedy
Cyr
Lindsay
Bozek
Foo

output:

Hlushko Cyr Bozek 
Kennedy Lindsay Foo 

result:

ok 2 lines

Test #17:

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

input:

1 4
3 Chouinard Albelin Konroyd
4
Chouinard
Albelin
Hull
Konroyd

output:

Chouinard Albelin Konroyd Hull 

result:

ok single line: 'Chouinard Albelin Konroyd Hull '

Test #18:

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

input:

4 2
2 Millen Cervenka
5 Walker Millen Cervenka Nystrom Colborne
6 Nazarov Millen Colborne Bartkowski Walker Cervenka
1 Grossmann
8
Nystrom
Nazarov
Bartkowski
Colborne
Millen
Walker
Grossmann
Cervenka

output:

Millen Cervenka 
Walker Nystrom 
Nazarov Colborne 
Grossmann Bartkowski 

result:

ok 4 lines

Test #19:

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

input:

3 1
0
2 Wilm Hulse
2 Sarich Wilm
3
Sarich
Hulse
Wilm

output:

Sarich 
Wilm 
Sarich 

result:

wrong answer 3rd lines differ - expected: 'Hulse', found: 'Sarich '