QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#358177 | #3176. Candy Chain | PetroTarnavskyi# | Compile Error | / | / | C++20 | 1.5kb | 2024-03-19 17:59:56 | 2024-03-19 17:59:57 |
Judging History
This is the latest submission verdict.
- [2024-03-19 17:59:57]
- Judged
- Verdict: Compile Error
- Time: 0ms
- Memory: 0kb
- [2024-03-19 17:59:56]
- Submitted
answer
#include <bits/stdc++.h>
using namespace std;
#define FOR(i, a, b) for(int i = (a); i < (b); i++)
#define RFOR(i, a, b) for(int i = (a) - 1; i >= (b); i--)
#define SZ(a) int(a.size())
#define ALL(a) a.begin(), a.end()
#define PB push_back
#define MP make_pair
#define F first
#define S second
typedef long long LL;
typedef vector<int> VI;
typedef pair<int, int> PII;
typedef double db;
const int N = 10'474;
int ALP = 26;
int g[N][ALP];
int sz = 1;
void add(string s)
{
int v = 0;
FOR (i, 0, SZ(s))
{
if (g[v][s[i] - 'a'] == -1)
g[v][s[i] - 'a'] = sz++;
v = g[v][s[i] - 'a'];
}
return v;
}
const int INF = 1e9;
const int N2 = 74;
int dp[N2][N2];
int dp2[N2][N];
string s;
void f(int L)
{
int n = SZ(s);
FOR (i, 0, N2) FOR (j, 0, N) dp2[i][j] = -INF;
dp[L][0] = 0;
FOR (i, L, n)
{
FOR (v, 0, sz)
{
if (dp2[i][v] == INF)
continue;
FOR (c, 0, 26)
{
if (g[v][c] == -1)
continue;
int u = g[v][c];
dp2[i + 1][u] = max(dp2[i + 1][u], dp2[i][v]);
}
FOR (j, i + 1, n)
dp2[j][v] = max(dp2[j][v], dp2[i][v] + dp[i][j]);
}
}
}
int main()
{
ios::sync_with_stdio(0);
cin.tie(0);
FOR(i, 0, N) FOR(j, 0, ALP) g[i][j] = -1;
cin >> s;
int C;
cin >> C;
vector<string> v(C);
VI cost(C);
FOR (i, 0, C)
{
cin >> v[i] >> cost[i];
add(v[i]);
}
int n = SZ(s);
RFOR (L, n, 0)
{
f(L);
FOR (R, L, n)
{
}
}
return 0;
}
详细
answer.code:22:10: error: size of array ‘g’ is not an integral constant-expression 22 | int g[N][ALP]; | ^~~ answer.code: In function ‘void add(std::string)’: answer.code:34:16: error: return-statement with a value, in function returning ‘void’ [-fpermissive] 34 | return v; | ^