結果

問題 No.1433 Two color sequence
ユーザー chocoruskchocorusk
提出日時 2021-03-19 21:48:25
言語 C++17
(gcc 13.2.0 + boost 1.83.0)
結果
AC  
実行時間 88 ms / 2,000 ms
コード長 909 bytes
コンパイル時間 3,715 ms
コンパイル使用メモリ 187,568 KB
実行使用メモリ 6,816 KB
最終ジャッジ日時 2023-08-12 01:45:53
合計ジャッジ時間 6,561 ms
ジャッジサーバーID
(参考情報)
judge14 / judge15
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
4,380 KB
testcase_01 AC 2 ms
4,376 KB
testcase_02 AC 1 ms
4,380 KB
testcase_03 AC 37 ms
6,700 KB
testcase_04 AC 36 ms
6,548 KB
testcase_05 AC 2 ms
4,376 KB
testcase_06 AC 2 ms
4,380 KB
testcase_07 AC 2 ms
4,376 KB
testcase_08 AC 84 ms
6,652 KB
testcase_09 AC 87 ms
6,668 KB
testcase_10 AC 81 ms
6,496 KB
testcase_11 AC 82 ms
6,492 KB
testcase_12 AC 83 ms
6,644 KB
testcase_13 AC 87 ms
6,556 KB
testcase_14 AC 86 ms
6,728 KB
testcase_15 AC 86 ms
6,652 KB
testcase_16 AC 86 ms
6,816 KB
testcase_17 AC 86 ms
6,672 KB
testcase_18 AC 85 ms
6,652 KB
testcase_19 AC 85 ms
6,616 KB
testcase_20 AC 85 ms
6,592 KB
testcase_21 AC 85 ms
6,536 KB
testcase_22 AC 85 ms
6,600 KB
testcase_23 AC 88 ms
6,728 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <cstdio>
#include <cstring>
#include <iostream>
#include <string>
#include <cmath>
#include <bitset>
#include <vector>
#include <map>
#include <set>
#include <queue>
#include <deque>
#include <algorithm>
#include <complex>
#include <unordered_map>
#include <unordered_set>
#include <random>
#include <cassert>
#include <fstream>
#include <utility>
#include <functional>
#include <time.h>
#include <stack>
#include <array>
#include <list>
#include <atcoder/all>
#define popcount __builtin_popcount
using namespace std;
using namespace atcoder;
typedef long long ll;
typedef pair<int, int> P;

int main()
{
    int n; cin>>n;
    string s; cin>>s;
    ll a[200020], t[200020];
    for(int i=0; i<n; i++){
        cin>>a[i];
        if(s[i]=='B') a[i]=-a[i];
    }
    for(int i=0; i<n; i++){
        t[i+1]=t[i]+a[i];
    }
    cout<<*max_element(t, t+n+1)-*min_element(t, t+n+1)<<endl;
    return 0;
}
0