結果
問題 | No.935 う し た ぷ に き あ く ん 笑 ビ - ム |
ユーザー | ate |
提出日時 | 2019-11-29 22:37:03 |
言語 | C++17 (gcc 12.3.0 + boost 1.83.0) |
結果 |
TLE
|
実行時間 | - |
コード長 | 1,568 bytes |
コンパイル時間 | 2,357 ms |
コンパイル使用メモリ | 207,308 KB |
実行使用メモリ | 33,664 KB |
最終ジャッジ日時 | 2024-05-01 00:38:45 |
合計ジャッジ時間 | 6,447 ms |
ジャッジサーバーID (参考情報) |
judge2 / judge1 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 5 ms
13,888 KB |
testcase_01 | AC | 9 ms
6,944 KB |
testcase_02 | AC | 6 ms
7,168 KB |
testcase_03 | AC | 13 ms
11,008 KB |
testcase_04 | AC | 24 ms
17,792 KB |
testcase_05 | AC | 9 ms
10,624 KB |
testcase_06 | AC | 37 ms
11,520 KB |
testcase_07 | AC | 39 ms
13,312 KB |
testcase_08 | AC | 105 ms
33,664 KB |
testcase_09 | AC | 64 ms
20,224 KB |
testcase_10 | AC | 72 ms
21,120 KB |
testcase_11 | AC | 98 ms
29,696 KB |
testcase_12 | AC | 2 ms
6,944 KB |
testcase_13 | AC | 2 ms
6,940 KB |
testcase_14 | AC | 2 ms
6,940 KB |
testcase_15 | AC | 2 ms
6,940 KB |
testcase_16 | AC | 2 ms
6,940 KB |
testcase_17 | TLE | - |
testcase_18 | -- | - |
testcase_19 | -- | - |
testcase_20 | -- | - |
testcase_21 | -- | - |
testcase_22 | -- | - |
testcase_23 | -- | - |
testcase_24 | -- | - |
testcase_25 | -- | - |
testcase_26 | -- | - |
testcase_27 | -- | - |
testcase_28 | -- | - |
testcase_29 | -- | - |
testcase_30 | -- | - |
testcase_31 | -- | - |
testcase_32 | -- | - |
testcase_33 | -- | - |
testcase_34 | -- | - |
testcase_35 | -- | - |
testcase_36 | -- | - |
testcase_37 | -- | - |
testcase_38 | -- | - |
testcase_39 | -- | - |
testcase_40 | -- | - |
testcase_41 | -- | - |
testcase_42 | -- | - |
testcase_43 | -- | - |
testcase_44 | -- | - |
testcase_45 | -- | - |
testcase_46 | -- | - |
testcase_47 | -- | - |
testcase_48 | -- | - |
testcase_49 | -- | - |
testcase_50 | -- | - |
testcase_51 | -- | - |
testcase_52 | -- | - |
testcase_53 | -- | - |
testcase_54 | -- | - |
testcase_55 | -- | - |
testcase_56 | -- | - |
testcase_57 | -- | - |
testcase_58 | -- | - |
testcase_59 | -- | - |
ソースコード
#include<bits/stdc++.h> using namespace std; #define rep(i,n) for(ll i=0;i<(n);++i) using ll = int; using pll = pair<ll,ll>; //constexpr ll INF = (1LL<<60); //constexpr ll MOD = (1e9+7); //constexpr ll MOD = (998244353); template<class T> bool chmax(T &a,const T &b){if(a<b){a=b;return 1;}return 0;} template<class T> bool chmin(T &a,const T &b){if(a>b){a=b;return 1;}return 0;} void dump(){cerr<<endl;} template<class T,class... Ts> void dump(T&& h, Ts&&... t){cerr<<h<<", ";dump(forward<Ts>(t)...);} template<class T> istream &operator>>(istream&is,vector<T>&v){for(auto &elemnt:v)is>>elemnt;return is;} template<class T,class U> istream &operator>>(istream&is,pair<T,U>&p){is>>p.first>>p.second;return is;} template<class T>vector<T> make_vector(size_t a){return vector<T>(a);} template<class T, class... Ts>auto make_vector(size_t a, Ts... ts){return vector<decltype(make_vector<T>(ts...))>(a, make_vector<T>(ts...));} signed main(){ ll n; string s; cin>>n>>s; vector<ll> a(n); cin>>a; ll q; cin>>q; vector<ll> k(q); cin>>k; vector<ll> ssum(n+1); rep(i,n)ssum[i+1]=ssum[i]+(s[i]=='E'?1:0); vector<ll> asum(n+1); rep(i,n)asum[i+1]=asum[i]+a[i]; auto aasum = make_vector<ll>(n,n); auto sssum = make_vector<ll>(n,n); rep(i,n)for(ll j=i;j<n;++j){ aasum[i][j] = asum[j+1]-asum[i]; sssum[i][j] = ssum[j+1]-ssum[i]; } auto f = [&](ll x){ ll res = 0; rep(i,n)for(ll j=i;j<n;++j){ if(aasum[i][j]>x)break; res=max(res,sssum[i][j]); } return res; }; for(auto x:k){ cout<<f(x)<<endl; } }