Submission #503365

#TimeUsernameProblemLanguageResultExecution timeMemory
503365aymanrs말 (IOI15_horses)C++14
0 / 100
15 ms10484 KiB
#include <bits/stdc++.h> using namespace std; const int MOD = 1e9+7; int x[1000], y[1000], n; int init(int N, int X[], int Y[]){ n = N; pair<int, long double> m = {-1, -1}; long long c = 0, cx = 1; for(int i = 0;i < n;i++) { x[i] = X[i]; y[i] = Y[i]; c += log(x[i]); cx = cx * x[i] % MOD; if(c + log(y[i]) > m.second){ m.second = c + log(y[i]); m.first = (cx * y[i]) % MOD; } } return m.first; } int updateX(int pos, int val){ x[pos] = val; pair<int, long double> m = {-1, -1}; long long c = 0, cx = 1; for(int i = 0;i < n;i++) { c += log(x[i]); cx = cx * x[i] % MOD; if(c + log(y[i]) > m.second){ m.second = c + log(y[i]); m.first = (cx * y[i]) % MOD; } } return m.first; } int updateY(int pos, int val){ y[pos] = val; pair<int, long double> m = {-1, -1}; long long c = 0, cx = 1; for(int i = 0;i < n;i++) { c += log(x[i]); cx = cx * x[i] % MOD; if(c + log(y[i]) > m.second){ m.second = c + log(y[i]); m.first = (cx * y[i]) % MOD; } } return m.first; }

Compilation message (stderr)

horses.cpp: In function 'int init(int, int*, int*)':
horses.cpp:12:16: warning: conversion from 'long long int' to '__gnu_cxx::__enable_if<true, double>::__type' {aka 'double'} may change value [-Wconversion]
   12 |   c += log(x[i]);
      |                ^
horses.cpp:12:16: warning: conversion from '__gnu_cxx::__enable_if<true, double>::__type' {aka 'double'} to 'long long int' may change value [-Wfloat-conversion]
horses.cpp:14:6: warning: conversion from 'long long int' to '__gnu_cxx::__enable_if<true, double>::__type' {aka 'double'} may change value [-Wconversion]
   14 |   if(c + log(y[i]) > m.second){
      |      ^
horses.cpp:15:15: warning: conversion from 'long long int' to '__gnu_cxx::__enable_if<true, double>::__type' {aka 'double'} may change value [-Wconversion]
   15 |    m.second = c + log(y[i]);
      |               ^
horses.cpp:16:26: warning: conversion from 'long long int' to 'int' may change value [-Wconversion]
   16 |    m.first = (cx * y[i]) % MOD;
      |              ~~~~~~~~~~~~^~~~~
horses.cpp: In function 'int updateX(int, int)':
horses.cpp:26:16: warning: conversion from 'long long int' to '__gnu_cxx::__enable_if<true, double>::__type' {aka 'double'} may change value [-Wconversion]
   26 |   c += log(x[i]);
      |                ^
horses.cpp:26:16: warning: conversion from '__gnu_cxx::__enable_if<true, double>::__type' {aka 'double'} to 'long long int' may change value [-Wfloat-conversion]
horses.cpp:28:6: warning: conversion from 'long long int' to '__gnu_cxx::__enable_if<true, double>::__type' {aka 'double'} may change value [-Wconversion]
   28 |   if(c + log(y[i]) > m.second){
      |      ^
horses.cpp:29:15: warning: conversion from 'long long int' to '__gnu_cxx::__enable_if<true, double>::__type' {aka 'double'} may change value [-Wconversion]
   29 |    m.second = c + log(y[i]);
      |               ^
horses.cpp:30:26: warning: conversion from 'long long int' to 'int' may change value [-Wconversion]
   30 |    m.first = (cx * y[i]) % MOD;
      |              ~~~~~~~~~~~~^~~~~
horses.cpp: In function 'int updateY(int, int)':
horses.cpp:40:16: warning: conversion from 'long long int' to '__gnu_cxx::__enable_if<true, double>::__type' {aka 'double'} may change value [-Wconversion]
   40 |   c += log(x[i]);
      |                ^
horses.cpp:40:16: warning: conversion from '__gnu_cxx::__enable_if<true, double>::__type' {aka 'double'} to 'long long int' may change value [-Wfloat-conversion]
horses.cpp:42:6: warning: conversion from 'long long int' to '__gnu_cxx::__enable_if<true, double>::__type' {aka 'double'} may change value [-Wconversion]
   42 |   if(c + log(y[i]) > m.second){
      |      ^
horses.cpp:43:15: warning: conversion from 'long long int' to '__gnu_cxx::__enable_if<true, double>::__type' {aka 'double'} may change value [-Wconversion]
   43 |    m.second = c + log(y[i]);
      |               ^
horses.cpp:44:26: warning: conversion from 'long long int' to 'int' may change value [-Wconversion]
   44 |    m.first = (cx * 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...