# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
1085331 | 2024-09-08T03:12:21 Z | guagua0407 | Horses (IOI15_horses) | C++17 | 1500 ms | 10228 KB |
#include "horses.h" #include <bits/stdc++.h> using namespace std; #define ll long long #define pii pair<int,int> #define f first #define s second #define all(x) x.begin(),x.end() #define _ ios::sync_with_stdio(0); cin.tie(0); cout.tie(0); int n; vector<int> x,y; const ll inf=1e9; const ll mod=1e9+7; int init(int N, int X[], int Y[]) { n=N; x.resize(n); y.resize(n); for(int i=0;i<n;i++){ x[i]=X[i]; y[i]=Y[i]; } int best=n-1; ll cur=y[n-1]; for(int i=n-1;i>=0;i--){ if(cur*x[i]>inf) break; cur*=x[i]; if(y[i]>cur){ best=i; cur=y[i]; } } ll ans=1; for(int i=0;i<=best;i++){ ans=ans*x[i]%mod; } ans=ans*y[best]%mod; return ans; } int updateX(int pos, int val) { x[pos]=val; int best=n-1; ll cur=y[n-1]; for(int i=n-1;i>=0;i--){ if(cur*x[i]>inf) break; cur*=x[i]; if(y[i]>cur){ best=i; cur=y[i]; } } ll ans=1; for(int i=0;i<=best;i++){ ans=ans*x[i]%mod; } ans=ans*y[best]%mod; return ans; return 0; } int updateY(int pos, int val) { y[pos]=val; int best=n-1; ll cur=y[n-1]; for(int i=n-1;i>=0;i--){ if(cur*x[i]>inf) break; cur*=x[i]; if(y[i]>cur){ best=i; cur=y[i]; } } ll ans=1; for(int i=0;i<=best;i++){ ans=ans*x[i]%mod; } ans=ans*y[best]%mod; return ans; return 0; }
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 0 ms | 344 KB | Output is correct |
2 | Incorrect | 0 ms | 348 KB | Output isn't correct |
3 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 0 ms | 348 KB | Output is correct |
2 | Incorrect | 0 ms | 348 KB | Output isn't correct |
3 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Execution timed out | 1555 ms | 10228 KB | Time limit exceeded |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 0 ms | 348 KB | Output is correct |
2 | Incorrect | 0 ms | 348 KB | Output isn't correct |
3 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 0 ms | 348 KB | Output is correct |
2 | Incorrect | 0 ms | 348 KB | Output isn't correct |
3 | Halted | 0 ms | 0 KB | - |