# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
957511 | hirayuu_oj | Laugh Analysis (IOI16_laugh) | C++17 | 4 ms | 1624 KiB |
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#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;
}
컴파일 시 표준 에러 (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... |