Submission #620642

#TimeUsernameProblemLanguageResultExecution timeMemory
620642mdn2002Horses (IOI15_horses)C++14
34 / 100
22 ms12188 KiB
#include "horses.h" #include<bits/stdc++.h> using namespace std; long long n , m , mod = 1e9 + 7 , x [1003] , y [1003]; long long get ( ) { long long bst = 0 , mul = 1; for ( int i = 1 ; i < n ; i ++ ) { mul *= x [i]; if ( mul > y [bst] ) { mul = 1; bst = i; continue; } long long almul = mul * y [i]; if ( almul > y [bst] ) { mul = 1; bst = i; } } long long ans = 1; for ( int i = 0 ; i <= bst ; i ++ ) ans = ( ans * x [i] ) % mod; ans = ( ans * y [bst] ) % mod; return ans; } int init(int N, int X[], int Y[]) { n = N; for ( int i = 0 ; i < n ; i ++ ) x [i] = X [i]; for ( int i = 0 ; i < n ; i ++ ) y [i] = Y [i]; return get (); } int updateX(int pos, int val) { x [pos] = val; return get (); } int updateY(int pos, int val) { y [pos] = val; return get (); }

Compilation message (stderr)

horses.cpp: In function 'int init(int, int*, int*)':
horses.cpp:36:16: warning: conversion from 'long long int' to 'int' may change value [-Wconversion]
   36 |     return get ();
      |            ~~~~^~
horses.cpp: In function 'int updateX(int, int)':
horses.cpp:42:13: warning: conversion from 'long long int' to 'int' may change value [-Wconversion]
   42 |  return get ();
      |         ~~~~^~
horses.cpp: In function 'int updateY(int, int)':
horses.cpp:47:13: warning: conversion from 'long long int' to 'int' may change value [-Wconversion]
   47 |  return get ();
      |         ~~~~^~
#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...