This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
/*input
*/
#include <bits/stdc++.h>
#include "horses.h"
using namespace std;
typedef long long ll;
typedef long double ld;
typedef complex<ld> cd;
typedef pair<int, int> pi;
typedef pair<ll, ll> pl;
typedef pair<ld, ld> pd;
typedef vector<int> vi;
typedef vector<vi> vii;
typedef vector<ld> vd;
typedef vector<ll> vl;
typedef vector<vl> vll;
typedef vector<pi> vpi;
typedef vector<vpi> vpii;
typedef vector<pl> vpl;
typedef vector<cd> vcd;
typedef vector<pd> vpd;
typedef vector<bool> vb;
typedef vector<vb> vbb;
typedef std::string str;
typedef std::vector<str> vs;
#define x first
#define y second
#define debug(...) cout<<"["<<#__VA_ARGS__<<": "<<__VA_ARGS__<<"]\n"
const int MOD = 1000000007;
const ll INF = std::numeric_limits<ll>::max();
const int MX = 100101;
const ld PI = 3.14159265358979323846264338327950288419716939937510582097494L;
template<typename T>
pair<T, T> operator+(const pair<T, T> &a, const pair<T, T> &b) { return pair<T, T>(a.x + b.x, a.y + b.y); }
template<typename T>
pair<T, T> operator-(const pair<T, T> &a, const pair<T, T> &b) { return pair<T, T>(a.x - b.x, a.y - b.y); }
template<typename T>
T operator*(const pair<T, T> &a, const pair<T, T> &b) { return (a.x * b.x + a.y * b.y); }
template<typename T>
T operator^(const pair<T, T> &a, const pair<T, T> &b) { return (a.x * b.y - a.y * b.x); }
template<typename T>
void print(vector<T> vec, string name = "") {
cout << name;
for (auto u : vec)
cout << u << ' ';
cout << '\n';
}
int init(int N, int X[], int Y[]) {
ll ats = 0;
// ll curr = 1;
ll lasty = 0;
__int128 curr = 1;
ll visu = 1;
for (int i = 0; i < N; ++i)
{
curr = curr * X[i];
if (curr >= (__int128)lasty or curr * Y[i] >= (__int128)lasty) {
curr %= MOD;
visu = (visu * curr) % MOD;
lasty = Y[i];
curr = 1;
}
// ats = max(ats, curr * Y[i]);
}
ats = (visu * lasty) % MOD;
// ats %= MOD;
// printf("ats = %d\n", ats);
return (int)ats;
}
int updateX(int pos, int val) {
return 0;
}
int updateY(int pos, int val) {
return 0;
}
Compilation message (stderr)
horses.cpp: In function 'int init(int, int*, int*)':
horses.cpp:70:25: warning: conversion to 'll {aka long long int}' from '__int128' may alter its value [-Wconversion]
visu = (visu * curr) % MOD;
~~~~~~~~~~~~~~^~~~~
horses.cpp: In function 'int updateX(int, int)':
horses.cpp:83:17: warning: unused parameter 'pos' [-Wunused-parameter]
int updateX(int pos, int val) {
^~~
horses.cpp:83:26: warning: unused parameter 'val' [-Wunused-parameter]
int updateX(int pos, int val) {
^~~
horses.cpp: In function 'int updateY(int, int)':
horses.cpp:87:17: warning: unused parameter 'pos' [-Wunused-parameter]
int updateY(int pos, int val) {
^~~
horses.cpp:87:26: warning: unused parameter 'val' [-Wunused-parameter]
int updateY(int pos, int val) {
^~~
# | 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... |