QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#246717#5161. Last Guessthanhchauns2#WA 1ms3620kbC++203.1kb2023-11-11 01:31:552023-11-11 01:31:56

Judging History

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

  • [2023-11-11 01:31:56]
  • 评测
  • 测评结果:WA
  • 用时:1ms
  • 内存:3620kb
  • [2023-11-11 01:31:55]
  • 提交

answer

#include "bits/stdc++.h"
#include "ext/pb_ds/assoc_container.hpp"
#include "ext/pb_ds/tree_policy.hpp"
//@etohari
using namespace std;
using namespace __gnu_pbds;

#define my_wife "She belongs to another guy"
#define bit(mask,i) ((mask >> i)&1)
#define cntbit(mask) __builtin_popcountll(mask)
#define all(a) a.begin(), a.end()
#define rall(a) a.rbegin(), a.rend()
#define uniquev(v) sort(all(v)), (v).resize(unique(all(v)) - (v).begin())
#define sz(s) (int32_t)s.size()
#define __lcm(a,b) ((int64_t)a / __gcd(a, b) * b)
#define rand(l, r) uniform_int_distribution < int64_t > (l, r)(rng)
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
#define ordered_set tree < int32_t, null_type, less < int32_t >, rb_tree_tag,tree_order_statistics_node_update >

void etohari();
void init(){};

signed main() {
        cin.tie(NULL)->sync_with_stdio(false);
        // https://www.facebook.com/hai290605
        constexpr bool MULTITEST = 0;
        // https://codeforces.com/profile/I_Will_Marry_Ngoc
        init();
        int32_t test = 1;
        if (MULTITEST) cin >> test;
        for (int32_t i_test = 1; i_test <= test; i_test ++){
                etohari();
                cout << "\n";
        }
        return (0 ^ 0);
}

template < class T > bool minimum(T& a, T& b) { return b < a ? a = b, 1 : 0; }
template < class T > bool maximum(T& a, T& b) { return a < b ? a = b, 1 : 0; }

constexpr int32_t MAXN = 1e3 + 10;
constexpr int32_t MAXM = 1e6 + 10; 
constexpr int32_t MOD = 1e9 + 7;
constexpr int32_t INF = 0x3f3f3f3f;
constexpr long double PI = 3.14159265358979323846;

constexpr int16_t DR[] = { };
constexpr int16_t DC[] = { };

bool check1[MAXN], check[MAXN], check2[MAXN];
char ans[MAXN];

void etohari(){ 
        int n, m;
        cin >> m >> n;

        fill(ans, ans + n, ' ');

        for (int i = 1; i < m; i ++){
                string a, b;
                cin >> a >> b;
                for (int j = 0; j < n; j ++){
                        if (b[j] == 'Y' && !check[a[j]])check1[a[j]] = true;
                        if (b[j] == 'G')check2[a[j]] = true, ans[j] = a[j];
                        if (b[j] == 'B' && !check1[a[j]])check[a[j]] = true;
                }
        }

        for (int i = 0; i < n; i ++){
                if (ans[i] == ' '){
                        bool qp = true;
                        for (int j = 'a'; j <= 'z'; j ++){
                                if (check1[j] == true){
                                        check1[j] = false;
                                        if (check2[j])continue;
                                        ans[i] = j;
                                        qp = false;
                                        break;
                                }
                        }
                        if (qp == true)
                        for (int j = 'a'; j <= 'z'; j ++){
                                if (check[j] == true)continue;
                                ans[i] = j;
                                break;
                        }
                }
                cout << ans[i];
        }
}

Details

Tip: Click on the bar to expand more detailed information

Test #1:

score: 0
Wrong Answer
time: 1ms
memory: 3620kb

input:

4 5
reply YYGBB
refer BBBGG
puppy YYGBB

output:

uaper

result:

FAIL Wrong answer: does not fit word 2