# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
296683 |
2020-09-10T19:08:37 Z |
peti1234 |
Horses (IOI15_horses) |
C++17 |
|
323 ms |
61944 KB |
#include<bits/stdc++.h>
using namespace std;
const int c=524288;
long long mod=1e9+7;
struct s{
long long r, x, y;
double R, X, Y;
} t[2*c];
void upd(int a) {
int x=2*a, y=x+1;
t[a].X=t[x].X+t[y].X, t[a].x=t[x].x*t[y].x%mod;
if (t[x].R>=t[x].X+t[y].R) {
t[a].R=t[x].R, t[a].r=t[x].r;
} else {
t[a].R=t[x].X+t[y].R;
t[a].r=t[x].x*t[y].r%mod;
}
if (a>1) upd(a/2);
}
void add(int a, int x, int y) {
if (x) t[a].x=x, t[a].X=log(x);
if (y) t[a].y=y, t[a].Y=log(y);
t[a].r=t[a].x*t[a].y%mod, t[a].R=t[a].X+t[a].Y;
upd(a/2);
}
int init(int n, int x[], int y[]) {
for (int i=0; i<n; i++) add(c+i, x[i], y[i]);
return t[1].r;
}
int updateX(int a, int b) {
add(c+a, b, 0);
return t[1].r;
}
int updateY(int a, int b) {
add(c+a, 0, b);
return t[1].r;
}
Compilation message
horses.cpp: In function 'int init(int, int*, int*)':
horses.cpp:28:17: warning: conversion from 'long long int' to 'int' may change value [-Wconversion]
28 | return t[1].r;
| ~~~~~^
horses.cpp: In function 'int updateX(int, int)':
horses.cpp:32:17: warning: conversion from 'long long int' to 'int' may change value [-Wconversion]
32 | return t[1].r;
| ~~~~~^
horses.cpp: In function 'int updateY(int, int)':
horses.cpp:36:17: warning: conversion from 'long long int' to 'int' may change value [-Wconversion]
36 | return t[1].r;
| ~~~~~^
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
384 KB |
Output is correct |
2 |
Correct |
0 ms |
384 KB |
Output is correct |
3 |
Correct |
1 ms |
384 KB |
Output is correct |
4 |
Correct |
1 ms |
384 KB |
Output is correct |
5 |
Correct |
0 ms |
384 KB |
Output is correct |
6 |
Correct |
0 ms |
384 KB |
Output is correct |
7 |
Correct |
0 ms |
384 KB |
Output is correct |
8 |
Correct |
0 ms |
384 KB |
Output is correct |
9 |
Correct |
1 ms |
384 KB |
Output is correct |
10 |
Correct |
0 ms |
384 KB |
Output is correct |
11 |
Correct |
0 ms |
384 KB |
Output is correct |
12 |
Correct |
0 ms |
384 KB |
Output is correct |
13 |
Correct |
1 ms |
384 KB |
Output is correct |
14 |
Correct |
1 ms |
384 KB |
Output is correct |
15 |
Correct |
0 ms |
384 KB |
Output is correct |
16 |
Correct |
1 ms |
384 KB |
Output is correct |
17 |
Correct |
1 ms |
384 KB |
Output is correct |
18 |
Correct |
1 ms |
512 KB |
Output is correct |
19 |
Correct |
1 ms |
384 KB |
Output is correct |
20 |
Correct |
1 ms |
384 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
384 KB |
Output is correct |
2 |
Correct |
0 ms |
384 KB |
Output is correct |
3 |
Correct |
1 ms |
384 KB |
Output is correct |
4 |
Correct |
0 ms |
384 KB |
Output is correct |
5 |
Correct |
1 ms |
384 KB |
Output is correct |
6 |
Correct |
0 ms |
384 KB |
Output is correct |
7 |
Correct |
0 ms |
384 KB |
Output is correct |
8 |
Correct |
0 ms |
384 KB |
Output is correct |
9 |
Correct |
1 ms |
384 KB |
Output is correct |
10 |
Correct |
1 ms |
384 KB |
Output is correct |
11 |
Correct |
1 ms |
384 KB |
Output is correct |
12 |
Correct |
0 ms |
384 KB |
Output is correct |
13 |
Correct |
1 ms |
384 KB |
Output is correct |
14 |
Correct |
1 ms |
384 KB |
Output is correct |
15 |
Correct |
1 ms |
384 KB |
Output is correct |
16 |
Correct |
1 ms |
384 KB |
Output is correct |
17 |
Correct |
1 ms |
384 KB |
Output is correct |
18 |
Correct |
0 ms |
384 KB |
Output is correct |
19 |
Correct |
1 ms |
384 KB |
Output is correct |
20 |
Correct |
1 ms |
384 KB |
Output is correct |
21 |
Correct |
1 ms |
384 KB |
Output is correct |
22 |
Correct |
1 ms |
384 KB |
Output is correct |
23 |
Correct |
2 ms |
512 KB |
Output is correct |
24 |
Correct |
1 ms |
512 KB |
Output is correct |
25 |
Correct |
2 ms |
544 KB |
Output is correct |
26 |
Correct |
2 ms |
588 KB |
Output is correct |
27 |
Correct |
1 ms |
504 KB |
Output is correct |
28 |
Correct |
1 ms |
512 KB |
Output is correct |
29 |
Correct |
1 ms |
512 KB |
Output is correct |
30 |
Correct |
1 ms |
512 KB |
Output is correct |
31 |
Correct |
1 ms |
512 KB |
Output is correct |
32 |
Correct |
1 ms |
512 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
222 ms |
52216 KB |
Output is correct |
2 |
Correct |
317 ms |
61176 KB |
Output is correct |
3 |
Correct |
255 ms |
56056 KB |
Output is correct |
4 |
Correct |
294 ms |
59900 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
384 KB |
Output is correct |
2 |
Correct |
1 ms |
384 KB |
Output is correct |
3 |
Correct |
0 ms |
384 KB |
Output is correct |
4 |
Correct |
0 ms |
384 KB |
Output is correct |
5 |
Correct |
0 ms |
384 KB |
Output is correct |
6 |
Correct |
0 ms |
384 KB |
Output is correct |
7 |
Correct |
0 ms |
384 KB |
Output is correct |
8 |
Correct |
1 ms |
384 KB |
Output is correct |
9 |
Correct |
1 ms |
384 KB |
Output is correct |
10 |
Correct |
0 ms |
384 KB |
Output is correct |
11 |
Correct |
0 ms |
384 KB |
Output is correct |
12 |
Correct |
0 ms |
384 KB |
Output is correct |
13 |
Correct |
0 ms |
384 KB |
Output is correct |
14 |
Correct |
0 ms |
384 KB |
Output is correct |
15 |
Correct |
1 ms |
384 KB |
Output is correct |
16 |
Correct |
1 ms |
384 KB |
Output is correct |
17 |
Correct |
0 ms |
384 KB |
Output is correct |
18 |
Correct |
0 ms |
384 KB |
Output is correct |
19 |
Correct |
0 ms |
384 KB |
Output is correct |
20 |
Correct |
1 ms |
384 KB |
Output is correct |
21 |
Correct |
1 ms |
384 KB |
Output is correct |
22 |
Correct |
1 ms |
384 KB |
Output is correct |
23 |
Correct |
1 ms |
512 KB |
Output is correct |
24 |
Correct |
1 ms |
512 KB |
Output is correct |
25 |
Correct |
1 ms |
512 KB |
Output is correct |
26 |
Correct |
2 ms |
512 KB |
Output is correct |
27 |
Correct |
1 ms |
512 KB |
Output is correct |
28 |
Correct |
1 ms |
512 KB |
Output is correct |
29 |
Correct |
1 ms |
512 KB |
Output is correct |
30 |
Correct |
2 ms |
512 KB |
Output is correct |
31 |
Correct |
1 ms |
512 KB |
Output is correct |
32 |
Correct |
1 ms |
512 KB |
Output is correct |
33 |
Correct |
166 ms |
55416 KB |
Output is correct |
34 |
Correct |
165 ms |
55288 KB |
Output is correct |
35 |
Correct |
237 ms |
61560 KB |
Output is correct |
36 |
Correct |
239 ms |
61560 KB |
Output is correct |
37 |
Correct |
128 ms |
53496 KB |
Output is correct |
38 |
Correct |
198 ms |
54396 KB |
Output is correct |
39 |
Correct |
124 ms |
53276 KB |
Output is correct |
40 |
Correct |
215 ms |
57336 KB |
Output is correct |
41 |
Correct |
124 ms |
53368 KB |
Output is correct |
42 |
Correct |
127 ms |
53496 KB |
Output is correct |
43 |
Correct |
201 ms |
57592 KB |
Output is correct |
44 |
Correct |
200 ms |
57592 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
384 KB |
Output is correct |
2 |
Correct |
0 ms |
384 KB |
Output is correct |
3 |
Correct |
0 ms |
384 KB |
Output is correct |
4 |
Correct |
0 ms |
384 KB |
Output is correct |
5 |
Correct |
0 ms |
384 KB |
Output is correct |
6 |
Correct |
1 ms |
384 KB |
Output is correct |
7 |
Correct |
1 ms |
384 KB |
Output is correct |
8 |
Correct |
0 ms |
384 KB |
Output is correct |
9 |
Correct |
0 ms |
384 KB |
Output is correct |
10 |
Correct |
1 ms |
384 KB |
Output is correct |
11 |
Correct |
0 ms |
384 KB |
Output is correct |
12 |
Correct |
1 ms |
384 KB |
Output is correct |
13 |
Correct |
0 ms |
384 KB |
Output is correct |
14 |
Correct |
0 ms |
384 KB |
Output is correct |
15 |
Correct |
0 ms |
384 KB |
Output is correct |
16 |
Correct |
1 ms |
384 KB |
Output is correct |
17 |
Correct |
1 ms |
384 KB |
Output is correct |
18 |
Correct |
0 ms |
384 KB |
Output is correct |
19 |
Correct |
1 ms |
384 KB |
Output is correct |
20 |
Correct |
0 ms |
384 KB |
Output is correct |
21 |
Correct |
0 ms |
384 KB |
Output is correct |
22 |
Correct |
1 ms |
384 KB |
Output is correct |
23 |
Correct |
1 ms |
512 KB |
Output is correct |
24 |
Correct |
1 ms |
512 KB |
Output is correct |
25 |
Correct |
1 ms |
512 KB |
Output is correct |
26 |
Correct |
1 ms |
512 KB |
Output is correct |
27 |
Correct |
1 ms |
512 KB |
Output is correct |
28 |
Correct |
1 ms |
512 KB |
Output is correct |
29 |
Correct |
1 ms |
512 KB |
Output is correct |
30 |
Correct |
1 ms |
512 KB |
Output is correct |
31 |
Correct |
1 ms |
512 KB |
Output is correct |
32 |
Correct |
1 ms |
512 KB |
Output is correct |
33 |
Correct |
221 ms |
56116 KB |
Output is correct |
34 |
Correct |
323 ms |
61320 KB |
Output is correct |
35 |
Correct |
270 ms |
56056 KB |
Output is correct |
36 |
Correct |
294 ms |
60024 KB |
Output is correct |
37 |
Correct |
162 ms |
55288 KB |
Output is correct |
38 |
Correct |
163 ms |
55288 KB |
Output is correct |
39 |
Correct |
239 ms |
61688 KB |
Output is correct |
40 |
Correct |
249 ms |
61560 KB |
Output is correct |
41 |
Correct |
128 ms |
53496 KB |
Output is correct |
42 |
Correct |
204 ms |
54392 KB |
Output is correct |
43 |
Correct |
126 ms |
53368 KB |
Output is correct |
44 |
Correct |
210 ms |
57208 KB |
Output is correct |
45 |
Correct |
126 ms |
53368 KB |
Output is correct |
46 |
Correct |
125 ms |
53496 KB |
Output is correct |
47 |
Correct |
199 ms |
57592 KB |
Output is correct |
48 |
Correct |
203 ms |
57592 KB |
Output is correct |
49 |
Correct |
239 ms |
57336 KB |
Output is correct |
50 |
Correct |
235 ms |
57464 KB |
Output is correct |
51 |
Correct |
274 ms |
61560 KB |
Output is correct |
52 |
Correct |
287 ms |
61944 KB |
Output is correct |
53 |
Correct |
196 ms |
55672 KB |
Output is correct |
54 |
Correct |
257 ms |
56184 KB |
Output is correct |
55 |
Correct |
163 ms |
54396 KB |
Output is correct |
56 |
Correct |
249 ms |
59256 KB |
Output is correct |
57 |
Correct |
159 ms |
55036 KB |
Output is correct |
58 |
Correct |
163 ms |
55544 KB |
Output is correct |
59 |
Correct |
204 ms |
57592 KB |
Output is correct |