# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
921633 | 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[]) {
ll answer = 1,tmp=1,i=-1;
for(int I=N-1;I>=0;I--){
if(tmp*X[i]>1000000000) {i=I;break;}
tmp *= X[i];
}
if(i==-1) i=0;
int place = i;
ll Max=1,tmp2=1;
for(int j=i;j<N;j++){
tmp2*=X[j];
tmp2*=Y[j];
if(tmp2>Max){
Max = tmp2;
place = j;
}
tmp2/=Y[j];
}
for(int j=0;j<=place;j++){
answer*=X[j];
answer %= (1000000007);
}
answer*=Y[place];
return answer % (1000000007);
}
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);
}