#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define x first
#define y second
const int MAXN=1e3+7;
set<pair<long long ,long long> >place[MAXN];
ll M,X;
vector<int>S;
void init(int L,int N,vector<long long>T,vector<int>W,int _X,int _M,vector<int>_S)
{
M=_M;
X=_X;
S=_S;
vector<pair<long long,long long> >block;
for(int i=0;i<=N-1;i++)block.push_back({W[i],T[i]});
sort(block.begin(),block.end());
for(int i=0;i<=M-1;i++)place[i].insert(make_pair(0,0));
for(int i=(int)block.size()-1;i>=0;i--)
{
long long Time=block[i].y;
long long C=block[i].x;
for(int cnt=1;cnt<=M-1;cnt++)
{
auto pre=prev(place[cnt].lower_bound(make_pair(Time,0)));
long long newTime=max(pre->y,(long long)Time+C*(S[cnt]-S[cnt-1]));
place[cnt].insert(make_pair(Time,newTime));
Time=newTime;
}
}
}
long long arrival_time(long long Time)
{
for(int cnt=1;cnt<=M-1;cnt++)
{
auto pre=prev(place[cnt].lower_bound(make_pair(Time,0)));
long long newTime=max(pre->y,(long long)Time+X*(S[cnt]-S[cnt-1]));
Time=newTime;
}
return Time;
}
/*int main()
{
ios_base::sync_with_stdio(false);
cin.tie(0);
cout.tie(0);
int L,N;
vector<long long>T;
vector<int>W;
int X,M;
vector<int>S;
cin>>L>>N;
for(int i=1;i<=N;i++)
{
long long value;
cin>>value;
T.push_back(value);
}
for(int i=1;i<=N;i++)
{
long long value;
cin>>value;
W.push_back(value);
}
cin>>X>>M;
for(int i=1;i<=M;i++)
{
int value;
cin>>value;
S.push_back(value);
}
init(L,N,T,W,X,M,S);
int Time;
cin>>Time;
cout<<arrival_time(Time);
}
*/
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
344 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
348 KB |
Output is correct |
2 |
Correct |
1 ms |
344 KB |
Output is correct |
3 |
Correct |
1 ms |
348 KB |
Output is correct |
4 |
Correct |
1 ms |
348 KB |
Output is correct |
5 |
Correct |
1 ms |
348 KB |
Output is correct |
6 |
Correct |
2 ms |
344 KB |
Output is correct |
7 |
Correct |
4 ms |
604 KB |
Output is correct |
8 |
Correct |
5 ms |
600 KB |
Output is correct |
9 |
Correct |
5 ms |
600 KB |
Output is correct |
10 |
Correct |
5 ms |
600 KB |
Output is correct |
11 |
Correct |
4 ms |
600 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
344 KB |
Output is correct |
2 |
Correct |
0 ms |
344 KB |
Output is correct |
3 |
Correct |
0 ms |
344 KB |
Output is correct |
4 |
Correct |
1 ms |
344 KB |
Output is correct |
5 |
Correct |
1 ms |
344 KB |
Output is correct |
6 |
Correct |
1 ms |
344 KB |
Output is correct |
7 |
Correct |
1 ms |
344 KB |
Output is correct |
8 |
Correct |
1 ms |
344 KB |
Output is correct |
9 |
Correct |
1 ms |
344 KB |
Output is correct |
10 |
Correct |
1 ms |
348 KB |
Output is correct |
11 |
Correct |
1 ms |
344 KB |
Output is correct |
12 |
Correct |
1 ms |
348 KB |
Output is correct |
13 |
Correct |
1 ms |
344 KB |
Output is correct |
14 |
Correct |
1 ms |
348 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
344 KB |
Output is correct |
2 |
Correct |
1 ms |
348 KB |
Output is correct |
3 |
Correct |
1 ms |
344 KB |
Output is correct |
4 |
Correct |
1 ms |
348 KB |
Output is correct |
5 |
Correct |
1 ms |
348 KB |
Output is correct |
6 |
Correct |
1 ms |
344 KB |
Output is correct |
7 |
Correct |
0 ms |
344 KB |
Output is correct |
8 |
Correct |
0 ms |
344 KB |
Output is correct |
9 |
Correct |
2 ms |
1112 KB |
Output is correct |
10 |
Correct |
2 ms |
856 KB |
Output is correct |
11 |
Correct |
1 ms |
860 KB |
Output is correct |
12 |
Correct |
1 ms |
860 KB |
Output is correct |
13 |
Correct |
2 ms |
856 KB |
Output is correct |
14 |
Correct |
2 ms |
860 KB |
Output is correct |
15 |
Correct |
2 ms |
1112 KB |
Output is correct |
16 |
Correct |
2 ms |
856 KB |
Output is correct |
17 |
Correct |
2 ms |
856 KB |
Output is correct |
18 |
Correct |
2 ms |
860 KB |
Output is correct |
19 |
Correct |
2 ms |
856 KB |
Output is correct |
20 |
Correct |
2 ms |
856 KB |
Output is correct |
21 |
Correct |
1 ms |
600 KB |
Output is correct |
22 |
Correct |
1 ms |
600 KB |
Output is correct |
23 |
Correct |
2 ms |
856 KB |
Output is correct |
24 |
Correct |
2 ms |
856 KB |
Output is correct |
25 |
Correct |
2 ms |
1112 KB |
Output is correct |
26 |
Correct |
2 ms |
856 KB |
Output is correct |
27 |
Correct |
2 ms |
1112 KB |
Output is correct |
28 |
Correct |
1 ms |
600 KB |
Output is correct |
29 |
Correct |
1 ms |
856 KB |
Output is correct |
30 |
Correct |
1 ms |
856 KB |
Output is correct |
31 |
Correct |
1 ms |
856 KB |
Output is correct |
32 |
Correct |
2 ms |
1112 KB |
Output is correct |
33 |
Correct |
1 ms |
856 KB |
Output is correct |
34 |
Correct |
2 ms |
1112 KB |
Output is correct |
35 |
Correct |
1 ms |
1116 KB |
Output is correct |
36 |
Correct |
1 ms |
860 KB |
Output is correct |
37 |
Correct |
2 ms |
856 KB |
Output is correct |
38 |
Correct |
2 ms |
856 KB |
Output is correct |
39 |
Correct |
2 ms |
860 KB |
Output is correct |
40 |
Correct |
2 ms |
856 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
344 KB |
Output is correct |
2 |
Correct |
1 ms |
348 KB |
Output is correct |
3 |
Correct |
1 ms |
344 KB |
Output is correct |
4 |
Correct |
1 ms |
348 KB |
Output is correct |
5 |
Correct |
1 ms |
348 KB |
Output is correct |
6 |
Correct |
1 ms |
348 KB |
Output is correct |
7 |
Correct |
2 ms |
344 KB |
Output is correct |
8 |
Correct |
4 ms |
604 KB |
Output is correct |
9 |
Correct |
5 ms |
600 KB |
Output is correct |
10 |
Correct |
5 ms |
600 KB |
Output is correct |
11 |
Correct |
5 ms |
600 KB |
Output is correct |
12 |
Correct |
4 ms |
600 KB |
Output is correct |
13 |
Correct |
1 ms |
344 KB |
Output is correct |
14 |
Correct |
0 ms |
344 KB |
Output is correct |
15 |
Correct |
0 ms |
344 KB |
Output is correct |
16 |
Correct |
2 ms |
1112 KB |
Output is correct |
17 |
Correct |
2 ms |
856 KB |
Output is correct |
18 |
Correct |
1 ms |
860 KB |
Output is correct |
19 |
Correct |
1 ms |
860 KB |
Output is correct |
20 |
Correct |
2 ms |
856 KB |
Output is correct |
21 |
Correct |
2 ms |
860 KB |
Output is correct |
22 |
Correct |
2 ms |
1112 KB |
Output is correct |
23 |
Correct |
2 ms |
856 KB |
Output is correct |
24 |
Correct |
2 ms |
856 KB |
Output is correct |
25 |
Correct |
2 ms |
860 KB |
Output is correct |
26 |
Correct |
2 ms |
856 KB |
Output is correct |
27 |
Correct |
2 ms |
856 KB |
Output is correct |
28 |
Correct |
1 ms |
600 KB |
Output is correct |
29 |
Correct |
1 ms |
600 KB |
Output is correct |
30 |
Correct |
2 ms |
856 KB |
Output is correct |
31 |
Correct |
2 ms |
856 KB |
Output is correct |
32 |
Correct |
2 ms |
1112 KB |
Output is correct |
33 |
Correct |
2 ms |
856 KB |
Output is correct |
34 |
Correct |
2 ms |
1112 KB |
Output is correct |
35 |
Correct |
1 ms |
600 KB |
Output is correct |
36 |
Correct |
1 ms |
856 KB |
Output is correct |
37 |
Correct |
1 ms |
856 KB |
Output is correct |
38 |
Correct |
1 ms |
856 KB |
Output is correct |
39 |
Correct |
2 ms |
1112 KB |
Output is correct |
40 |
Correct |
1 ms |
856 KB |
Output is correct |
41 |
Correct |
2 ms |
1112 KB |
Output is correct |
42 |
Correct |
1 ms |
1116 KB |
Output is correct |
43 |
Correct |
1 ms |
860 KB |
Output is correct |
44 |
Correct |
2 ms |
856 KB |
Output is correct |
45 |
Correct |
2 ms |
856 KB |
Output is correct |
46 |
Correct |
2 ms |
860 KB |
Output is correct |
47 |
Correct |
2 ms |
856 KB |
Output is correct |
48 |
Correct |
198 ms |
61652 KB |
Output is correct |
49 |
Correct |
232 ms |
61264 KB |
Output is correct |
50 |
Correct |
230 ms |
62692 KB |
Output is correct |
51 |
Correct |
287 ms |
61520 KB |
Output is correct |
52 |
Correct |
334 ms |
61264 KB |
Output is correct |
53 |
Correct |
243 ms |
61520 KB |
Output is correct |
54 |
Correct |
273 ms |
61488 KB |
Output is correct |
55 |
Correct |
196 ms |
43356 KB |
Output is correct |
56 |
Correct |
280 ms |
61264 KB |
Output is correct |
57 |
Correct |
254 ms |
57424 KB |
Output is correct |
58 |
Correct |
312 ms |
62036 KB |
Output is correct |
59 |
Correct |
282 ms |
61380 KB |
Output is correct |
60 |
Correct |
276 ms |
61360 KB |
Output is correct |
61 |
Correct |
287 ms |
62256 KB |
Output is correct |
62 |
Correct |
22 ms |
600 KB |
Output is correct |
63 |
Correct |
2 ms |
600 KB |
Output is correct |
64 |
Correct |
435 ms |
31800 KB |
Output is correct |
65 |
Correct |
338 ms |
32080 KB |
Output is correct |
66 |
Correct |
882 ms |
63204 KB |
Output is correct |
67 |
Correct |
839 ms |
63308 KB |
Output is correct |
68 |
Correct |
838 ms |
63356 KB |
Output is correct |
69 |
Correct |
316 ms |
63200 KB |
Output is correct |
70 |
Correct |
331 ms |
63056 KB |
Output is correct |
71 |
Correct |
305 ms |
63208 KB |
Output is correct |
72 |
Correct |
299 ms |
63056 KB |
Output is correct |
73 |
Correct |
311 ms |
63208 KB |
Output is correct |
74 |
Correct |
294 ms |
63208 KB |
Output is correct |
75 |
Correct |
733 ms |
63112 KB |
Output is correct |
76 |
Correct |
730 ms |
63056 KB |
Output is correct |
77 |
Correct |
713 ms |
63356 KB |
Output is correct |
78 |
Correct |
351 ms |
63208 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
344 KB |
Output is correct |
2 |
Correct |
1 ms |
348 KB |
Output is correct |
3 |
Correct |
1 ms |
344 KB |
Output is correct |
4 |
Correct |
1 ms |
348 KB |
Output is correct |
5 |
Correct |
1 ms |
348 KB |
Output is correct |
6 |
Correct |
1 ms |
348 KB |
Output is correct |
7 |
Correct |
2 ms |
344 KB |
Output is correct |
8 |
Correct |
4 ms |
604 KB |
Output is correct |
9 |
Correct |
5 ms |
600 KB |
Output is correct |
10 |
Correct |
5 ms |
600 KB |
Output is correct |
11 |
Correct |
5 ms |
600 KB |
Output is correct |
12 |
Correct |
4 ms |
600 KB |
Output is correct |
13 |
Correct |
1 ms |
344 KB |
Output is correct |
14 |
Correct |
0 ms |
344 KB |
Output is correct |
15 |
Correct |
0 ms |
344 KB |
Output is correct |
16 |
Correct |
1 ms |
344 KB |
Output is correct |
17 |
Correct |
1 ms |
344 KB |
Output is correct |
18 |
Correct |
1 ms |
344 KB |
Output is correct |
19 |
Correct |
1 ms |
344 KB |
Output is correct |
20 |
Correct |
1 ms |
344 KB |
Output is correct |
21 |
Correct |
1 ms |
344 KB |
Output is correct |
22 |
Correct |
1 ms |
348 KB |
Output is correct |
23 |
Correct |
1 ms |
344 KB |
Output is correct |
24 |
Correct |
1 ms |
348 KB |
Output is correct |
25 |
Correct |
1 ms |
344 KB |
Output is correct |
26 |
Correct |
1 ms |
348 KB |
Output is correct |
27 |
Correct |
2 ms |
1112 KB |
Output is correct |
28 |
Correct |
2 ms |
856 KB |
Output is correct |
29 |
Correct |
1 ms |
860 KB |
Output is correct |
30 |
Correct |
1 ms |
860 KB |
Output is correct |
31 |
Correct |
2 ms |
856 KB |
Output is correct |
32 |
Correct |
2 ms |
860 KB |
Output is correct |
33 |
Correct |
2 ms |
1112 KB |
Output is correct |
34 |
Correct |
2 ms |
856 KB |
Output is correct |
35 |
Correct |
2 ms |
856 KB |
Output is correct |
36 |
Correct |
2 ms |
860 KB |
Output is correct |
37 |
Correct |
2 ms |
856 KB |
Output is correct |
38 |
Correct |
2 ms |
856 KB |
Output is correct |
39 |
Correct |
1 ms |
600 KB |
Output is correct |
40 |
Correct |
1 ms |
600 KB |
Output is correct |
41 |
Correct |
2 ms |
856 KB |
Output is correct |
42 |
Correct |
2 ms |
856 KB |
Output is correct |
43 |
Correct |
2 ms |
1112 KB |
Output is correct |
44 |
Correct |
2 ms |
856 KB |
Output is correct |
45 |
Correct |
2 ms |
1112 KB |
Output is correct |
46 |
Correct |
1 ms |
600 KB |
Output is correct |
47 |
Correct |
1 ms |
856 KB |
Output is correct |
48 |
Correct |
1 ms |
856 KB |
Output is correct |
49 |
Correct |
1 ms |
856 KB |
Output is correct |
50 |
Correct |
2 ms |
1112 KB |
Output is correct |
51 |
Correct |
1 ms |
856 KB |
Output is correct |
52 |
Correct |
2 ms |
1112 KB |
Output is correct |
53 |
Correct |
1 ms |
1116 KB |
Output is correct |
54 |
Correct |
1 ms |
860 KB |
Output is correct |
55 |
Correct |
2 ms |
856 KB |
Output is correct |
56 |
Correct |
2 ms |
856 KB |
Output is correct |
57 |
Correct |
2 ms |
860 KB |
Output is correct |
58 |
Correct |
2 ms |
856 KB |
Output is correct |
59 |
Correct |
198 ms |
61652 KB |
Output is correct |
60 |
Correct |
232 ms |
61264 KB |
Output is correct |
61 |
Correct |
230 ms |
62692 KB |
Output is correct |
62 |
Correct |
287 ms |
61520 KB |
Output is correct |
63 |
Correct |
334 ms |
61264 KB |
Output is correct |
64 |
Correct |
243 ms |
61520 KB |
Output is correct |
65 |
Correct |
273 ms |
61488 KB |
Output is correct |
66 |
Correct |
196 ms |
43356 KB |
Output is correct |
67 |
Correct |
280 ms |
61264 KB |
Output is correct |
68 |
Correct |
254 ms |
57424 KB |
Output is correct |
69 |
Correct |
312 ms |
62036 KB |
Output is correct |
70 |
Correct |
282 ms |
61380 KB |
Output is correct |
71 |
Correct |
276 ms |
61360 KB |
Output is correct |
72 |
Correct |
287 ms |
62256 KB |
Output is correct |
73 |
Correct |
22 ms |
600 KB |
Output is correct |
74 |
Correct |
2 ms |
600 KB |
Output is correct |
75 |
Correct |
435 ms |
31800 KB |
Output is correct |
76 |
Correct |
338 ms |
32080 KB |
Output is correct |
77 |
Correct |
882 ms |
63204 KB |
Output is correct |
78 |
Correct |
839 ms |
63308 KB |
Output is correct |
79 |
Correct |
838 ms |
63356 KB |
Output is correct |
80 |
Correct |
316 ms |
63200 KB |
Output is correct |
81 |
Correct |
331 ms |
63056 KB |
Output is correct |
82 |
Correct |
305 ms |
63208 KB |
Output is correct |
83 |
Correct |
299 ms |
63056 KB |
Output is correct |
84 |
Correct |
311 ms |
63208 KB |
Output is correct |
85 |
Correct |
294 ms |
63208 KB |
Output is correct |
86 |
Correct |
733 ms |
63112 KB |
Output is correct |
87 |
Correct |
730 ms |
63056 KB |
Output is correct |
88 |
Correct |
713 ms |
63356 KB |
Output is correct |
89 |
Correct |
351 ms |
63208 KB |
Output is correct |
90 |
Execution timed out |
3547 ms |
62540 KB |
Time limit exceeded |
91 |
Halted |
0 ms |
0 KB |
- |