Submission #00014


ソースコード

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
#include<bits/stdc++.h>
#define F first
#define S second
#define endl '\n'
#define MP make_pair
#define pb push_back
using namespace std;
typedef pair<int, int> P;
typedef pair<int, P> i_P;
typedef long long LL;
static const int INF = INT_MAX;
static const int MIN = INT_MIN;
static const LL L_INF = LLONG_MAX;
static const int MOD = 1000000000 + 7;
static const int SIZE = 100005;
int main() {
cin.tie(0);
ios::sync_with_stdio(false);
long long n;
cin >> n;
long long w[n];
for( int i = 0; i < n; ++i ) {
cin >> w[i];
if( i ) w[i] += w[i - 1];
}
long long q;
cin >> q;
for( int i = 0; i < q; ++i ) {
long long r;
cin >> r;
cout << upper_bound( w, w + n, r ) - w << endl;
}
return 0;
}

ステータス

項目 データ
問題 0008 - ある日の事でございます。
ユーザー名 crom
投稿日時 2019-04-24 18:41:50
言語 C++11
状態 Accepted
得点 100
ソースコード長 828 Byte
最大実行時間 48 ms
最大メモリ使用量 5200 KB

セット

セット 得点 Cases
1 ALL 100 / 100 *

テストケース

ファイル名 状態 実行時間 メモリ使用量 #
in01 AC 48 ms 1372 KB
1
in02 AC 41 ms 1436 KB
1
in03 AC 37 ms 1636 KB
1
in04 AC 40 ms 1960 KB
1
in05 AC 39 ms 2156 KB
1
in06 AC 43 ms 2348 KB
1
in07 AC 38 ms 2548 KB
1
in08 AC 38 ms 2744 KB
1
in09 AC 37 ms 2940 KB
1
in10 AC 38 ms 3132 KB
1
in11 AC 39 ms 3324 KB
1
in12 AC 40 ms 3524 KB
1
in13 AC 39 ms 3716 KB
1
in14 AC 40 ms 3908 KB
1
in15 AC 37 ms 4108 KB
1
in16 AC 46 ms 4304 KB
1
in17 AC 38 ms 4496 KB
1
in18 AC 38 ms 4688 KB
1
in19 AC 38 ms 4880 KB
1
in20 AC 39 ms 5200 KB
1
in21 AC 22 ms 4500 KB
1