# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
88755 |
2018-12-08T13:18:14 Z |
David_M |
Horses (IOI15_horses) |
C++14 |
|
894 ms |
276176 KB |
#include "horses.h"
#include<bits/stdc++.h>
using namespace std;
struct ABC{int A, x, y; double X, Y, m;} a[2000010];
int n, u=1000000007, I;
void upd(int l, int r, int i, int k, int x, int y){
if(r<k || k<l) return;
if(l==k && l==r){
if(x) a[i].X=log10(x), a[i].x=x, a[i].m=a[i].X+a[i].Y;
if(y) a[i].Y=log10(y), a[i].y=y, a[i].m=a[i].X+a[i].Y;
a[i].A=1LL*a[i].x*a[i].y%u;
return;
}int L=i*2, R=i*2+1;
upd(l, (l+r)/2, L,k,x,y);
upd((l+r)/2+1,r,R,k,x,y);
a[i].X=a[L].X+a[R].X;
a[i].x=1LL*a[L].x*a[R].x%u;
if(a[L].m<a[R].m+a[L].X)
a[i].m=a[R].m+a[L].X,
a[i].A=1LL* a[R].A*a[L].x%u;
else
a[i].m=a[L].m,
a[i].A=a[L].A;
}
int init(int N,int X[],int Y[]){n=N; for(I=0;I<n;I++) upd(0,n-1,1,I,X[I],Y[I]); return a[1].A;}
int updateX(int pos,int val){upd(0,n-1,1,pos,val,0); return a[1].A;}
int updateY(int pos,int val){upd(0,n-1,1,pos,0,val); return a[1].A;}
Compilation message
horses.cpp: In function 'void upd(int, int, int, int, int, int)':
horses.cpp:11:30: warning: conversion to 'int' from 'long long int' may alter its value [-Wconversion]
a[i].A=1LL*a[i].x*a[i].y%u;
~~~~~~~~~~~~~~~~~^~
horses.cpp:18:29: warning: conversion to 'int' from 'long long int' may alter its value [-Wconversion]
a[i].x=1LL*a[L].x*a[R].x%u;
~~~~~~~~~~~~~~~~~^~
horses.cpp:22:28: warning: conversion to 'int' from 'long long int' may alter its value [-Wconversion]
a[i].A=1LL* a[R].A*a[L].x%u;
~~~~~~~~~~~~~~~~~~^~
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
2 ms |
376 KB |
Output is correct |
2 |
Correct |
2 ms |
380 KB |
Output is correct |
3 |
Correct |
2 ms |
380 KB |
Output is correct |
4 |
Correct |
2 ms |
440 KB |
Output is correct |
5 |
Correct |
1 ms |
504 KB |
Output is correct |
6 |
Correct |
2 ms |
640 KB |
Output is correct |
7 |
Correct |
2 ms |
640 KB |
Output is correct |
8 |
Correct |
2 ms |
640 KB |
Output is correct |
9 |
Correct |
2 ms |
660 KB |
Output is correct |
10 |
Correct |
2 ms |
660 KB |
Output is correct |
11 |
Correct |
2 ms |
660 KB |
Output is correct |
12 |
Correct |
20 ms |
660 KB |
Output is correct |
13 |
Correct |
2 ms |
660 KB |
Output is correct |
14 |
Correct |
2 ms |
660 KB |
Output is correct |
15 |
Correct |
2 ms |
660 KB |
Output is correct |
16 |
Correct |
2 ms |
660 KB |
Output is correct |
17 |
Correct |
2 ms |
660 KB |
Output is correct |
18 |
Correct |
2 ms |
660 KB |
Output is correct |
19 |
Correct |
2 ms |
660 KB |
Output is correct |
20 |
Correct |
2 ms |
660 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
2 ms |
660 KB |
Output is correct |
2 |
Correct |
2 ms |
660 KB |
Output is correct |
3 |
Correct |
2 ms |
660 KB |
Output is correct |
4 |
Correct |
2 ms |
660 KB |
Output is correct |
5 |
Correct |
2 ms |
660 KB |
Output is correct |
6 |
Correct |
2 ms |
660 KB |
Output is correct |
7 |
Correct |
2 ms |
660 KB |
Output is correct |
8 |
Correct |
2 ms |
660 KB |
Output is correct |
9 |
Correct |
2 ms |
660 KB |
Output is correct |
10 |
Correct |
2 ms |
660 KB |
Output is correct |
11 |
Correct |
2 ms |
660 KB |
Output is correct |
12 |
Correct |
2 ms |
660 KB |
Output is correct |
13 |
Correct |
2 ms |
660 KB |
Output is correct |
14 |
Correct |
2 ms |
660 KB |
Output is correct |
15 |
Correct |
2 ms |
660 KB |
Output is correct |
16 |
Correct |
2 ms |
660 KB |
Output is correct |
17 |
Correct |
2 ms |
660 KB |
Output is correct |
18 |
Correct |
2 ms |
660 KB |
Output is correct |
19 |
Correct |
2 ms |
660 KB |
Output is correct |
20 |
Correct |
2 ms |
660 KB |
Output is correct |
21 |
Correct |
2 ms |
660 KB |
Output is correct |
22 |
Correct |
2 ms |
660 KB |
Output is correct |
23 |
Correct |
3 ms |
672 KB |
Output is correct |
24 |
Correct |
3 ms |
840 KB |
Output is correct |
25 |
Correct |
3 ms |
840 KB |
Output is correct |
26 |
Correct |
3 ms |
840 KB |
Output is correct |
27 |
Correct |
3 ms |
840 KB |
Output is correct |
28 |
Correct |
3 ms |
840 KB |
Output is correct |
29 |
Correct |
3 ms |
868 KB |
Output is correct |
30 |
Correct |
3 ms |
912 KB |
Output is correct |
31 |
Correct |
3 ms |
932 KB |
Output is correct |
32 |
Correct |
3 ms |
948 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
468 ms |
46784 KB |
Output is correct |
2 |
Correct |
602 ms |
59604 KB |
Output is correct |
3 |
Correct |
543 ms |
63244 KB |
Output is correct |
4 |
Correct |
550 ms |
70868 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
2 ms |
70868 KB |
Output is correct |
2 |
Correct |
2 ms |
70868 KB |
Output is correct |
3 |
Correct |
2 ms |
70868 KB |
Output is correct |
4 |
Correct |
2 ms |
70868 KB |
Output is correct |
5 |
Correct |
2 ms |
70868 KB |
Output is correct |
6 |
Correct |
2 ms |
70868 KB |
Output is correct |
7 |
Correct |
2 ms |
70868 KB |
Output is correct |
8 |
Correct |
2 ms |
70868 KB |
Output is correct |
9 |
Correct |
2 ms |
70868 KB |
Output is correct |
10 |
Correct |
1 ms |
70868 KB |
Output is correct |
11 |
Correct |
2 ms |
70868 KB |
Output is correct |
12 |
Correct |
2 ms |
70868 KB |
Output is correct |
13 |
Correct |
2 ms |
70868 KB |
Output is correct |
14 |
Correct |
2 ms |
70868 KB |
Output is correct |
15 |
Correct |
2 ms |
70868 KB |
Output is correct |
16 |
Correct |
2 ms |
70868 KB |
Output is correct |
17 |
Correct |
2 ms |
70868 KB |
Output is correct |
18 |
Correct |
2 ms |
70868 KB |
Output is correct |
19 |
Correct |
2 ms |
70868 KB |
Output is correct |
20 |
Correct |
2 ms |
70868 KB |
Output is correct |
21 |
Correct |
2 ms |
70868 KB |
Output is correct |
22 |
Correct |
2 ms |
70868 KB |
Output is correct |
23 |
Correct |
3 ms |
70868 KB |
Output is correct |
24 |
Correct |
4 ms |
70868 KB |
Output is correct |
25 |
Correct |
3 ms |
70868 KB |
Output is correct |
26 |
Correct |
3 ms |
70868 KB |
Output is correct |
27 |
Correct |
3 ms |
70868 KB |
Output is correct |
28 |
Correct |
3 ms |
70868 KB |
Output is correct |
29 |
Correct |
4 ms |
70868 KB |
Output is correct |
30 |
Correct |
3 ms |
70868 KB |
Output is correct |
31 |
Correct |
3 ms |
70868 KB |
Output is correct |
32 |
Correct |
3 ms |
70868 KB |
Output is correct |
33 |
Correct |
396 ms |
74256 KB |
Output is correct |
34 |
Correct |
396 ms |
78172 KB |
Output is correct |
35 |
Correct |
441 ms |
89000 KB |
Output is correct |
36 |
Correct |
436 ms |
99764 KB |
Output is correct |
37 |
Correct |
355 ms |
101920 KB |
Output is correct |
38 |
Correct |
411 ms |
104948 KB |
Output is correct |
39 |
Correct |
351 ms |
106960 KB |
Output is correct |
40 |
Correct |
408 ms |
113012 KB |
Output is correct |
41 |
Correct |
347 ms |
114876 KB |
Output is correct |
42 |
Correct |
351 ms |
117084 KB |
Output is correct |
43 |
Correct |
557 ms |
123360 KB |
Output is correct |
44 |
Correct |
396 ms |
129724 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
2 ms |
129724 KB |
Output is correct |
2 |
Correct |
2 ms |
129724 KB |
Output is correct |
3 |
Correct |
2 ms |
129724 KB |
Output is correct |
4 |
Correct |
2 ms |
129724 KB |
Output is correct |
5 |
Correct |
2 ms |
129724 KB |
Output is correct |
6 |
Correct |
2 ms |
129724 KB |
Output is correct |
7 |
Correct |
2 ms |
129724 KB |
Output is correct |
8 |
Correct |
2 ms |
129724 KB |
Output is correct |
9 |
Correct |
2 ms |
129724 KB |
Output is correct |
10 |
Correct |
2 ms |
129724 KB |
Output is correct |
11 |
Correct |
2 ms |
129724 KB |
Output is correct |
12 |
Correct |
2 ms |
129724 KB |
Output is correct |
13 |
Correct |
2 ms |
129724 KB |
Output is correct |
14 |
Correct |
2 ms |
129724 KB |
Output is correct |
15 |
Correct |
2 ms |
129724 KB |
Output is correct |
16 |
Correct |
2 ms |
129724 KB |
Output is correct |
17 |
Correct |
2 ms |
129724 KB |
Output is correct |
18 |
Correct |
2 ms |
129724 KB |
Output is correct |
19 |
Correct |
2 ms |
129724 KB |
Output is correct |
20 |
Correct |
2 ms |
129724 KB |
Output is correct |
21 |
Correct |
2 ms |
129724 KB |
Output is correct |
22 |
Correct |
2 ms |
129724 KB |
Output is correct |
23 |
Correct |
3 ms |
129724 KB |
Output is correct |
24 |
Correct |
3 ms |
129724 KB |
Output is correct |
25 |
Correct |
3 ms |
129724 KB |
Output is correct |
26 |
Correct |
3 ms |
129724 KB |
Output is correct |
27 |
Correct |
3 ms |
129724 KB |
Output is correct |
28 |
Correct |
3 ms |
129724 KB |
Output is correct |
29 |
Correct |
3 ms |
129724 KB |
Output is correct |
30 |
Correct |
2 ms |
129724 KB |
Output is correct |
31 |
Correct |
3 ms |
129724 KB |
Output is correct |
32 |
Correct |
3 ms |
129724 KB |
Output is correct |
33 |
Correct |
465 ms |
134980 KB |
Output is correct |
34 |
Correct |
894 ms |
147328 KB |
Output is correct |
35 |
Correct |
535 ms |
151080 KB |
Output is correct |
36 |
Correct |
575 ms |
158748 KB |
Output is correct |
37 |
Correct |
395 ms |
161832 KB |
Output is correct |
38 |
Correct |
398 ms |
165736 KB |
Output is correct |
39 |
Correct |
430 ms |
176816 KB |
Output is correct |
40 |
Correct |
436 ms |
187048 KB |
Output is correct |
41 |
Correct |
360 ms |
188500 KB |
Output is correct |
42 |
Correct |
410 ms |
191552 KB |
Output is correct |
43 |
Correct |
347 ms |
193676 KB |
Output is correct |
44 |
Correct |
413 ms |
198988 KB |
Output is correct |
45 |
Correct |
345 ms |
201068 KB |
Output is correct |
46 |
Correct |
349 ms |
203108 KB |
Output is correct |
47 |
Correct |
404 ms |
209372 KB |
Output is correct |
48 |
Correct |
395 ms |
215928 KB |
Output is correct |
49 |
Correct |
560 ms |
221928 KB |
Output is correct |
50 |
Correct |
545 ms |
226856 KB |
Output is correct |
51 |
Correct |
511 ms |
238000 KB |
Output is correct |
52 |
Correct |
512 ms |
248764 KB |
Output is correct |
53 |
Correct |
496 ms |
252024 KB |
Output is correct |
54 |
Correct |
513 ms |
255764 KB |
Output is correct |
55 |
Correct |
418 ms |
257924 KB |
Output is correct |
56 |
Correct |
498 ms |
265520 KB |
Output is correct |
57 |
Correct |
413 ms |
268544 KB |
Output is correct |
58 |
Correct |
424 ms |
270852 KB |
Output is correct |
59 |
Correct |
402 ms |
276176 KB |
Output is correct |