Submission #00069


ソースコード

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
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
#if 1
#include <iostream>
#include <fstream>
#include <string>
#include <vector>
#include <map>
#include <set>
#include <unordered_map>
#include <unordered_set>
#include <queue>
#include <stack>
#include <array>
#include <deque>
#include <algorithm>
#include <utility>
#include <cstdint>
#include <functional>
#include <iomanip>
#include <numeric>
#define in std::cin
#define out std::cout
int32_t n,h,l;
int32_t d[10000];
int32_t m;
std::tuple<int32_t, int32_t,int32_t> Magic[101];//t,a,s
int32_t damage[101][10000] = {};
int main()
{
using std::endl;
in.sync_with_stdio(false);
out.sync_with_stdio(false);
in >> n >> h >> l;
for (int32_t i = 0; i < n; ++i)
{
in >> d[i];
}
in >> m;
for (int32_t i = 0; i < m; ++i)
{
in >> std::get<1>(Magic[i]) >> std::get<2>(Magic[i]) >> std::get<0>(Magic[i]);
if (std::get<0>(Magic[i]) > l) {
--m;
--i;
}
}
std::get<0>(Magic[m]) = 1111111;
std::sort(Magic, Magic + m);
//ダメージ構築
{
auto d_iter = damage;
auto m_iter = Magic;
for (int32_t i = 1; i <= l; ++i)
{
bool change = false;
while (std::get<0>(*m_iter) == i) {
d[std::get<1>(*m_iter)-1] = std::get<2>(*m_iter);
++m_iter;
change = true;
}
if (change) {
++d_iter;
}
for (int32_t j = 0; j < n; ++j)
{
(*d_iter)[j] += d[j];
}
}
}
//(b,e]
int32_t b=0, e= 10001;
while(b+1 < e)
{
auto mid = (b + e) / 2;
int32_t d_sum = 0;
for (int32_t t = 0; t <= m; ++t)
{
//尺取り
int32_t max = std::accumulate(damage[t], damage[t] + mid, 0);
int32_t tmp = max;
for (int32_t i = mid; i < n; ++i)
{
tmp -= damage[t][i - mid];
tmp += damage[t][i];
max = std::max(max, tmp);
}
d_sum += max;
}
if (d_sum >= h) {
e = mid;
}
else {
b = mid;
}
}
if (e < n) {
std::cout << e << std::endl;
}
else {
std::cout << "Broadcasting accident" << std::endl;
}
return 0;
}
#endif

ステータス

項目 データ
問題 0007 - 魔女っ娘ヒナくるん -Magic.49
ユーザー名 eiya
投稿日時 2017-01-29 19:57:22
言語 C++11
状態 Accepted
得点 300
ソースコード長 2024 Byte
最大実行時間 46 ms
最大メモリ使用量 3208 KB

セット

セット 得点 Cases
1 Set01 15 / 15 *Input01
2 Set02 15 / 15 *Input02
3 Set03 15 / 15 *Input03
4 Set04 15 / 15 *Input04
5 Set05 15 / 15 *Input05
6 SetAll 75 / 75 *Input*
7 Final 150 / 150 *

テストケース

ファイル名 状態 実行時間 メモリ使用量 #
Input01 AC 46 ms 480 KB
1
6
7
Input02 AC 20 ms 552 KB
2
6
7
Input03 AC 26 ms 600 KB
3
6
7
Input04 AC 26 ms 724 KB
4
6
7
Input05 AC 20 ms 1176 KB
5
6
7
Input06 AC 25 ms 1400 KB
6
7
Input07 AC 27 ms 2068 KB
6
7
Input08 AC 31 ms 2140 KB
6
7
Input09 AC 41 ms 3208 KB
6
7
omake AC 32 ms 3188 KB
7