結果
| 問題 |
No.2768 Password Crack
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2024-07-05 14:16:45 |
| 言語 | C++23 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
AC
|
| 実行時間 | 96 ms / 2,000 ms |
| コード長 | 2,290 bytes |
| コンパイル時間 | 3,277 ms |
| コンパイル使用メモリ | 248,288 KB |
| 実行使用メモリ | 25,220 KB |
| 平均クエリ数 | 1785.17 |
| 最終ジャッジ日時 | 2024-07-05 14:16:53 |
| 合計ジャッジ時間 | 7,160 ms |
|
ジャッジサーバーID (参考情報) |
judge4 / judge5 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 1 |
| other | AC * 29 |
コンパイルメッセージ
In file included from /home/linuxbrew/.linuxbrew/Cellar/gcc@12/12.3.0/include/c++/12/ios:40,
from /home/linuxbrew/.linuxbrew/Cellar/gcc@12/12.3.0/include/c++/12/istream:38,
from /home/linuxbrew/.linuxbrew/Cellar/gcc@12/12.3.0/include/c++/12/sstream:38,
from /home/linuxbrew/.linuxbrew/Cellar/gcc@12/12.3.0/include/c++/12/complex:45,
from /home/linuxbrew/.linuxbrew/Cellar/gcc@12/12.3.0/include/c++/12/ccomplex:39,
from /home/linuxbrew/.linuxbrew/Cellar/gcc@12/12.3.0/include/c++/12/x86_64-pc-linux-gnu/bits/stdc++.h:54,
from main.cpp:1:
In static member function 'static constexpr void std::char_traits<char>::assign(char_type&, const char_type&)',
inlined from 'constexpr void std::__cxx11::basic_string<_CharT, _Traits, _Alloc>::push_back(_CharT) [with _CharT = char; _Traits = std::char_traits<char>; _Alloc = std::allocator<char>]' at /home/linuxbrew/.linuxbrew/Cellar/gcc@12/12.3.0/include/c++/12/bits/basic_string.h:1537:21,
inlined from 'constexpr std::__cxx11::basic_string<_CharT, _Traits, _Alloc>& std::__cxx11::basic_string<_CharT, _Traits, _Alloc>::operator+=(_CharT) [with _CharT = char; _Traits = std::char_traits<char>; _Alloc = std::allocator<char>]' at /home/linuxbrew/.linuxbrew/Cellar/gcc@12/12.3.0/include/c++/12/bits/basic_string.h:1359:17,
inlined from 'int main()' at main.cpp:61:16:
/home/linuxbrew/.linuxbrew/Cellar/gcc@12/12.3.0/include/c++/12/bits/char_traits.h:358:14: warning: 'a' may be used uninitialized [-Wmaybe-uninitialized]
358 | __c1 = __c2;
| ~~~~~^~~~~~
main.cpp: In function 'int main()':
main.cpp:49:14: note: 'a' was declared here
49 | char a;
| ^
ソースコード
#include <bits/stdc++.h>
using namespace std;
#ifdef LOCAL
#define _GLIBCXX_DEBUG
#include "algo/debug.h"
#else
#define debug(...) void(0)
#endif
using ll = long long;
using ld = long double;
const ll linf=(1LL<<60) - 1;
const int inf=(1LL<<30) - 1;
#define len(obj) int(obj.size())
#define overload4(a,b,c,d,name,...) name
#define overload5(a,b,c,d,e,name,...) name
#define rep1(n) for(long long _=0;_<n;++_)
#define rep2(i,n) for(long long i=0;i<n;++i)
#define rep3(i,a,b) for(long long i=a;i<b;++i)
#define rep4(i,a,b,c) for(long long i=a;i<b;i+=c)
#define rep(...) overload4(__VA_ARGS__,rep4,rep3,rep2,rep1)(__VA_ARGS__)
#define rrep1(n) for(ll _=n-1;_>=0;--_)
#define rrep2(i,n) for(ll i=n-1;i>=0;--i)
#define rrep3(i,a,b) for(ll i=b-1;i>=a;--i)
#define rrep4(i,a,b,c) for(ll i=(a)+((b)-(a)-1)/(c)*(c);i>=(a);i-=c)
#define rrep(...) overload4(__VA_ARGS__,rrep4,rrep3,rrep2,rrep1)(__VA_ARGS__)
#define each1(i,a) for(auto&&i:a)
#define each2(x,y,a) for(auto&&[x,y]:a)
#define each3(x,y,z,a) for(auto&&[x,y,z]:a)
#define each4(w,x,y,z,a) for(auto&&[w,x,y,z]:a)
#define each(...) overload5(__VA_ARGS__,each4,each3,each2,each1)(__VA_ARGS__)
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
#define vec(type,name,...) vector<type> name(__VA_ARGS__)
#define vv(type,name,h,...) vector name(h,vector<type>(__VA_ARGS__))
#define vvv(type,name,h,w,...) vector name(h,vector(w,vector<type>(__VA_ARGS__)))
#define vvvv(type, name, h, w, n, ...) vector<vector<vector<vector<type>>>> name(h, vector<vector<vector<type>>>(w, vector<vector<type>>(n, vector<type>(__VA_ARGS__))))
struct Setting{ Setting(){ cin.tie(nullptr)->sync_with_stdio(0); fixed(cout).precision(12); } }Setting;
//-----------------------------------
void query(string t) {
cout << "? " << t << endl;
}
int main() {
const int M = 2500;
int N; cin >> N;
string T = string(N, 'a'), ans = "";
rep(i, N) {
int mx = -1, mi = inf;
char a;
for(char s = 'a'; s <= 'y'; s++) {
T[i] = s;
query(T);
int t; cin >> t;
if(mx < t) {
mx = t;
a = s;
}
mi = min(mi, t);
}
if(mx == mi) a = 'z';
ans += a;
}
cout << "! " << ans << endl;
}