#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();
}
Compilation message
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();
| ~~~^~
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
1 ms |
212 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
1 ms |
212 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
30 ms |
16048 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
0 ms |
212 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
1 ms |
212 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |