結果
| 問題 | 
                            No.935 う し た ぷ に き あ く ん 笑 ビ - ム
                             | 
                    
| コンテスト | |
| ユーザー | 
                             Knots
                         | 
                    
| 提出日時 | 2020-11-27 01:32:23 | 
| 言語 | C++17  (gcc 13.3.0 + boost 1.87.0)  | 
                    
| 結果 | 
                             
                                WA
                                 
                             
                            
                         | 
                    
| 実行時間 | - | 
| コード長 | 981 bytes | 
| コンパイル時間 | 2,136 ms | 
| コンパイル使用メモリ | 193,576 KB | 
| 最終ジャッジ日時 | 2025-01-16 05:58:07 | 
| 
                            ジャッジサーバーID (参考情報)  | 
                        judge1 / judge4 | 
(要ログイン)
| ファイルパターン | 結果 | 
|---|---|
| sample | AC * 1 WA * 1 | 
| other | AC * 13 WA * 44 TLE * 1 | 
ソースコード
#include <bits/stdc++.h>
typedef long long ll;
using namespace std;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
const int INF = 1e9;
const int MOD = 1e9+7;
const ll LINF = 1e18;
#define REP(i,n) for(int i=0;i<(n);++i)
#define COUT(x) cout<<(x)<<"\n"
#define COUT16(x) cout << fixed << setprecision(16) << (x) << "\n";
int main(){
    int n,q;cin >> n;
    string s;cin >> s;
    vector<int> a(n);
    REP(i,n) cin >> a[i];
    cin >> q;
    vector<int> k(q);
    REP(i,q) cin >> k[i];
    for(int i=0;i<q;i++){
        int ans = 0;
        for(int left=0;left<n;left++){
            int attack = 0;
            int right = left;
            while(right<n&&attack+a[right]<=k[i]){
                attack += a[right];
                right++;
            }
            ans = max(ans,right-left);
        }
        COUT(ans);
    }
}
    
            
            
            
        
            
Knots