Submission #65641

#TimeUsernameProblemLanguageResultExecution timeMemory
65641mirbek01Horses (IOI15_horses)C++17
34 / 100
154 ms10220 KiB
#include "horses.h" # include <bits/stdc++.h> using namespace std; const int mod = 1e9 + 7; const int N = 1e5 + 2; int x[N], y[N], n; int init(int NN, int X[], int Y[]) { n = NN; for(int i = 0; i < n; i ++) x[i] = X[i], y[i] = Y[i]; double cur = log10(1), ans = 0; int res = 1, ot = 1; for(int i = 0; i < n; i ++){ cur += log10(x[i]); res = res * 1ll * x[i] % mod; if (cur + log10(y[i]) > ans) { ans = cur + log10(y[i]); ot = res * 1ll * y[i] % mod; } } return ot; } int updateX(int pos, int val) { x[pos] = val; double cur = log10(1), ans = 0; int res = 1, ot = 1; for(int i = 0; i < n; i ++){ cur += log10(x[i]); res = res * 1ll * x[i] % mod; if (cur + log10(y[i]) > ans) { ans = cur + log10(y[i]); ot = res * 1ll * y[i] % mod; } } return ot; } int updateY(int pos, int val) { y[pos] = val; double cur = log10(1), ans = 0; int res = 1, ot = 1; for(int i = 0; i < n; i ++){ cur += log10(x[i]); res = res * 1ll * x[i] % mod; if (cur + log10(y[i]) > ans) { ans = cur + log10(y[i]); ot = res * 1ll * y[i] % mod; } } return ot; }

Compilation message (stderr)

horses.cpp: In function 'int init(int, int*, int*)':
horses.cpp:24:36: warning: conversion to 'int' from 'long long int' may alter its value [-Wconversion]
             res = res * 1ll * x[i] % mod;
                   ~~~~~~~~~~~~~~~~~^~~~~
horses.cpp:29:41: warning: conversion to 'int' from 'long long int' may alter its value [-Wconversion]
                   ot = res * 1ll * y[i] % mod;
                        ~~~~~~~~~~~~~~~~~^~~~~
horses.cpp: In function 'int updateX(int, int)':
horses.cpp:44:36: warning: conversion to 'int' from 'long long int' may alter its value [-Wconversion]
             res = res * 1ll * x[i] % mod;
                   ~~~~~~~~~~~~~~~~~^~~~~
horses.cpp:49:41: warning: conversion to 'int' from 'long long int' may alter its value [-Wconversion]
                   ot = res * 1ll * y[i] % mod;
                        ~~~~~~~~~~~~~~~~~^~~~~
horses.cpp: In function 'int updateY(int, int)':
horses.cpp:63:36: warning: conversion to 'int' from 'long long int' may alter its value [-Wconversion]
             res = res * 1ll * x[i] % mod;
                   ~~~~~~~~~~~~~~~~~^~~~~
horses.cpp:68:41: warning: conversion to 'int' from 'long long int' may alter its value [-Wconversion]
                   ot = res * 1ll * y[i] % 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...