이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#ifdef LOCAL
#else
#include "horses.h"
#endif
#include <bits/stdc++.h>
#define fi first
#define se second
#define ssize(x) int(x.size())
#define pn printf("\n")
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef double db;
int inf = 2e09; ll infll = 2e18; ll mod = 1e09+7;
int updateX(int i, int val){ return 0; }
int updateY(int i, int val){ return 0; }
int init(int n, int x[], int y[]){
vector<ll> X(n), Y(n);
for(int i = 0; i < n; ++i) X[i] = x[i], Y[i] = y[i];
int opt = 0; ll mul = 1; bool overflow = 0; db tmp;
for(int i = 1; i < n; ++i){
mul *= X[i];
if(mul >= mod) overflow = 1, mul %= mod;
if(overflow) opt = i, mul = 1, overflow = 0;
else{
tmp = db(Y[opt])/db(Y[i]);
if(db(mul) >= tmp) opt = i, mul = 1, overflow = 0;
}
}
ll result = Y[opt];
for(int i = 0; i <= opt; ++i) result = result * X[i] % mod;
return int(result);
}
#ifdef LOCAL
int main(){
int T = 1;
for(++T; --T; ){
int n = 3, x[3] = {2, 1, 3}, y[3] = {3, 2, 1};
printf("%d\n", init(n, x, y));
}
return 0;
}
#endif
컴파일 시 표준 에러 (stderr) 메시지
horses.cpp: In function 'int updateX(int, int)':
horses.cpp:16:17: warning: unused parameter 'i' [-Wunused-parameter]
16 | int updateX(int i, int val){ return 0; }
| ~~~~^
horses.cpp:16:24: warning: unused parameter 'val' [-Wunused-parameter]
16 | int updateX(int i, int val){ return 0; }
| ~~~~^~~
horses.cpp: In function 'int updateY(int, int)':
horses.cpp:17:17: warning: unused parameter 'i' [-Wunused-parameter]
17 | int updateY(int i, int val){ return 0; }
| ~~~~^
horses.cpp:17:24: warning: unused parameter 'val' [-Wunused-parameter]
17 | int updateY(int i, int val){ return 0; }
| ~~~~^~~
# | 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... |