QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#344934 | #3805. Promotions | PetroTarnavskyi# | Compile Error | / | / | C++20 | 1.6kb | 2024-03-05 19:25:27 | 2024-03-05 19:25:29 |
Judging History
answer
vector<LL> solve(string s, int w)
{
int n = SZ(s);
VI sa = suffixArray(s);
VI lcp = lcpArray(s, sa);
VI rnk(n);
FOR(i, 0, n)
rnk[sa[i]] = i;
//[start, end)
map<PII, int> start;
map<PII, int> end;
set<PII> poses;
FOR(i, 0, w)
{
poses.insert({rnk[i], i});
}
int prev = -1;
for(auto [rn, i] : poses)
{
if(prev != -1)
start[MP(pre, i)] = 0;
prev = i;
}
FOR(i, 1, n - w + 1)
{
//remove i - 1
auto it = poses.find(MP(rnk[i - 1], i - 1));
assert(it != poses.end());
int pre = -1;
int nxt = -1;
if(it != poses.begin())
{
pre = prev(it)->S;
end[MP(pre, i - 1)] = i;
}
if(next(it) != poses.end())
{
nxt = next(it)->S;
end[MP(i - 1, nxt)] = i;
}
poses.erase(it);
if(pre != -1 && nxt != -1)
start[MP(pre, nxt)] = i;
//add i + w - 1;
poses.insert(MP(rnk[i + w - 1], i + w - 1));
auto it = poses.find(MP(rnk[i + w - 1], i + w - 1));
assert(it != poses.end());
int pre = -1;
int nxt = -1;
if(it != poses.begin())
{
pre = prev(it)->S;
start[MP(pre, i - 1)] = i;
}
if(next(it) != poses.end())
{
nxt = next(it)->S;
start[MP(i - 1, nxt)] = i;
}
if(pre != -1 && nxt != -1)
end[MP(pre, nxt)] = i;
}
prev = -1;
for(auto [rn, i] : poses)
{
}
}
int main()
{
ios::sync_with_stdio(0);
cin.tie(0);
string s;
cin >> s;
int q, w;
cin >> q >> w;
auto res = solve(s, w);
while(q--)
{
int pos;
cin >> pos;
cout << res[pos - 1] << "\n";
}
详细
answer.code:2:8: error: ‘LL’ was not declared in this scope 2 | vector<LL> solve(string s, int w) | ^~ answer.code:2:8: error: ‘LL’ was not declared in this scope answer.code:2:8: error: ‘LL’ was not declared in this scope answer.code:2:8: error: ‘LL’ was not declared in this scope answer.code:2:8: error: ‘LL’ was not declared in this scope answer.code:2:8: error: ‘LL’ was not declared in this scope answer.code:2:8: error: ‘LL’ was not declared in this scope answer.code:2:8: error: ‘LL’ was not declared in this scope answer.code:2:8: error: ‘LL’ was not declared in this scope answer.code:2:1: error: ‘vector’ does not name a type 2 | vector<LL> solve(string s, int w) | ^~~~~~ answer.code: In function ‘int main()’: answer.code:92:9: error: ‘ios’ has not been declared 92 | ios::sync_with_stdio(0); | ^~~ answer.code:93:9: error: ‘cin’ was not declared in this scope 93 | cin.tie(0); | ^~~ answer.code:96:9: error: ‘string’ was not declared in this scope 96 | string s; | ^~~~~~ answer.code:97:16: error: ‘s’ was not declared in this scope 97 | cin >> s; | ^ answer.code:101:20: error: ‘solve’ was not declared in this scope 101 | auto res = solve(s, w); | ^~~~~ answer.code:107:17: error: ‘cout’ was not declared in this scope 107 | cout << res[pos - 1] << "\n"; | ^~~~ answer.code:108:10: error: expected ‘}’ at end of input 108 | } | ^ answer.code:91:1: note: to match this ‘{’ 91 | { | ^