QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#451008#5560. Hardcore HangmanEbiarat#WA 1ms3764kbC++203.1kb2024-06-22 20:23:382024-06-22 20:23:38

Judging History

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

  • [2024-06-22 20:23:38]
  • 评测
  • 测评结果:WA
  • 用时:1ms
  • 内存:3764kb
  • [2024-06-22 20:23:38]
  • 提交

answer

#include <iostream>
#include <string>
#include <set>
#include <map>
#include <algorithm>
#include <iomanip>
#include <vector>
#include <cmath>
#include <queue>
#include <sstream>
#include <ctime>
#include <iterator>
#include <string.h>
#include <stack>
#include <unordered_set>
#include <unordered_map>
#include <bitset>
#include <fstream>
#include <assert.h>
#include <numeric>
#include <complex>
#include <random>
#include <utility>



#define IOS ios_base::sync_with_stdio(0),cin.tie(0), cout.tie(0);
#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--)
#define rep(i,n) FOR(i,0,n)
#define PB push_back
#define SZ(a) (int)a.size()
#define ALL(a) a.begin(), a.end()
#define VI vector<int>
#define PII pair<int,int>
#define PLL pair<long long,long long>
#define VL vector<long long >
#define FILL(a, value) memset(a, value, sizeof(a))
const int nax = 2 * (int)1e5 + 147;
 
using namespace std;
 
const int MOD = 998244353;
const int INF = 1e9 +47 ;
const long long LINF = (long long)1e18 + 4747;
 
typedef long long LL;
const double EPS=1e-6;


int main() {
    int len = 0;
    cout << '?' << ' ';
    for(int i = 0;i < 26;i ++) {
        cout << (char)('a' + i);
    }
    cout << endl;
    int cc;
    cin >> cc;
    len = cc;
    
    for(int i = 0;i < cc;i ++ ) {
        int x;
        cin >> x;
    }
    vector<int >mask(5);
    vector<vector<int>>vec;
    vec.resize(5);
    for(int it = 0; it < 5;it ++ ) {
        int msk = 0;
        cout << '?' << ' ';
        for(int j =0 ;j < 26;j ++ )
        {
            if(j & (1 << it)){
                msk|=(1 << j);
                cout << (char)('a' + j);
            }
        }
        cout << endl;
        int cc;
        cin >> cc;
        for(int i =0 ;i <cc;i ++ ) {
            int x;
            cin >> x;
            --x;
            vec[it].push_back(x);
        }
        mask[it] = msk;
    }
    string ans(len,'a');
    for(int i =1 ;i < 26;i ++ ) {
        set<int > s;
        for(int it =0;it < 5;it ++ ) {
            if(mask[it] & (1 << i)) {
                for(int j =0 ;j < vec[0].size();j++) {
                    s.insert(vec[0][j]);
                }
                break;
            }
        }
        for(int it =0;it <5;it++) {
            if(mask[it] & ( 1 << i )) {
                set<int> t ;
                
                for(int j =0;j < vec[it].size();j ++ ) {
                    t.insert(vec[it][j]);
                }
                vector<int> to_del;
                for(auto x : s)
                {
                    if(!t.count(x))to_del.push_back(x);
                }
                for(auto x : to_del) {
                    s.erase(x);
                }
            }
            else {
                for(int j = 0;j < vec[it].size();j ++ ) {
                    s.erase(vec[it][j]);
                }
            }
        }
        for(auto x : s) {
            ans[x] = (char)('a' + i);
        }
    }
    cout << '!' << ' ' << ans << endl;
}

Details

Tip: Click on the bar to expand more detailed information

Test #1:

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

input:

6 1 2 3 4 5 6
3 1 3 5
0
2 3 5
2 3 5
0
correct

output:

? abcdefghijklmnopqrstuvwxyz
? bdfhjlnprtvxz
? cdghklopstwx
? efghmnopuvwx
? ijklmnopyz
? qrstuvwxyz
! banana

result:

ok Queries used: 7

Test #2:

score: -100
Wrong Answer
time: 1ms
memory: 3764kb

input:

13 1 2 3 4 5 6 7 8 9 10 11 12 13
1 3
8 1 2 3 4 6 8 10 11
7 1 3 8 9 11 12 13
4 3 5 11 12
3 6 8 10
incorrect

output:

? abcdefghijklmnopqrstuvwxyz
? bdfhjlnprtvxz
? cdghklopstwx
? efghmnopuvwx
? ijklmnopyz
? qrstuvwxyz
! aapaaaaaaaaaa

result:

wrong answer format  Unexpected end of file - token expected