Submission #68553
ソースコード
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 | #include <iostream> #include <vector> using namespace std; int main() { // cin.tie(nullptr); // ios_base::sync_with_stdio(false); int n, m; cin >> n >> m; vector< int > rating(m), cnt(n + 1); vector< long long > sum(n + 1); for ( int i = 0; i < m; ++i) { cin >> rating[i]; } for ( int i = 0; i < m; ++i) { int l, r; cin >> l >> r; --l, --r; cnt[l]++; cnt[r + 1]--; sum[l] += rating[i]; sum[r + 1] -= rating[i]; } for ( int i = 1; i < n; ++i) { cnt[i] += cnt[i - 1]; sum[i] += sum[i - 1]; } for ( int i = 0; i < n; ++i) { if (cnt[i] == 0) cout << -1 << '\n' ; else cout << sum[i] / cnt[i] << '\n' ; } return (0); } |
ステータス
項目 | データ |
---|---|
問題 | 1526 - Contest |
ユーザー名 | ei1903 |
投稿日時 | 2021-09-23 09:13:32 |
言語 | C++17 |
状態 | Accepted |
得点 | 3 |
ソースコード長 | 810 Byte |
最大実行時間 | 249 ms |
最大メモリ使用量 | 78524 KB |
セット
セット | 得点 | Cases | |
---|---|---|---|
1 | ALL | 3 / 3 | * |
テストケース
ファイル名 | 状態 | 実行時間 | メモリ使用量 | # |
---|---|---|---|---|
in01.txt | AC | 21 ms | 476 KB |
1
|
in02.txt | AC | 22 ms | 444 KB |
1
|
in03.txt | AC | 23 ms | 416 KB |
1
|
in04.txt | AC | 19 ms | 388 KB |
1
|
in05.txt | AC | 21 ms | 468 KB |
1
|
in06.txt | AC | 24 ms | 544 KB |
1
|
in07.txt | AC | 26 ms | 500 KB |
1
|
in08.txt | AC | 19 ms | 452 KB |
1
|
in09.txt | AC | 19 ms | 660 KB |
1
|
in10.txt | AC | 24 ms | 464 KB |
1
|
in11.txt | AC | 99 ms | 6556 KB |
1
|
in12.txt | AC | 66 ms | 4236 KB |
1
|
in13.txt | AC | 111 ms | 4396 KB |
1
|
in14.txt | AC | 174 ms | 8352 KB |
1
|
in15.txt | AC | 167 ms | 9964 KB |
1
|
in16.txt | AC | 37 ms | 8372 KB |
1
|
in17.txt | AC | 237 ms | 15372 KB |
1
|
in18.txt | AC | 233 ms | 18332 KB |
1
|
in19.txt | AC | 234 ms | 21292 KB |
1
|
in20.txt | AC | 233 ms | 24132 KB |
1
|
in21.txt | AC | 238 ms | 26972 KB |
1
|
in22.txt | AC | 238 ms | 29936 KB |
1
|
in23.txt | AC | 245 ms | 32900 KB |
1
|
in24.txt | AC | 231 ms | 35736 KB |
1
|
in25.txt | AC | 236 ms | 38820 KB |
1
|
in26.txt | AC | 235 ms | 41908 KB |
1
|
in27.txt | AC | 247 ms | 45124 KB |
1
|
in28.txt | AC | 212 ms | 48344 KB |
1
|
in29.txt | AC | 214 ms | 51568 KB |
1
|
in30.txt | AC | 241 ms | 54788 KB |
1
|
in31.txt | AC | 249 ms | 58132 KB |
1
|
in32.txt | AC | 232 ms | 60972 KB |
1
|
in33.txt | AC | 204 ms | 63936 KB |
1
|
in34.txt | AC | 211 ms | 66772 KB |
1
|
in35.txt | AC | 233 ms | 69220 KB |
1
|
in36.txt | AC | 232 ms | 71672 KB |
1
|
in37.txt | AC | 228 ms | 74380 KB |
1
|
in38.txt | AC | 241 ms | 76580 KB |
1
|
in39.txt | AC | 225 ms | 78524 KB |
1
|
in40.txt | AC | 144 ms | 75092 KB |
1
|
sample.txt | AC | 28 ms | 74024 KB |
1
|