QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#31379#2971. Wordle with FriendsmxWA 5ms3652kbC++1.3kb2022-05-07 17:46:492022-05-07 17:46:50

Judging History

你现在查看的是最新测评结果

  • [2023-08-10 23:21:45]
  • System Update: QOJ starts to keep a history of the judgings of all the submissions.
  • [2022-05-07 17:46:50]
  • 评测
  • 测评结果:WA
  • 用时:5ms
  • 内存:3652kb
  • [2022-05-07 17:46:49]
  • 提交

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);
      }
      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: 3548kb

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

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

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

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: 4ms
memory: 3600kb

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: 5ms
memory: 3496kb

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'