QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#688252#2941. Letterlekevinyang#AC ✓1ms3840kbC++171.4kb2024-10-30 01:34:012024-10-30 01:34:02

Judging History

This is the latest submission verdict.

  • [2024-10-30 01:34:02]
  • Judged
  • Verdict: AC
  • Time: 1ms
  • Memory: 3840kb
  • [2024-10-30 01:34:01]
  • Submitted

answer

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

#define rep(i, a, b) for(int i = a; i < (b); ++i)
#define all(x) begin(x), end(x)
#define sz(x) (int)(x).size()
typedef long long ll;
typedef pair<int, int> pii;
typedef vector<int> vi;

string solve(string s, string t){
    string ans = "XXXXX";
    vector<bool>vis(5);
    vector<bool>used(5);
    for(int i = 0; i<5; i++){
        if(s[i] == t[i]){
            vis[i] = true;
            used[i] = true;
            ans[i] = 'G';
        }
    }
    for(int i = 0; i<5; i++){
        if(used[i])continue;
        int idx = -1;
        for(int j = 0; j<5; j++){
            if(vis[j])continue;
            if(s[j] == t[i]){
                idx = j;
                break;
            }
        }
        if(idx >= 0){
            used[i] = true;
            ans[i] = 'Y';
            vis[idx] = true;
        }
    }
    return ans;
}

signed main() {
    cin.tie(0)->sync_with_stdio(0);
    string s;
    cin >> s;
    vector<string>a(7);
    for(int i = 0; i<7; i++){
        cin >> a[i];
    }
    for(int i = 0; i<7; i++){
        string res = solve(s,a[i]);
        if(res == "GGGGG"){
            cout << "WINNER\n";
            return 0;
        }
        else if(i == 6){
            cout << "LOSER\n";
        }
        else{
            cout << res << '\n';
        }
    }
    return 0;
}

详细

Test #1:

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

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

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

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: 1ms
memory: 3808kb

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

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

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

input:

AAAAA
AAAAA
ABCDE
ABCDA
ABABA
ABAAA
AABAA
BAAAB

output:

WINNER

result:

ok single line: 'WINNER'

Test #8:

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

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

input:

TRUMP
TRUMP
PMURT
TURPM
UPMRT
MPUTR
MUPRT
TURMP

output:

WINNER

result:

ok single line: 'WINNER'

Test #10:

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

input:

TRUMP
PMURT
TRUMP
TURPM
UPMRT
MPUTR
MUPRT
TURMP

output:

YYGYY
WINNER

result:

ok 2 lines

Test #11:

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

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

input:

TRUMP
PMURT
TURPM
UPMRT
PRUMT
MPUTR
MUPRT
TURMP

output:

YYGYY
GYYYY
YYYYY
YGGGY
YYGYY
YYYYY
LOSER

result:

ok 7 lines