QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#867509#2941. LetterleWeaRD276#AC ✓1ms3712kbC++201.5kb2025-01-23 17:37:402025-01-23 17:37:41

Judging History

This is the latest submission verdict.

  • [2025-01-23 17:37:41]
  • Judged
  • Verdict: AC
  • Time: 1ms
  • Memory: 3712kb
  • [2025-01-23 17:37:40]
  • Submitted

answer

#include <bits/stdc++.h>
using namespace std;

#include  <ext/pb_ds/assoc_container.hpp>
#include  <ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;

template<class T>
using ordered_set = tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;

#define sz(x) (int)(x).size()
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
#define pb push_back
#define x first
#define y second
#define FOR(i, a, b) for(int i = (a); i < (b); i++)
#define RFOR(i, a, b) for(int i = (a) - 1; i >= (b); i--)

typedef long long ll;
typedef double db;
typedef long double LD;
typedef pair<int, int> pii;
typedef pair<db, db> pdd;
typedef pair<ll, ll> pll;


int solve()
{
	string s;
	if (!(cin >> s))
		return 1;
	
	set<char> has;
	FOR (i, 0, 5)
		has.insert(s[i]);
	FOR (i, 0, 7)
	{
		string g;
		cin >> g;
		if (g == s)
		{
			cout << "WINNER\n";
			return 0;
		}
		string resp = "";
		FOR (j, 0, 5)
		{
			if (g[j] == s[j])
				resp += 'G';
			else if (has.count(g[j]))
				resp += 'Y';
			else
				resp += 'X';
		}
		if (i != 6)
			cout << resp << '\n';
		else
			cout << "LOSER\n";
	}
	//cout << "LOSER\n";
	
	return 0;
}

int32_t main()
{
	ios::sync_with_stdio(0);
	cin.tie(0);
	
	int TET = 1;
	//cin >> TET;
	for (int i = 1; i <= TET; i++)
	{
		if (solve())
		{
			break;
		}
		#ifdef ONPC
			cerr << "_____________________________\n";
		#endif
	}
	#ifdef ONPC
		cerr << "\nfinished in " << clock() * 1.0 / CLOCKS_PER_SEC << " sec\n";
	#endif
	return 0;
}

Details

Tip: Click on the bar to expand more detailed information

Test #1:

score: 100
Accepted
time: 0ms
memory: 3456kb

input:

LIMIT
ABCDE
FGHIJ
KLMNO
PQRST
LIMIT
LEMET
LAMET

output:

XXXXX
XXXGX
XYGXX
XXXXG
WINNER

result:

ok 5 lines

Test #2:

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

input:

LIMIT
ABCDE
FGHIJ
KLMNO
PQRST
LAMIT
LEMIT
LOMIT

output:

XXXXX
XXXGX
XYGXX
XXXXG
GXGGG
GXGGG
LOSER

result:

ok 7 lines

Test #3:

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

input:

AAAAA
ABCDE
ABCDA
ABABA
ABAAA
AAAAA
AAAAA
AAAAA

output:

GXXXX
GXXXG
GXGXG
GXGGG
WINNER

result:

ok 5 lines

Test #4:

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

input:

AAAAA
ABCDE
ABCDA
ABABA
ABAAA
AAAAA
AABAA
BAAAB

output:

GXXXX
GXXXG
GXGXG
GXGGG
WINNER

result:

ok 5 lines

Test #5:

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

input:

AAAAA
ABCDE
ABCDA
ABABA
ABAAA
AABAA
AAAAA
BAAAB

output:

GXXXX
GXXXG
GXGXG
GXGGG
GGXGG
WINNER

result:

ok 6 lines

Test #6:

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

input:

AAAAA
ABCDE
ABCDA
ABABA
ABAAA
AABAA
BAAAB
AAAAA

output:

GXXXX
GXXXG
GXGXG
GXGGG
GGXGG
XGGGX
WINNER

result:

ok 7 lines

Test #7:

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

input:

AAAAA
AAAAA
ABCDE
ABCDA
ABABA
ABAAA
AABAA
BAAAB

output:

WINNER

result:

ok single line: 'WINNER'

Test #8:

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

input:

TRUMP
PMURT
TURPM
UPMRT
TRUMP
MPUTR
MUPRT
TURMP

output:

YYGYY
GYYYY
YYYYY
WINNER

result:

ok 4 lines

Test #9:

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

input:

TRUMP
TRUMP
PMURT
TURPM
UPMRT
MPUTR
MUPRT
TURMP

output:

WINNER

result:

ok single line: 'WINNER'

Test #10:

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

input:

TRUMP
PMURT
TRUMP
TURPM
UPMRT
MPUTR
MUPRT
TURMP

output:

YYGYY
WINNER

result:

ok 2 lines

Test #11:

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

input:

TRUMP
PMURT
TURPM
UPMRT
MPUTR
MUPRT
TURMP
TRUMP

output:

YYGYY
GYYYY
YYYYY
YYGYY
YYYYY
GYYGG
WINNER

result:

ok 7 lines

Test #12:

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

input:

TRUMP
PMURT
TURPM
UPMRT
PRUMT
MPUTR
MUPRT
TURMP

output:

YYGYY
GYYYY
YYYYY
YGGGY
YYGYY
YYYYY
LOSER

result:

ok 7 lines