QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#451006 | #5560. Hardcore Hangman | Ebiarat# | WA | 1ms | 3536kb | C++20 | 3.3kb | 2024-06-22 20:22:52 | 2024-06-22 20:22:53 |
Judging History
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;
}
}
if(i == 1) {
for(auto x : s)cout << x << ' ';
cout << '\n';
}
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]);
}
}
}
if(i == 1) {
for(auto x : s) { cout << x << ' ';}
cout << '\n';
}
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: 0
Wrong Answer
time: 1ms
memory: 3536kb
input:
6 1 2 3 4 5 6 3 1 3 5 0 2 3 5 2 3 5 0
output:
? abcdefghijklmnopqrstuvwxyz ? bdfhjlnprtvxz ? cdghklopstwx ? efghmnopuvwx ? ijklmnopyz ? qrstuvwxyz 0 2 4 0 ! banana
result:
wrong answer unknown command 0