| # | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
|---|---|---|---|---|---|---|---|
| 921663 | coding_snorlax | 말 (IOI15_horses) | C++14 | 0 ms | 0 KiB |
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include "horses.h"
#include<bits/stdc++.h>
using namespace std;
#define ll long long int
int init(int N, int X[], int Y[]) {
n=N;
for(ll i=0;i<N;i++){
x[i]=X[i];
y[i]=Y[i];
}
ll answer = 1,tmp=1,i=-1;
for(ll I=N-1;I>=0;I--){
if(tmp*X[I]>2000000000) {i=I;break;}
tmp *= X[I];
}
if(i==-1) i=0;
ll place = i;
ll Max=1,tmp2=1;
for(ll j=i;j<N;j++){
tmp2*=X[j];
tmp2*=Y[j];
if(tmp2>Max){
Max = tmp2;
place = j;
}
tmp2/=Y[j];
}
for(ll j=0;j<=place;j++){
answer*=X[j];
answer %= (1000000007);
}
answer*=Y[place];
answer %= 1000000007;
return answer;
}
int updateX(int pos, int val) {
x[pos]=val;
return init(n,x,y);
}
int updateY(int pos, int val) {
y[pos]=val;
return init(n,x,y);
}
