QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#722117 | #9536. Athlete Welcome Ceremony | wangshengzhe# | Compile Error | / | / | C++14 | 3.2kb | 2024-11-07 17:54:05 | 2024-11-07 17:54:05 |
Judging History
This is the latest submission verdict.
- [2024-11-07 17:54:05]
- Judged
- Verdict: Compile Error
- Time: 0ms
- Memory: 0kb
- [2024-11-07 17:54:05]
- Submitted
answer
#include<bits/stdc++.h>
using namespace std;
using LL = long long;
#define rep(i,a,b) for(int i = a;i<=b;i++)
#define pre(i, a, b) for(int i = a;i >= b;i--)
const int mod = 1e9 + 7;
#define int long long
int n, q;
string s;
int dp[305][305][305][3];
int sum[305][305][305];
void solve()
{
cin >> n >> q;
cin >> s;
s = " " + s;
int ma = 0, mb = 0, mc = 0;
if (s[1] == '?')
{
dp[1][0][0][0] = 1;
dp[0][1][0][1] = 1;
dp[0][0][1][2] = 1;
}
else
{
int x = s[1] - 'a';
if(x == 0) dp[1][0][0][0] = 1;
else if(x == 1) dp[0][1][0][1] = 1;
else dp[0][0][1][2] = 1;
if (s[1] == 'a') ma++;
if (s[1] == 'b') mb++;
if (s[1] == 'c') mc++;
}
rep(i, 2, n)
{
if (s[i] == 'a') ma++;
if (s[i] == 'b') mb++;
if (s[i] == 'c') mc++;
rep(aa, ma, i)
{
rep(bb, mb, i)
{
if (aa + bb > i) continue;
int cc = i - aa - bb;
if (cc < mc) continue;
if (s[i] != '?')
{
int x = s[i] - 'a';
if (x == 0) dp[aa][bb][cc][x] = (dp[aa - 1][bb][cc][(x + 1) % 3] + dp[aa - 1][bb][cc][(x + 2) % 3]) % mod;
else if (x == 1) dp[aa][bb][cc][x] = (dp[aa][bb - 1][cc][(x + 1) % 3] + dp[aa][bb - 1][cc][(x + 2) % 3]) % mod;
else if (x == 2) dp[aa][bb][cc][x] = (dp[aa][bb][cc - 1][(x + 1) % 3] + dp[aa][bb][cc - 1][(x + 2) % 3]) % mod;
}
else
{
int x = 0;
if (aa != 0) dp[aa][bb][cc][x] = (dp[aa - 1][bb][cc][(x + 1) % 3] + dp[aa - 1][bb][cc][(x + 2) % 3]) % mod;
x = 1;
if (bb != 0) dp[aa][bb][cc][x] = (dp[aa][bb - 1][cc][(x + 1) % 3] + dp[aa][bb - 1][cc][(x + 2) % 3]) % mod;
x = 2;
if (cc != 0) dp[aa][bb][cc][x] = (dp[aa][bb][cc - 1][(x + 1) % 3] + dp[aa][bb][cc - 1][(x + 2) % 3]) % mod;
}
if (aa + bb + cc == n)
{
sum[aa + 1][bb + 1][cc + 1] = (dp[aa][bb][cc][0] + dp[aa][bb][cc][1] + dp[aa][bb][cc][2]) % mod;
}
}
}
}
n++;
rep(i, 1, n)
rep(k, 1, n)
rep(j, 1, n)
sum[i][k][j] = (sum[i][k][j] + sum[i - 1][k][j]) % mod;
rep(i, 1, n)
rep(k, 1, n)
rep(j, 1, n)
sum[i][k][j] = (sum[i][k][j] + sum[i][k - 1][j]) % mod;
rep(i, 1, n)
rep(k, 1, n)
rep(j, 1. n)
sum[i][k][j] = (sum[i][k][j] + sum[i][k][j - 1]) % mod;
int aaa = 0, bbb = 0, ccc = 0;
rep(i, 1, n) {
if (s[i] == 'a') aaa++;
else if (s[i] == 'b') bbb++;
else if (s[i] == 'c') ccc++;
}
while (q--)
{
int x, y, z; cin >> x >> y >> z;
cout << sum[x + aaa + 1][y + bbb + 1][z + ccc + 1] << endl;
}
return;
}
signed main()
{
ios::sync_with_stdio(false);
cin.tie(nullptr);
int t = 1;
//cin >> t;
while (t--) {
solve();
}
return 0;
}
Details
answer.code:86:20: error: macro "rep" requires 3 arguments, but only 2 given 86 | rep(j, 1. n) | ^ answer.code:6: note: macro "rep" defined here 6 | #define rep(i,a,b) for(int i = a;i<=b;i++) | answer.code: In function ‘void solve()’: answer.code:86:9: error: ‘rep’ was not declared in this scope 86 | rep(j, 1. n) | ^~~