結果

問題 No.2768 Password Crack
ユーザー 乾麺乾麺
提出日時 2024-05-31 22:19:49
言語 C++23
(gcc 12.3.0 + boost 1.83.0)
結果
WA  
実行時間 -
コード長 1,464 bytes
コンパイル時間 4,338 ms
コンパイル使用メモリ 302,604 KB
実行使用メモリ 25,220 KB
平均クエリ数 962.60
最終ジャッジ日時 2024-05-31 22:19:57
合計ジャッジ時間 8,175 ms
ジャッジサーバーID
(参考情報)
judge5 / judge4
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 28 ms
24,556 KB
testcase_01 AC 25 ms
25,220 KB
testcase_02 WA -
testcase_03 AC 31 ms
24,580 KB
testcase_04 AC 72 ms
24,580 KB
testcase_05 AC 32 ms
24,836 KB
testcase_06 AC 69 ms
24,836 KB
testcase_07 AC 35 ms
24,964 KB
testcase_08 AC 36 ms
25,220 KB
testcase_09 AC 68 ms
24,580 KB
testcase_10 AC 74 ms
24,964 KB
testcase_11 AC 69 ms
24,964 KB
testcase_12 AC 73 ms
24,580 KB
testcase_13 AC 73 ms
25,220 KB
testcase_14 AC 73 ms
24,836 KB
testcase_15 AC 64 ms
24,964 KB
testcase_16 AC 69 ms
25,220 KB
testcase_17 AC 69 ms
25,220 KB
testcase_18 AC 68 ms
25,192 KB
testcase_19 AC 48 ms
25,088 KB
testcase_20 AC 44 ms
25,220 KB
testcase_21 AC 67 ms
24,964 KB
testcase_22 AC 60 ms
24,836 KB
testcase_23 AC 35 ms
24,580 KB
testcase_24 AC 45 ms
24,952 KB
testcase_25 AC 68 ms
24,964 KB
testcase_26 AC 45 ms
24,580 KB
testcase_27 AC 61 ms
24,964 KB
testcase_28 AC 36 ms
24,964 KB
testcase_29 AC 39 ms
24,964 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
#include <atcoder/dsu>
#include <atcoder/segtree>
using namespace atcoder;
using namespace std;
typedef long long ll;
typedef pair<ll,ll> pi;
#define ALL(x) x.begin(),x.end()
#define rep(i,a,b) for(int i=a;i<b;i++)
#define BS(A,x) binary_search(ALL(A),x)
#define LB(A,x) (ll)(lower_bound(ALL(A),x)-A.begin())
#define UB(A,x) (ll)(upper_bound(ALL(A),x)-A.begin())
#define COU(A,x) (UB(A,x)-LB(A,x))
using vi = vector<int>; 
using vvi = vector<vi>; 
using li =vector<ll>;
using lli=vector<li>;
using si =vector<char>;
using ssi =vector<si>;
const long long INF = 1e18;
const long long MOD=1e9+7;
//for (auto [key, val] : mp)
int main() { int n;cin>>n;string ans="";
vector<string>vec(n);
map<string,int>mp;
map<int,string>MP;
mp["a"]=0;
mp["b"]=1;
mp["c"]=2;
mp["e"]=4;
mp["d"]=3;
mp["f"]=5;
mp["g"]=6;
mp["h"]=7;
mp["i"]=8;
mp["j"]=9;
mp["k"]=10;
mp["l"]=11;
mp["m"]=12;
mp["n"]=13;
mp["o"]=14;
mp["p"]=15;
mp["q"]=16;
mp["r"]=17;
mp["s"]=18;
mp["t"]=19;
mp["u"]=20;
mp["v"]=21;
mp["w"]=22;
mp["x"]=23;
mp["y"]=24;
mp["z"]=25;
for(auto[a,b]:mp)MP[b]=a;
rep(i,0,n)vec[i]="a";
	rep(i,0,n){string ch="";
	rep(j,0,n)ch+=vec[j];
	cout<<"? "<<ch<<endl;
	int a;cin>>a;
	rep(j,1,26){ch="";
			rep(k,0,n){if(k!=i)ch+=vec[k];
			else ch+=MP[j];}
			cout<<"? "<<ch<<endl;
			int b;cin>>b;
			if(b>a){vec[i]=MP[j];break;}
			else if(b<a)break;
			else if(j==25)vec[i]="z";
		}
	}
	rep(i,0,n)ans+=vec[i];
	cout<<"! "<<ans<<endl;
}
0