QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#31380 | #2971. Wordle with Friends | mx | WA | 4ms | 3688kb | C++ | 1.3kb | 2022-05-07 17:52:28 | 2022-05-07 17:52:29 |
Judging History
answer
#include <algorithm>
#include <cmath>
#include <iostream>
#include <map>
#include <string>
#include <unordered_map>
#include <vector>
using namespace std;
typedef unsigned long long ull;
typedef long long ll;
//----------------------------------------------------------------
int main() {
int n, w;
string t, result, guess, inc = "";
vector<string> black(5), white(5), ex(5);
cin >> n >> w;
for (int i = 0; i < n; i++) {
string temp;
cin >> t >> result;
for (int j = 0; j < 5; j++) {
if (result[j] == '-') {
black[j] += t[j];
}
if (result[j] == 'G') {
white[j] += t[j];
}
if (result[j] == 'Y') {
ex[j] += t[j];
inc += t[j];
}
}
}
for (int i = 0; i < w; i++) {
cin >> guess;
bool flag = true;
string inc_test = inc;
for (int j = 0; j < 5; j++) {
if (black[j].find(guess[j]) != std::string::npos ||
ex[j].find(guess[j]) != std::string::npos) {
flag = false;
break;
}
if (white[j].size() > 0 && white[j][0] != guess[j]) {
flag = false;
break;
}
size_t pos = inc_test.find_first_of(guess[j]);
if (pos != std::string::npos) {
inc_test.erase(pos);
}
}
if (flag && inc_test.size() == 0) {
cout << guess << endl;
}
}
return 0;
}
详细
Test #1:
score: 100
Accepted
time: 2ms
memory: 3640kb
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: 3560kb
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: 3ms
memory: 3688kb
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: 3ms
memory: 3548kb
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: 4ms
memory: 3600kb
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: 3640kb
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:
SNEDS SNEER SNELL SNIBS SNIDE SNIFF SNIPE SNIPS SNITS SNOBS SNOGS SNOOD SNOOL SNOTS SNOWS SNOWY SNUBS SNUFF SNUGS SNYES
result:
wrong answer 1st lines differ - expected: 'SNIBS', found: 'SNEDS'