# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
957511 | hirayuu_oj | Laugh Analysis (IOI16_laugh) | C++17 | 4 ms | 1624 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 "laugh.h"
#include<bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i=0; i<(n); i++)
#define rep2(i,l,r) for(int i=(l); i<(r); i++)
#define all(x) x.begin(),x.end();
using ll = long long;
int longest_laugh(std::string s){
vector<ll> dp(s.size());
ll ans=0;
rep(i,s.size()){
if(s[i]=='a'){
if(i!=0 and s[i-1]=='h'){
dp[i]=dp[i-1]+1;
}
else{
dp[i]=1;
}
}
else if(s[i]=='h'){
if(i!=0 and s[i-1]=='a'){
dp[i]=dp[i-1]+1;
}
else{
dp[i]=1;
}
}
else{
dp[i]=0;
}
ans=max(ans,dp[i]);
}
return ans;
}
Compilation message (stderr)
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |