Submission #437983

#TimeUsernameProblemLanguageResultExecution timeMemory
437983illyakrHorses (IOI15_horses)C++14
17 / 100
1577 ms12040 KiB
#include <bits/stdc++.h>
#include "horses.h"
using namespace std;
#define ll long long
const ll mod = 1000000007;
const ll ge = 1000000000;

ll n;
ll x[501010], y[501010];
int init(int N, int X[], int Y[]) {
	n = N;
	for (ll i = 0; i < n; i++) {
        x[i] = X[i];
        y[i] = Y[i];
	}
	ll ans = 0, cnt = 1;
	for (ll i = 0; i < n; i++) {
        cnt *= x[i]; cnt %= ge;
        ans = max(ans, y[i] * cnt);
        ans %= mod;
	}
	return ans % mod;
}

int updateX(int pos, int val) {
    x[pos] = val % mod;
	ll ans = 0, cnt = 1;
	for (ll i = 0; i < n; i++) {
        cnt *= x[i]; cnt %= ge;
        ans = max(ans, y[i] * cnt);
        ans %= mod;
	}
	return ans % mod;
}

int updateY(int pos, int val) {
    y[pos] = val % mod;
	ll ans = 0, cnt = 1;
	for (ll i = 0; i < n; i++) {
        cnt *= x[i]; cnt %= ge;
        ans = max(ans, y[i] * cnt);
        ans %= mod;
	}
	return ans % mod;
}

Compilation message (stderr)

horses.cpp: In function 'int init(int, int*, int*)':
horses.cpp:22:13: warning: conversion from 'long long int' to 'int' may change value [-Wconversion]
   22 |  return ans % mod;
      |         ~~~~^~~~~
horses.cpp: In function 'int updateX(int, int)':
horses.cpp:33:13: warning: conversion from 'long long int' to 'int' may change value [-Wconversion]
   33 |  return ans % mod;
      |         ~~~~^~~~~
horses.cpp: In function 'int updateY(int, int)':
horses.cpp:44:13: warning: conversion from 'long long int' to 'int' may change value [-Wconversion]
   44 |  return ans % mod;
      |         ~~~~^~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...