Submission #203573

#TimeUsernameProblemLanguageResultExecution timeMemory
203573mohammadHorses (IOI15_horses)C++14
17 / 100
1592 ms12024 KiB
/* ░░░░██████████████████ ░░▄███████▀▀▀▀▀▀███████▄ ░▐████▀▒mohammad▒▀██████▄ ░███▀▒▒▒▒alaa▒▒▒▒▒▒▀█████ ░▐██▒▒▒alwrawrah▒▒▒▒▒████▌ ░▐█▌▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒████▌ ░░█▒▄▀▀▀▀▀▄▒▒▄▀▀▀▀▀▄▒▐███▌ ░░░▐░░░▄▄░░▌▐░░░▄▄░░▌▐███▌ ░▄▀▌░░░▀▀░░▌▐░░░▀▀░░▌▒▀▒█▌ ░▌▒▀▄░░░░▄▀▒▒▀▄░░░▄▀▒▒▄▀▒▌ ░▀▄▐▒▀▀▀▀▒▒▒▒▒▒▀▀▀▒▒▒▒▒▒█ ░░░▀▌▒▄██▄▄▄▄████▄▒▒▒▒█▀ ░░░░▄██████████████▒▒▐▌ ░░░▀███▀▀████▀█████▀▒▌ ░░░░░▌▒▒▒▄▒▒▒▄▒▒▒▒▒▒▐ ░░░░░▌▒▒▒▒▀▀▀▒▒▒▒▒▒▒▐ */ #include<bits/stdc++.h> #include "horses.h" using namespace std; typedef long long ll ; const ll oo = 1e13 ; const double PI = acos(-1) ; const ll M = 1e9 + 7 ; ll x[500010] , y[500010] , n , pl = 0 , ans = 1; int init(int N, int X[], int Y[]){ n = N; for(int i = 0 ; i < N ; ++i) x[i] = X[i] , y[i] = Y[i]; ll x1 = 1 ; for(int i = 1 ; i < N ; ++i){ x1 *= x[i]; if(y[pl] < x1 * y[i]) x1 = 1 ,pl = i ; } for(int i = 0 ; i <= pl ; ++i) ans = (ans * x[i]) % M; return (ans * y[pl]) % M; } int updateX(int pos, int val){ int pr = x[pos]; x[pos] = val; if(pos <= pl){ return ((ans / pr) * val) % M; }else{ ll x1 = 1 ; for(int i = pl + 1 ; i < n ; ++i){ x1 *= x[i]; if(y[pl] < x1 * y[i]) x1 = 1 ,pl = i ; } for(int i = 0 ; i <= pl ; ++i) ans = (ans * x[i]) % M; return (ans * y[pl]) % M; } } int updateY(int pos, int val){ y[pos] = val; ll x1 = 1 ; for(int i = 1 ; i < n; ++i){ x1 *= x[i]; if(y[pl] < x1 * y[i]) x1 = 1 ,pl = i ; } for(int i = 0 ; i <= pl ; ++i) ans = (ans * x[i]) % M; return (ans * y[pl]) % M; }

Compilation message (stderr)

horses.cpp: In function 'int init(int, int*, int*)':
horses.cpp:42:23: warning: conversion to 'int' from 'll {aka long long int}' may alter its value [-Wconversion]
  return (ans * y[pl]) % M;
         ~~~~~~~~~~~~~~^~~
horses.cpp: In function 'int updateX(int, int)':
horses.cpp:46:16: warning: conversion to 'int' from 'll {aka long long int}' may alter its value [-Wconversion]
  int pr = x[pos];
           ~~~~~^
horses.cpp:49:29: warning: conversion to 'int' from 'll {aka long long int}' may alter its value [-Wconversion]
   return ((ans / pr) * val) % M;  
          ~~~~~~~~~~~~~~~~~~~^~~
horses.cpp:52:18: warning: conversion to 'int' from 'll {aka long long int}' may alter its value [-Wconversion]
   for(int i = pl + 1 ; i < n ; ++i){
               ~~~^~~
horses.cpp:58:24: warning: conversion to 'int' from 'll {aka long long int}' may alter its value [-Wconversion]
   return (ans * y[pl]) % M;
          ~~~~~~~~~~~~~~^~~
horses.cpp: In function 'int updateY(int, int)':
horses.cpp:71:23: warning: conversion to 'int' from 'll {aka long long int}' may alter its value [-Wconversion]
  return (ans * y[pl]) % M;
         ~~~~~~~~~~~~~~^~~
#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...