# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
764781 | SanguineChameleon | 말 (IOI15_horses) | C++17 | 1577 ms | 11960 KiB |
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include "horses.h"
#include <bits/stdc++.h>
using namespace std;
const int mod = 1e9 + 7;
int mul(int a, int b) {
if (a > mod / b) {
return mod;
}
else {
return a * b;
}
}
const int maxN = 5e5 + 20;
int X[maxN];
int Y[maxN];
int N;
int calc() {
int best = 1;
int gain = 1;
for (int i = 2; i <= N; i++) {
gain = mul(gain, X[i]);
if (mul(gain, Y[i]) > Y[best]) {
best = i;
gain = 1;
}
}
int res = 1;
for (int i = 1; i <= best; i++) {
res = 1LL * res * X[i] % mod;
}
res = 1LL * res * Y[best] % mod;
return res;
}
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];
}
return calc();
}
int updateX(int pos, int val) {
pos++;
X[pos] = val;
return calc();
}
int updateY(int pos, int val) {
pos++;
Y[pos] = val;
return calc();
}
컴파일 시 표준 에러 (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... |