이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include <bits/stdc++.h>
using namespace std;
#include <ext/pb_ds/assoc_container.hpp>
using namespace __gnu_pbds;
#define ll long long
const int NMAX = (int)1e5 * 6;
const ll MOD = (int)1e9 + 7;
int A[NMAX],B[NMAX],n;
ll POW(ll x,int p) {
ll res = 1;
while (p) {
if (p % 2)
res = res * x % MOD;
p /= 2;
x = x * x % MOD;
}
return res;
}
int init(int N, int X[], int Y[]) {
for (int i = 0; i < N;++i) {
A[i] = X[i];
B[i] = Y[i];
}
n = N;
ll ans = X[0] * Y[0] % MOD;
ll x = X[0];
int ans_i = 0;
for (int i = min(1,N - 40); i < N;++i) {
x = x * X[i];
if (Y[ans_i] < x || x * Y[i] > Y[ans_i]) {
x = 1;
ans_i = i;
ans = x * Y[i] % MOD;
}
}
return ans;
}
int updateX(int pos, int val) {
A[pos] = val;
return init(n,A,B);
}
int updateY(int pos, int val) {
B[pos] = val;
return init(n,A,B);
}
컴파일 시 표준 에러 (stderr) 메시지
horses.cpp: In function 'int init(int, int*, int*)':
horses.cpp:38:9: warning: conversion from 'long long int' to 'int' may change value [-Wconversion]
38 | return ans;
| ^~~
# | 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... |