| # | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
|---|---|---|---|---|---|---|---|
| 221936 | mhy908 | 스탬프 수집 (JOI16_ho_t2) | C++14 | 9 ms | 3712 KiB |
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include <bits/stdc++.h>
using namespace std;
typedef long long LL;
int n;
char str[100010];
LL J[100010], JO[100010], OI[100010], I[100010], ans, ans2;
int main(){
scanf("%d %s", &n, str+1);
for(int i=1; i<=n; i++){
J[i]=J[i-1], JO[i]=JO[i-1];
if(str[i]=='J')J[i]++;
if(str[i]=='O')JO[i]+=J[i];
if(str[i]=='I')ans+=JO[i];
}
for(int i=n; i>=1; i--){
I[i]=I[i+1], OI[i]=OI[i+1];
if(str[i]=='I')I[i]++;
if(str[i]=='O')OI[i]+=I[i];
}
for(int i=1; i<=n+1; i++){
LL tmp=max(max(OI[i], JO[i-1]), J[i-1]*I[i]);
ans2=max(ans2, tmp);
}
printf("%lld", ans+ans2);
}
컴파일 시 표준 에러 (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... | ||||
