QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#31378 | #2971. Wordle with Friends | mx | WA | 5ms | 3648kb | C++ | 1.4kb | 2022-05-07 17:44:40 | 2022-05-07 17:44:42 |
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 = false;
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);
continue;
}
flag = true;
}
if (flag && inc_test.size() == 0) {
cout << guess << endl;
}
}
return 0;
}
Details
Tip: Click on the bar to expand more detailed information
Test #1:
score: 100
Accepted
time: 3ms
memory: 3560kb
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: 3ms
memory: 3616kb
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: 3636kb
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: 3520kb
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: 5ms
memory: 3552kb
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: 1ms
memory: 3648kb
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'