結果
問題 |
No.1535 五七五
|
ユーザー |
|
提出日時 | 2022-10-07 16:47:59 |
言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 129 ms / 2,000 ms |
コード長 | 753 bytes |
コンパイル時間 | 2,140 ms |
コンパイル使用メモリ | 195,280 KB |
最終ジャッジ日時 | 2025-02-07 22:39:54 |
ジャッジサーバーID (参考情報) |
judge4 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 21 |
ソースコード
#include <bits/stdc++.h> #define rep(i,n) for(int i = 0; i < (n); i++) using namespace std; typedef long long ll; int main(){ cin.tie(0); ios::sync_with_stdio(0); int N,a,b,c; cin >> N >> a >> b >> c; vector<int> A(N); rep(i,N) { string s; cin >> s; A[i] = int(s.size()); } vector<int> S(N + 1, 0); rep(i,N) S[i + 1] += S[i] + A[i]; int ans = 0; rep(i,N) { int IA = lower_bound(S.begin(), S.end(), S[i] + a) - S.begin(); int IB = lower_bound(S.begin(), S.end(), S[IA] + b) - S.begin(); int IC = lower_bound(S.begin(), S.end(), S[IB] + c) - S.begin(); if(S[IA] - S[i] == a && S[IB] - S[IA] == b && S[IC] - S[IB] == c) ans++; } cout << ans << endl; }