結果
| 問題 |
No.3317 ワロングアンサーロングアンサーンスワロンガー
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2025-10-31 23:27:02 |
| 言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 808 bytes |
| コンパイル時間 | 1,715 ms |
| コンパイル使用メモリ | 200,804 KB |
| 実行使用メモリ | 7,720 KB |
| 最終ジャッジ日時 | 2025-10-31 23:27:19 |
| 合計ジャッジ時間 | 16,642 ms |
|
ジャッジサーバーID (参考情報) |
judge4 / judge2 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | WA * 2 RE * 1 |
| other | WA * 40 RE * 15 TLE * 1 -- * 6 |
ソースコード
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
std::vector<ll> Ls;
ll len(char c, int t) {
if (c == 'a' || c == 'w') {
return Ls[t];
} else {
return 1;
}
}
vector<string> S(26);
char calc(const string& s, int t, ll x) {
if (x == 0) {
return s[0];
}
for (auto& c : s) {
if (x < len(c, t)) {
return calc(S[c - 'a'], t-1, x);
}
x -= len(c, t);
}
assert(false);
}
int main () {
int N, Q;
cin >> N >> Q;
{
ll fl = 1;
int id = 0;
while (fl <= (ll)1e18) {
Ls.push_back(fl);
fl += (1ll << id) * 5;
id ++;
}
}
for (int i = 0; i < 26; i ++) {
S[i] = string(1, 'a' + (char)i);
}
S[0] = "answer"; S[22] = "warong";
string s;
cin >> s;
while (Q--) {
ll t, x;
cin >> t >> x;
t = min(t, (ll)Ls.size() - 1);
cout << calc(s, t, x) << endl;
}
}