# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
512546 | AdamGS | Horses (IOI15_horses) | C++17 | 1593 ms | 15972 KiB |
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include "horses.h"
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
#define rep(a, b) for(int a = 0; a < (b); ++a)
#define st first
#define nd second
#define pb push_back
#define all(a) a.begin(), a.end()
const int LIM=5e5+7;
const ll MOD=1e9+7;
ll X[LIM], Y[LIM], n;
ll solve() {
ll p=1, k=n;
while(p<MOD && k>0) {
--k;
p*=X[k];
}
if(p>=MOD) ++k;
p=1;
ll ans=1, x=1;
if(k) ans=Y[k-1];
rep(i, k) x=(x*X[i])%MOD;
while(k<n) {
p*=X[k];
ans=max(ans, p*Y[k]);
++k;
}
ans%=MOD;
ans=(ans*x)%MOD;
return ans;
}
int init(int D, int A[], int B[]) {
n=D;
rep(i, n) {
X[i]=A[i];
Y[i]=B[i];
}
return solve();
}
int updateX(int pos, int val) {
X[pos]=val;
return solve();
}
int updateY(int pos, int val) {
Y[pos]=val;
return solve();
}
컴파일 시 표준 에러 (stderr) 메시지
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |