結果
| 問題 |
No.1433 Two color sequence
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2021-03-20 03:24:40 |
| 言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
AC
|
| 実行時間 | 86 ms / 2,000 ms |
| コード長 | 281 bytes |
| コンパイル時間 | 528 ms |
| コンパイル使用メモリ | 68,008 KB |
| 実行使用メモリ | 6,820 KB |
| 最終ジャッジ日時 | 2024-11-19 07:39:45 |
| 合計ジャッジ時間 | 3,659 ms |
|
ジャッジサーバーID (参考情報) |
judge1 / judge5 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 21 |
コンパイルメッセージ
main.cpp:6:1: warning: ISO C++ forbids declaration of 'main' with no type [-Wreturn-type]
6 | main()
| ^~~~
ソースコード
#include<iostream>
#include<algorithm>
using namespace std;
int N;
string S;
main()
{
cin>>N>>S;
long L=0,R=0,M=-9e18,now=0;
for(int i=0;i<N;i++)
{
int a;cin>>a;
if(S[i]=='R')a=-a;
now+=a;
M=max(M,max(R-now,now-L));
R=max(R,now);
L=min(L,now);
}
cout<<M<<endl;
}