이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define ull unsigned long long
#define pb(e) push_back(e)
#define sv(a) sort(a.begin(),a.end())
#define sa(a,n) sort(a,a+n)
#define mp(a,b) make_pair(a,b)
#define vf first
#define vs second
#define ar array
#define all(x) x.begin(),x.end()
const int inf = 0x3f3f3f3f;
const int mod = 1000000007;
const double PI=3.14159265358979323846264338327950288419716939937510582097494459230;
bool remender(ll a , ll b){return a%b;}
//freopen("problemname.in", "r", stdin);
//freopen("problemname.out", "w", stdout);
#include "horses.h"
vector<ll> a , b;
ll cal(){
ll ans = 0;
ll sum = 0;
for(int i = 0; i < (int)a.size(); i++){
sum *= a[i];
sum %= mod;
ans = max(ans , (sum * b[i]) % mod);
}
return ans;
}
int init(int n, int x[], int y[]) {
a.resize(n);
b.resize(n);
for(int i = 0; i < n; i++)a[i] = x[i] , b[i] = y[i];
return cal();
}
int updateX(int pos, int val) {
a[pos] = val;
return cal();
}
int updateY(int pos, int val) {
b[pos] = val;
return cal();
}
컴파일 시 표준 에러 (stderr) 메시지
horses.cpp: In function 'int init(int, int*, int*)':
horses.cpp:40:12: warning: conversion from 'long long int' to 'int' may change value [-Wconversion]
40 | return cal();
| ~~~^~
horses.cpp: In function 'int updateX(int, int)':
horses.cpp:45:12: warning: conversion from 'long long int' to 'int' may change value [-Wconversion]
45 | return cal();
| ~~~^~
horses.cpp: In function 'int updateY(int, int)':
horses.cpp:50:12: warning: conversion from 'long long int' to 'int' may change value [-Wconversion]
50 | return cal();
| ~~~^~
# | 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... |