結果

問題 No.2768 Password Crack
ユーザー ooaiuooaiu
提出日時 2024-07-05 14:16:45
言語 C++23
(gcc 12.3.0 + boost 1.83.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
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 23 ms
25,196 KB
testcase_01 AC 19 ms
25,220 KB
testcase_02 AC 84 ms
24,836 KB
testcase_03 AC 96 ms
24,824 KB
testcase_04 AC 82 ms
24,836 KB
testcase_05 AC 26 ms
24,580 KB
testcase_06 AC 83 ms
24,952 KB
testcase_07 AC 85 ms
24,836 KB
testcase_08 AC 36 ms
24,580 KB
testcase_09 AC 84 ms
25,220 KB
testcase_10 AC 85 ms
24,836 KB
testcase_11 AC 84 ms
24,964 KB
testcase_12 AC 83 ms
25,208 KB
testcase_13 AC 83 ms
24,452 KB
testcase_14 AC 96 ms
24,836 KB
testcase_15 AC 83 ms
24,836 KB
testcase_16 AC 82 ms
24,580 KB
testcase_17 AC 83 ms
24,836 KB
testcase_18 AC 85 ms
24,836 KB
testcase_19 AC 52 ms
24,964 KB
testcase_20 AC 51 ms
25,220 KB
testcase_21 AC 84 ms
24,836 KB
testcase_22 AC 68 ms
25,220 KB
testcase_23 AC 31 ms
24,836 KB
testcase_24 AC 45 ms
24,580 KB
testcase_25 AC 81 ms
25,220 KB
testcase_26 AC 49 ms
24,836 KB
testcase_27 AC 70 ms
24,836 KB
testcase_28 AC 32 ms
24,580 KB
testcase_29 AC 37 ms
24,836 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
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;
      |              ^

ソースコード

diff #

#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;
}
0