Submission #68554
ソースコード
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 << endl; else cout << sum[i] / cnt[i] << endl; } return (0); } |
ステータス
項目 | データ |
---|---|
問題 | 1526 - Contest |
ユーザー名 | ei1903 |
投稿日時 | 2021-09-23 09:13:48 |
言語 | C++17 |
状態 | Accepted |
得点 | 3 |
ソースコード長 | 810 Byte |
最大実行時間 | 844 ms |
最大メモリ使用量 | 78756 KB |
セット
セット | 得点 | Cases | |
---|---|---|---|
1 | ALL | 3 / 3 | * |
テストケース
ファイル名 | 状態 | 実行時間 | メモリ使用量 | # |
---|---|---|---|---|
in01.txt | AC | 22 ms | 600 KB |
1
|
in02.txt | AC | 21 ms | 444 KB |
1
|
in03.txt | AC | 24 ms | 412 KB |
1
|
in04.txt | AC | 19 ms | 512 KB |
1
|
in05.txt | AC | 20 ms | 596 KB |
1
|
in06.txt | AC | 24 ms | 548 KB |
1
|
in07.txt | AC | 20 ms | 504 KB |
1
|
in08.txt | AC | 18 ms | 452 KB |
1
|
in09.txt | AC | 35 ms | 532 KB |
1
|
in10.txt | AC | 27 ms | 596 KB |
1
|
in11.txt | AC | 545 ms | 6684 KB |
1
|
in12.txt | AC | 130 ms | 4104 KB |
1
|
in13.txt | AC | 131 ms | 4396 KB |
1
|
in14.txt | AC | 479 ms | 8224 KB |
1
|
in15.txt | AC | 485 ms | 10092 KB |
1
|
in16.txt | AC | 141 ms | 8500 KB |
1
|
in17.txt | AC | 751 ms | 15376 KB |
1
|
in18.txt | AC | 742 ms | 18336 KB |
1
|
in19.txt | AC | 749 ms | 21300 KB |
1
|
in20.txt | AC | 772 ms | 24128 KB |
1
|
in21.txt | AC | 774 ms | 27212 KB |
1
|
in22.txt | AC | 788 ms | 29920 KB |
1
|
in23.txt | AC | 783 ms | 32880 KB |
1
|
in24.txt | AC | 844 ms | 35840 KB |
1
|
in25.txt | AC | 767 ms | 38800 KB |
1
|
in26.txt | AC | 766 ms | 42012 KB |
1
|
in27.txt | AC | 752 ms | 45228 KB |
1
|
in28.txt | AC | 736 ms | 48452 KB |
1
|
in29.txt | AC | 727 ms | 51672 KB |
1
|
in30.txt | AC | 755 ms | 54896 KB |
1
|
in31.txt | AC | 739 ms | 58116 KB |
1
|
in32.txt | AC | 725 ms | 61080 KB |
1
|
in33.txt | AC | 717 ms | 64044 KB |
1
|
in34.txt | AC | 721 ms | 67008 KB |
1
|
in35.txt | AC | 742 ms | 69464 KB |
1
|
in36.txt | AC | 769 ms | 71920 KB |
1
|
in37.txt | AC | 746 ms | 74368 KB |
1
|
in38.txt | AC | 731 ms | 76564 KB |
1
|
in39.txt | AC | 739 ms | 78756 KB |
1
|
in40.txt | AC | 164 ms | 75196 KB |
1
|
sample.txt | AC | 20 ms | 73996 KB |
1
|