QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#55455 | #2971. Wordle with Friends | MahmoudAtia# | WA | 3ms | 4020kb | C++ | 1.6kb | 2022-10-13 20:16:06 | 2022-10-13 20:16:08 |
Judging History
answer
#include <bits/stdc++.h>
typedef long double ld;
typedef long long ll;
using namespace std;
int di[] = {1, 0, -1, -1, 0, 1, -1, 1};
int dj[] = {1, 1, 0, -1, -1, 0, 1, -1};
const ll oo = 1e18, MOD = 998244353;
const int N = 1e4 + 5, M = 350;
const ld PI = acos(-1.0), EPS = 1e-9;
//#include <ext/pb_ds/assoc_container.hpp>
//#include <ext/pb_ds/tree_policy.hpp>
//using namespace __gnu_pbds;
//typedef tree<int, null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update> ordered_set;
int n, a[N], m, mn[26], mx[26];
string s[N], ans;
//#define endl '\n'
int main() {
ios_base::sync_with_stdio(0), cin.tie(0), cout.tie(0);
//freopen("farm.in", "r", stdin);
//memset(dp, -1, sizeof dp);
fill(mx, mx + 26, 5);
ans = "-----";
cin >> n >> m;
while (n--) {
string s1, s2;
cin >> s1 >> s2;
int f[26] = {0}, no[26] = {0};
for (int i = 0; i < 5; i++) {
if (s2[i] == 'G') ans[i] = s1[i];
if (s2[i] != '-') f[s1[i] - 'A']++;
if (s2[i] == '-') no[s1[i] - 'A'] = 1;
}
for (int i = 0; i < 26; i++) {
mn[i] = max(mn[i], f[i]);
if (no[i]) mx[i] = min(mx[i], f[i]);
}
}
while (m--) {
string s;
cin >> s;
bool yes = 1;
int f[26] = {0};
for (int i = 0; i < 5; i++) {
if (ans[i] != '-' && s[i] != ans[i]) yes = 0;
f[s[i] - 'A']++;
}
for (int i = 0; i < 26; i++) if (f[i] < mn[i] || f[i] > mx[i]) yes = 0;
if (yes) cout << s << '\n';
}
return 0;
}
Details
Tip: Click on the bar to expand more detailed information
Test #1:
score: 100
Accepted
time: 0ms
memory: 4020kb
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: 3812kb
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: 2ms
memory: 3944kb
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: 0ms
memory: 3924kb
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: 3936kb
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: 0
Accepted
time: 1ms
memory: 3856kb
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:
SNIBS SNIFF SNOBS SNOGS SNOOD SNOOL SNOWS SNOWY SNUBS SNUFF SNUGS
result:
ok 11 lines
Test #7:
score: 0
Accepted
time: 3ms
memory: 3988kb
input:
3 8916 MOUNT -G--- AREAS -Y--- KICKS --GG- 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:
ROCKY
result:
ok single line: 'ROCKY'
Test #8:
score: -100
Wrong Answer
time: 3ms
memory: 3940kb
input:
3 8916 IRATE Y--G- STAIR YY-Y- RAISE --YY- 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:
BINTS BITTS CHITS CISTS DINTS DOITS DUITS FISTS FLITS GIFTS GILTS GISTS HILTS HINTS HISTS JILTS KILTS KISTS KNITS LIFTS LILTS LINTS LISTS MILTS MINTS MISTS MISTY MITTS OBITS OMITS PINTS QUITS SIFTS SILTS SILTY SIXTH SIXTY SKITS SLITS SMITH SNITS SPITS SPITZ SUITS SWITH TILTS TINTS TOITS TWITS UNITS ...
result:
wrong answer 3rd lines differ - expected: 'CISTS', found: 'CHITS'