# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
649424 | 2022-10-10T07:57:37 Z | ToroTN | Horses (IOI15_horses) | C++14 | 1500 ms | 19912 KB |
#include<bits/stdc++.h> using namespace std; #include "horses.h" #define ll long long ll n,x[500005],y[500005],z[500005],node,ans,md=1000000007; int init(int N, int X[], int Y[]) { n=N; for(int i=1;i<=n;i++) { x[i]=X[i-1]; y[i]=Y[i-1]; } node=n; z[n]=y[n]; for(int i=n-1;i>=1;i--) { if(x[i+1]>1e9||z[i+1]>1e9) { z[i]=1e18; }else { if(z[i+1]*x[i+1]<y[i]) { node=i; z[i]=y[i]; }else { z[i]=z[i+1]*x[i+1]; } } } ans=1; for(int i=1;i<=node;i++) { ans*=x[i]; ans%=md; } ans*=y[node]; ans%=md; return ans; } int updateX(int pos, int val) { pos+=1; x[pos]=val; z[n]=y[n]; node=n; for(int i=n-1;i>=1;i--) { if(x[i+1]>1e9||z[i+1]>1e9) { z[i]=1e18; }else { if(z[i+1]*x[i+1]<y[i]) { node=i; z[i]=y[i]; }else { z[i]=z[i+1]*x[i+1]; } } } ans=1; for(int i=1;i<=node;i++) { ans*=x[i]; ans%=md; } ans*=y[node]; ans%=md; return ans; } int updateY(int pos, int val) { pos+=1; y[pos]=val; z[n]=y[n]; node=n; for(int i=n-1;i>=1;i--) { if(x[i+1]>1e9||z[i+1]>1e9) { z[i]=1e18; }else { if(z[i+1]*x[i+1]<y[i]) { node=i; z[i]=y[i]; }else { z[i]=z[i+1]*x[i+1]; } } } ans=1; for(int i=1;i<=node;i++) { ans*=x[i]; ans%=md; } ans*=y[node]; ans%=md; return ans; }
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 0 ms | 212 KB | Output is correct |
2 | Correct | 1 ms | 212 KB | Output is correct |
3 | Correct | 1 ms | 308 KB | Output is correct |
4 | Correct | 1 ms | 212 KB | Output is correct |
5 | Correct | 1 ms | 212 KB | Output is correct |
6 | Correct | 1 ms | 212 KB | Output is correct |
7 | Correct | 1 ms | 212 KB | Output is correct |
8 | Correct | 1 ms | 212 KB | Output is correct |
9 | Correct | 1 ms | 212 KB | Output is correct |
10 | Correct | 1 ms | 212 KB | Output is correct |
11 | Correct | 1 ms | 212 KB | Output is correct |
12 | Correct | 1 ms | 212 KB | Output is correct |
13 | Correct | 0 ms | 212 KB | Output is correct |
14 | Correct | 1 ms | 212 KB | Output is correct |
15 | Correct | 0 ms | 212 KB | Output is correct |
16 | Correct | 1 ms | 212 KB | Output is correct |
17 | Correct | 1 ms | 212 KB | Output is correct |
18 | Correct | 1 ms | 308 KB | Output is correct |
19 | Correct | 1 ms | 212 KB | Output is correct |
20 | Correct | 1 ms | 212 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 0 ms | 212 KB | Output is correct |
2 | Correct | 1 ms | 308 KB | Output is correct |
3 | Correct | 1 ms | 212 KB | Output is correct |
4 | Correct | 1 ms | 212 KB | Output is correct |
5 | Correct | 1 ms | 212 KB | Output is correct |
6 | Correct | 0 ms | 212 KB | Output is correct |
7 | Correct | 1 ms | 212 KB | Output is correct |
8 | Correct | 1 ms | 212 KB | Output is correct |
9 | Correct | 1 ms | 212 KB | Output is correct |
10 | Correct | 1 ms | 212 KB | Output is correct |
11 | Correct | 1 ms | 212 KB | Output is correct |
12 | Correct | 1 ms | 212 KB | Output is correct |
13 | Correct | 1 ms | 304 KB | Output is correct |
14 | Correct | 1 ms | 212 KB | Output is correct |
15 | Correct | 1 ms | 212 KB | Output is correct |
16 | Correct | 1 ms | 212 KB | Output is correct |
17 | Correct | 1 ms | 212 KB | Output is correct |
18 | Correct | 1 ms | 304 KB | Output is correct |
19 | Correct | 1 ms | 212 KB | Output is correct |
20 | Correct | 1 ms | 212 KB | Output is correct |
21 | Correct | 1 ms | 212 KB | Output is correct |
22 | Correct | 1 ms | 212 KB | Output is correct |
23 | Correct | 8 ms | 380 KB | Output is correct |
24 | Correct | 8 ms | 376 KB | Output is correct |
25 | Correct | 12 ms | 340 KB | Output is correct |
26 | Correct | 13 ms | 380 KB | Output is correct |
27 | Correct | 8 ms | 320 KB | Output is correct |
28 | Correct | 8 ms | 320 KB | Output is correct |
29 | Correct | 9 ms | 340 KB | Output is correct |
30 | Correct | 10 ms | 320 KB | Output is correct |
31 | Correct | 6 ms | 376 KB | Output is correct |
32 | Correct | 7 ms | 340 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Execution timed out | 1588 ms | 16788 KB | Time limit exceeded |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 0 ms | 212 KB | Output is correct |
2 | Correct | 1 ms | 212 KB | Output is correct |
3 | Correct | 1 ms | 212 KB | Output is correct |
4 | Correct | 1 ms | 212 KB | Output is correct |
5 | Correct | 1 ms | 212 KB | Output is correct |
6 | Correct | 1 ms | 212 KB | Output is correct |
7 | Correct | 0 ms | 212 KB | Output is correct |
8 | Correct | 1 ms | 304 KB | Output is correct |
9 | Correct | 1 ms | 212 KB | Output is correct |
10 | Correct | 1 ms | 212 KB | Output is correct |
11 | Correct | 1 ms | 212 KB | Output is correct |
12 | Correct | 1 ms | 304 KB | Output is correct |
13 | Correct | 1 ms | 308 KB | Output is correct |
14 | Correct | 1 ms | 212 KB | Output is correct |
15 | Correct | 1 ms | 212 KB | Output is correct |
16 | Correct | 1 ms | 340 KB | Output is correct |
17 | Correct | 1 ms | 212 KB | Output is correct |
18 | Correct | 1 ms | 212 KB | Output is correct |
19 | Correct | 1 ms | 212 KB | Output is correct |
20 | Correct | 1 ms | 212 KB | Output is correct |
21 | Correct | 1 ms | 304 KB | Output is correct |
22 | Correct | 0 ms | 212 KB | Output is correct |
23 | Correct | 7 ms | 340 KB | Output is correct |
24 | Correct | 8 ms | 376 KB | Output is correct |
25 | Correct | 12 ms | 340 KB | Output is correct |
26 | Correct | 12 ms | 320 KB | Output is correct |
27 | Correct | 8 ms | 340 KB | Output is correct |
28 | Correct | 7 ms | 340 KB | Output is correct |
29 | Correct | 9 ms | 340 KB | Output is correct |
30 | Correct | 12 ms | 340 KB | Output is correct |
31 | Correct | 5 ms | 340 KB | Output is correct |
32 | Correct | 7 ms | 384 KB | Output is correct |
33 | Execution timed out | 1559 ms | 19912 KB | Time limit exceeded |
34 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 0 ms | 212 KB | Output is correct |
2 | Correct | 0 ms | 212 KB | Output is correct |
3 | Correct | 0 ms | 212 KB | Output is correct |
4 | Correct | 0 ms | 212 KB | Output is correct |
5 | Correct | 1 ms | 212 KB | Output is correct |
6 | Correct | 0 ms | 212 KB | Output is correct |
7 | Correct | 1 ms | 212 KB | Output is correct |
8 | Correct | 1 ms | 212 KB | Output is correct |
9 | Correct | 0 ms | 212 KB | Output is correct |
10 | Correct | 1 ms | 212 KB | Output is correct |
11 | Correct | 0 ms | 212 KB | Output is correct |
12 | Correct | 1 ms | 212 KB | Output is correct |
13 | Correct | 0 ms | 212 KB | Output is correct |
14 | Correct | 0 ms | 212 KB | Output is correct |
15 | Correct | 0 ms | 212 KB | Output is correct |
16 | Correct | 1 ms | 212 KB | Output is correct |
17 | Correct | 0 ms | 212 KB | Output is correct |
18 | Correct | 0 ms | 212 KB | Output is correct |
19 | Correct | 1 ms | 212 KB | Output is correct |
20 | Correct | 0 ms | 212 KB | Output is correct |
21 | Correct | 1 ms | 212 KB | Output is correct |
22 | Correct | 1 ms | 212 KB | Output is correct |
23 | Correct | 8 ms | 384 KB | Output is correct |
24 | Correct | 7 ms | 340 KB | Output is correct |
25 | Correct | 11 ms | 388 KB | Output is correct |
26 | Correct | 12 ms | 384 KB | Output is correct |
27 | Correct | 8 ms | 316 KB | Output is correct |
28 | Correct | 8 ms | 340 KB | Output is correct |
29 | Correct | 10 ms | 368 KB | Output is correct |
30 | Correct | 11 ms | 340 KB | Output is correct |
31 | Correct | 5 ms | 316 KB | Output is correct |
32 | Correct | 8 ms | 404 KB | Output is correct |
33 | Execution timed out | 1577 ms | 18120 KB | Time limit exceeded |
34 | Halted | 0 ms | 0 KB | - |