# | TimeUTC-0 | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
161906 | impri | 스탬프 수집 (JOI16_ho_t2) | C++14 | 17 ms | 7716 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;
typedef long long ll;
int n;
string s;
ll dp[100001][3];
char joi[4];
ll get(int a,int b){
if(b==0)return 1;
if(a>=n)return 0;
if(dp[a][b]>=0)return dp[a][b];
if(joi[b]==s[a])return dp[a][b]=get(a+1,b)+get(a+1,b-1);
return dp[a][b]=get(a+1,b);
}
int main()
{ cout <<fixed;cout.precision(12);cin.tie(0);
ios_base::sync_with_stdio(false);
memset(dp,-1,sizeof(dp));
cin >> n;
cin >> s;
joi[1]='I';
joi[2]='O';
joi[3]='J';
ll res=get(0,3);
ll add=get(0,2);
joi[2]='J';
joi[1]='O';
memset(dp,-1,sizeof(dp));
add=max(add,get(0,2));
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |