이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include "horses.h"
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
#define debug(x) {cerr<<#x<<"="<<x<<"\n";}
#define debugp(p) {cerr<<#p<<"={"<<p.first<<", "<<p.second<<"}\n";}
#define debug2(x, y) {cerr<<#x<<", "<<#y<<" = "<<x<<", "<<y<<"\n";}
#define pb push_back
#define all(x) x.begin(), x.end()
const int mod=1000000007;
const int MAXN=500010, LOG=20;
int n, m, k;
ll X[MAXN], Y[MAXN], zarbx=1;
ll powmod(ll a, ll b){
ll res=1;
for (; b; b>>=1, a=a*a%mod) if (b&1) res=res*a%mod;
return res;
}
int Solve(){
ll ansx=1, ansy=0, xx=1;
for (int i=n-1; ~i; i--){
if (xx*ansy<ansx*Y[i]){
ansx=xx;
ansy=Y[i];
}
xx*=X[i];
if (xx>=1000000000) break ;
}
return zarbx*powmod(ansx, mod-2)%mod*ansy%mod;
}
int init(int _n, int _X[], int _Y[]) {
n=_n;
for (int i=0; i<n; i++){
X[i]=_X[i];
Y[i]=_Y[i];
zarbx=zarbx*X[i]%mod;
}
return Solve();
}
int updateX(int pos, int val) {
zarbx=zarbx*powmod(X[pos], mod-2)%mod;
X[pos]=val;
zarbx=zarbx*X[pos]%mod;
return Solve();
}
int updateY(int pos, int val) {
Y[pos]=val;
return Solve();
}
컴파일 시 표준 에러 (stderr) 메시지
horses.cpp: In function 'int Solve()':
horses.cpp:35:43: warning: conversion from 'll' {aka 'long long int'} to 'int' may change value [-Wconversion]
35 | return zarbx*powmod(ansx, mod-2)%mod*ansy%mod;
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~
# | 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... |