# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
649416 | 2022-10-10T07:52:39 Z | ToroTN | Horses (IOI15_horses) | C++14 | 1500 ms | 14988 KB |
#include<bits/stdc++.h> using namespace std; #include "horses.h" #define ll long long ll n,x[500005],y[500005],z[100005],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(z[i+1]*x[i+1]<y[i]) { node=i; z[i]=y[i]; }else { z[i]=z[i+1]*x[i+1]; } } printf("node=%lld\n",node); ans=1; for(int i=1;i<=node;i++) { ans*=x[i]; ans%=md; printf("%lld ",ans); } ans*=y[node]; ans%=md; printf("%lld ",ans); printf("\n"); 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(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(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 | Incorrect | 1 ms | 212 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 1 ms | 212 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Execution timed out | 1557 ms | 14988 KB | Time limit exceeded |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 1 ms | 212 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 1 ms | 312 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |