# | TimeUTC-0 | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
769984 | raysh07 | 스탬프 수집 (JOI16_ho_t2) | C++17 | 9 ms | 8372 KiB |
This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define INF (int)1e18
#define f first
#define s second
mt19937_64 RNG(chrono::steady_clock::now().time_since_epoch().count());
void Solve()
{
int n; cin >> n;
string s; cin >> s;
vector <int> a(n + 1);
for (int i = 1; i <= n; i++){
if (s[i - 1] == 'J') a[i] = 1;
else if (s[i - 1] == 'O') a[i] = 2;
else a[i] = 3;
}
vector<vector<int>> dp(n + 1, vector<int>(4, 0));
dp[0][0] = 1;
for (int i = 1; i <= n; i++){
for (int j = 0; j <= 3; j++){
dp[i][j] += dp[i - 1][j];
if (a[i] == j + 1) dp[i][j + 1] += dp[i - 1][j];
}
}
int add = dp[n][3];
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |