이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include "horses.h"
#include<bits/stdc++.h>
using namespace std;
typedef unsigned long long ll;
typedef vector<ll> vl;
typedef long double ld;
//#include "grader.cpp"
vl x,y;
void chkmax(ll& ans,ll has,ll p){
ll mod=1e9+7;
if(log10(ld(ans))<log10(ld(has))+log10(ld(p)))
ans=((has%mod)*(p%mod))%mod;
}
int init(int n, int X[], int Y[]) {
x.resize(n);
y.resize(n);
const ll mod=1e9+7;
ll has=1,ans=0;
for(int i=0; i<n; i++)
x[i]=ll(1ll*X[i]),y[i]=ll(1ll*Y[i]);
for(int i=0; i<n; i++){
has*=x[i];
chkmax(ans,has,y[i]);
}
return int(ans);
}
int updateX(int pos, int val) {
const ll mod=1e9+7;
ll has=1,ans=0;
x[pos]=ll(val);
int n=x.size();
for(int i=0; i<n; i++){
has*=x[i];
chkmax(ans,has,y[i]);
}
return int(ans);
}
int updateY(int pos, int val) {
const ll mod=1e9+7;
ll has=1,ans=0;
y[pos]=ll(val);
int n=x.size();
for(int i=0; i<n; i++){
has*=x[i];
chkmax(ans,has,y[i]);
}
return int(ans);
}
컴파일 시 표준 에러 (stderr) 메시지
horses.cpp: In function 'int init(int, int*, int*)':
horses.cpp:21:14: warning: unused variable 'mod' [-Wunused-variable]
21 | const ll mod=1e9+7;
| ^~~
horses.cpp: In function 'int updateX(int, int)':
horses.cpp:37:17: warning: conversion from 'std::vector<long long unsigned int>::size_type' {aka 'long unsigned int'} to 'int' may change value [-Wconversion]
37 | int n=x.size();
| ~~~~~~^~
horses.cpp:34:14: warning: unused variable 'mod' [-Wunused-variable]
34 | const ll mod=1e9+7;
| ^~~
horses.cpp: In function 'int updateY(int, int)':
horses.cpp:49:17: warning: conversion from 'std::vector<long long unsigned int>::size_type' {aka 'long unsigned int'} to 'int' may change value [-Wconversion]
49 | int n=x.size();
| ~~~~~~^~
horses.cpp:46:14: warning: unused variable 'mod' [-Wunused-variable]
46 | const ll mod=1e9+7;
| ^~~
# | 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... |