编号 题目 状态 分数 总时间 内存 代码 / 答案文件 提交者 提交时间
#19793 #2034. 弦论 Accepted 100 622 ms 696 K C++ 17 / 1.9 K admin 2024-11-26 17:44:14
显示原始代码
#ifdef ONLINE_JUDGE
#pragma GCC optimize(2, "Ofast", "inline")
#endif
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#define rt return

#define pi pair<int, int>

#define pl pair<ll, ll>

#define pu pair<ull, ull>

#define int long long

#define ll long long

#define ull unsigned long long

#define all(x) x.begin(), x.end()

#define all1(x) next(x.begin()), x.end()

#define lll __int128_t

#define ulll __uint128_t

using namespace std;
const int64_t maxn = 1e5 + 50;
const int64_t mod = 998244353;
const int64_t maxl = (int64_t)(2e18) + 5;
const int64_t maxi = 1e9 + 7;
int trie[1000][26];
int fa[1000];
char kind[1000];
int idx = 1;
void init() {}
void solve() {
    int n, m;
    cin >> n >> m;
    string s;
    auto ask = [&](string &s) {
        cout << "? " << s << endl;
        int tp;
        cin >> tp;
        assert(tp >= 0);
        rt tp;
    };
    int maxdep = 0, lastidx = 0;
    auto dfs = [&](auto &&self, int idxx, string &s, int dep) -> void {
        if (dep > maxdep) {
            maxdep = dep;
            lastidx = idxx;
        }
        for (int i = 0; i < 26; i++) {
            s += (char)('a' + i);
            if (ask(s)) {
                trie[idxx][i] = idx;
                fa[idx] = idxx;
                kind[idx] = 'a' + i;
                idx++;
                self(self, trie[idxx][i], s, dep + 1);
            }
            s.pop_back();
        }
    };
    dfs(dfs, 0, s, 0);
    string ss;
    while (lastidx) {
        ss.push_back(kind[lastidx]);
        lastidx = fa[lastidx];
    }
    reverse(all(ss));
    cout << "! " << ss << endl;
}
signed main() {
    std::ios::sync_with_stdio(0);
    std::cin.tie(0);
    int __ = 1;
    // std::cin >> __;
    init();
    while (__--) {
        solve();
        // cerr<<"TIME"<<qq-__<<endl;
    }
    return 0;
}
子任务 #1
Accepted
得分:100
测试点 #1
Accepted
得分:100
用时:6 ms
内存:444 KiB

输入文件(test0.in

3
aaa
aba
aab

Special Judge 信息

Accepted !
You use 182 times to solve it!

系统信息

Exited with return code 0
测试点 #2
Accepted
得分:100
用时:5 ms
内存:420 KiB

输入文件(test1.in

4
a
aa
aaa
aaaa

Special Judge 信息

Accepted !
You use 130 times to solve it!

系统信息

Exited with return code 0
测试点 #3
Accepted
得分:100
用时:64 ms
内存:452 KiB

输入文件(test2.in

10
nkwmvklswnkowtqxcclctwfvredkxvntahj
edegzioahsostgygpwlwnepcgcfr
dyaysafsmbjxvzftshevngv
qnaz
<124 bytes omitted>

Special Judge 信息

Accepted !
You use 5174 times to solve it!

系统信息

Exited with return code 0
测试点 #4
Accepted
得分:100
用时:62 ms
内存:584 KiB

输入文件(test3.in

10
imgjjqp
ctpqgmgtjnuezgqcvziipdy
tqkuy
zkczcmykpilltjfnytbipkmedykntu
ibcvofljwjighrznmvgwkya
<124 bytes omitted>

Special Judge 信息

Accepted !
You use 5174 times to solve it!

系统信息

Exited with return code 0
测试点 #5
Accepted
得分:100
用时:66 ms
内存:552 KiB

输入文件(test4.in

10
gwdgeqlydtsmnjivjzurmr
pbzsnhrgecmca
pqxlgdnugrano
mxkmmlacz
yinihwudzfhrjgrtfqgdexalkhoibeb
<124 bytes omitted>

Special Judge 信息

Accepted !
You use 5174 times to solve it!

系统信息

Exited with return code 0
测试点 #6
Accepted
得分:100
用时:57 ms
内存:468 KiB

输入文件(test5.in

10
n
g
lmxqvoyukcpefjfjtpfttvsgvnjr
wxpydrasgsojr
belsdx
ckdaibdgecaizpslctopxyjgfaqwwdbnzgpao
<124 bytes omitted>

Special Judge 信息

Accepted !
You use 5200 times to solve it!

系统信息

Exited with return code 0
测试点 #7
Accepted
得分:100
用时:59 ms
内存:480 KiB

输入文件(test6.in

1
aoplenhinpdctzmtttxxdwbvmueoprykffouypqrsfcimiecnergckxxrbubsyzniikqpvoiwzhxmzrhrvkpijvezsotkltmv
<105 bytes omitted>

Special Judge 信息

Accepted !
You use 5226 times to solve it!

系统信息

Exited with return code 0
测试点 #8
Accepted
得分:100
用时:62 ms
内存:696 KiB

输入文件(test7.in

1
uunkjoipguwsiecjiroakvrnevaeujoabtnyetjapsezhxeawpcjgwomvjovfbbzqxadvvkizphsxttyiqyuyyxohevzvkvqz
<105 bytes omitted>

Special Judge 信息

Accepted !
You use 5226 times to solve it!

系统信息

Exited with return code 0
测试点 #9
Accepted
得分:100
用时:63 ms
内存:568 KiB

输入文件(test8.in

1
aoplenhinpdctzmtttxxdwbvmueoprykffouypqrsfcimiecnergckxxrbubsyzniikqpvoiwzhxmzrhrvkpijvezsotkltmv
<105 bytes omitted>

Special Judge 信息

Accepted !
You use 5226 times to solve it!

系统信息

Exited with return code 0
测试点 #10
Accepted
得分:100
用时:63 ms
内存:480 KiB

输入文件(test9.in

1
uunkjoipguwsiecjiroakvrnevaeujoabtnyetjapsezhxeawpcjgwomvjovfbbzqxadvvkizphsxttyiqyuyyxohevzvkvqz
<105 bytes omitted>

Special Judge 信息

Accepted !
You use 5226 times to solve it!

系统信息

Exited with return code 0
测试点 #11
Accepted
得分:100
用时:54 ms
内存:564 KiB

输入文件(test10.in

2
aoplenhinpdctzmtttxxdwbvmueoprykffouypqrsfcimiecnergckxxrbubsyzniikqpvoiwzhxmzrhrvkpijvezsotkltmv
<107 bytes omitted>

Special Judge 信息

Accepted !
You use 5226 times to solve it!

系统信息

Exited with return code 0
测试点 #12
Accepted
得分:100
用时:61 ms
内存:596 KiB

输入文件(test11.in

2
uunkjoipguwsiecjiroakvrnevaeujoabtnyetjapsezhxeawpcjgwomvjovfbbzqxadvvkizphsxttyiqyuyyxohevzvkvqz
<107 bytes omitted>

Special Judge 信息

Accepted !
You use 5226 times to solve it!

系统信息

Exited with return code 0