QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#867488#2941. LetterleLaVuna47#AC ✓1ms3712kbC++201.9kb2025-01-23 17:06:122025-01-23 17:06:12

Judging History

This is the latest submission verdict.

  • [2025-01-23 17:06:12]
  • Judged
  • Verdict: AC
  • Time: 1ms
  • Memory: 3712kb
  • [2025-01-23 17:06:12]
  • Submitted

answer

//A tree without skin will surely die.
//A man without face is invincible.
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#include <bits/stdc++.h>

#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
#define sz(S) ((int)S.size())
#define FOR(i, st_, n) for(int i = st_; i < n; ++i)
#define RFOR(i, n, end_) for(int i = (n)-1; i >= end_; --i)
#define x first
#define y second
#define pb push_back
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<ll, ll> pll;
typedef pair<int, int> pii;
typedef pair<double, double> pdd;
typedef unsigned long long ull;
typedef long double LD;
typedef pair<ull, ull> pull;
using namespace __gnu_pbds;
typedef tree<ll, null_type, less<>, rb_tree_tag, tree_order_statistics_node_update> ordered_set;
using namespace std;
#ifdef ONPC
mt19937 rnd(228);
#else
mt19937 rnd(chrono::high_resolution_clock::now().time_since_epoch().count());
#endif


int solve()
{
	string word;
	if(!(cin>>word))return 1;
	int n=7;
	vector<string> g(n);
	FOR(i,0,n)cin>>g[i];
	set<char> s={all(word)};
	FOR(i,0,n)
	{
		string resp;
		FOR(j,0,sz(g[i]))
		{
			if(g[i][j]==word[j])resp+='G';
			else if(s.find(g[i][j])!=s.end()) resp += 'Y';
			else resp += 'X';
		}
		if(resp==string(sz(word),'G'))
		{
			cout<<"WINNER\n";
			return 0;
		}
		if(i==n-1)
		{
			cout<<"LOSER\n";
		}
		else
			cout<<resp<<'\n';
	}
    return 0;
}

int32_t main()
{
    ios::sync_with_stdio(0);
    cin.tie(0);
    int TET = 1e9;
    //cin >> TET;
    for (int i = 1; i <= TET; i++)
    {
        if (solve())
        {
            break;
        }
#ifdef ONPC
        cout << "__________________________" << endl;
#endif
    }
#ifdef ONPC
    cerr << endl << "finished in " << clock() * 1.0 / CLOCKS_PER_SEC << " sec" << endl;
#endif
}

Details

Tip: Click on the bar to expand more detailed information

Test #1:

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

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: 0ms
memory: 3712kb

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: 3712kb

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: 0ms
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: 3712kb

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: 3712kb

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: 3584kb

input:

TRUMP
PMURT
TURPM
UPMRT
PRUMT
MPUTR
MUPRT
TURMP

output:

YYGYY
GYYYY
YYYYY
YGGGY
YYGYY
YYYYY
LOSER

result:

ok 7 lines