QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#54804#2971. Wordle with FriendsBeevo#WA 2ms3728kbC++231.2kb2022-10-10 16:12:192022-10-10 16:12:21

Judging History

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

  • [2023-08-10 23:21:45]
  • System Update: QOJ starts to keep a history of the judgings of all the submissions.
  • [2022-10-10 16:12:21]
  • 评测
  • 测评结果:WA
  • 用时:2ms
  • 内存:3728kb
  • [2022-10-10 16:12:19]
  • 提交

answer

#include <bits/stdc++.h>

#define el '\n'
#define ll long long
#define ld long double

#define Beevo ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);

using namespace std;

bool valid(string &s, string &t, string &p) {
    vector<int> freqS(26), freqT(26, -1);
    for (int i = 0; i < 5; i++) {
        if (p[i] == 'G' && s[i] != t[i])
            return 0;

        freqS[s[i] - 'A']++;

        if (!~freqT[t[i] - 'A'])
            freqT[t[i] - 'A'] = 0;

        if (p[i] != '-')
            freqT[t[i] - 'A']++;
    }

    for (int i = 0; i < 26; i++) {
        if (!~freqT[i])
            continue;

        if (freqS[i] != freqT[i])
            return 0;
    }

    return 1;
}

void testCase() {
    int n, m;
    cin >> n >> m;

    vector<string> v(n), p(n);
    for (int i = 0; i < n; i++)
        cin >> v[i] >> p[i];

    string s;
    while (m--) {
        cin >> s;

        bool can = 1;
        for (int i = 0; i < n; i++)
            can &= valid(s, v[i], p[i]);

        if (can)
            cout << s << el;
    }
}

signed main() {
    Beevo

    int T = 1;
//    cin >> T;

    while (T--)
        testCase();

    return 0;
}

詳細信息

Test #1:

score: 100
Accepted
time: 2ms
memory: 3712kb

input:

2 5
BERRY -G---
APPLE ---YY
MELON
BERRY
LEMON
LIMES
APPLE

output:

MELON
LEMON

result:

ok 2 lines

Test #2:

score: 0
Accepted
time: 2ms
memory: 3676kb

input:

3 5
BERRY -G---
APPLE ---YY
LIMES G-GY-
APPLE
BERRY
LEMON
LIMES
MELON

output:

LEMON

result:

ok single line: 'LEMON'

Test #3:

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

input:

3 5
BLANK --Y--
SIGHS ----G
STORM YGG-Y
ATOMS
BLANK
MOATS
SIGHS
STORM

output:

ATOMS

result:

ok single line: 'ATOMS'

Test #4:

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

input:

4 5
FRUIT -G--Y
NUTTY --Y--
ROOTS Y--YG
SEEDS -YG-G
FRUIT
NUTTY
ROOTS
SEEDS
TREES

output:

TREES

result:

ok single line: 'TREES'

Test #5:

score: 0
Accepted
time: 2ms
memory: 3616kb

input:

4 8916
ALPHA ----G
GAMMA Y--GG
DELTA ----G
OMEGA -Y-YG
AAHED
AALII
AARGH
ABACA
ABACI
ABACK
ABAFT
ABAKA
ABAMP
ABASE
ABASH
ABATE
ABAYA
ABBAS
ABBES
ABBEY
ABBOT
ABEAM
ABELE
ABETS
ABHOR
ABIDE
ABLED
ABLER
ABLES
ABMHO
ABODE
ABOHM
ABOIL
ABOMA
ABOON
ABORT
ABOUT
ABOVE
ABRIS
ABUSE
ABUTS
ABUZZ
ABYES
ABYSM
ABYSS...

output:

SIGMA

result:

ok single line: 'SIGMA'

Test #6:

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

input:

3 8916
SHARP G----
HEART -----
KNACK -G---
AAHED
AALII
AARGH
ABACA
ABACI
ABACK
ABAFT
ABAKA
ABAMP
ABASE
ABASH
ABATE
ABAYA
ABBAS
ABBES
ABBEY
ABBOT
ABEAM
ABELE
ABETS
ABHOR
ABIDE
ABLED
ABLER
ABLES
ABMHO
ABODE
ABOHM
ABOIL
ABOMA
ABOON
ABORT
ABOUT
ABOVE
ABRIS
ABUSE
ABUTS
ABUZZ
ABYES
ABYSM
ABYSS
ACARI
ACERB...

output:

SNIFF
SNOOD
SNOOL
SNOWY
SNUFF

result:

wrong answer 1st lines differ - expected: 'SNIBS', found: 'SNIFF'