Submission #918761

#TimeUsernameProblemLanguageResultExecution timeMemory
918761AiperiiiHorses (IOI15_horses)C++14
17 / 100
1527 ms12756 KiB
#include <bits/stdc++.h> #include "horses.h" #define ll long long #define ff first #define ss second #define pb push_back #define all(x) x.begin(),x.end() using namespace std; const int N=1e5,mod=1e9+7; int X[N],Y[N]; vector <ll> x,y; int init(int N, int X[], int Y[]) { x.pb(0);y.pb(0); for(int i=0;i<N;i++){ x.pb(X[i]); y.pb(Y[i]); } ll d=1; ll mx=0; int n=x.size()-1; for(int i=1;i<=n;i++){ d*=x[i]; d%=mod; mx=max(mx,(d*y[i])%mod); } return mx%mod; } int updateX(int pos,int val){ pos++; x[pos]=val; ll d=1; ll mx=0; int n=x.size()-1; for(int i=1;i<=n;i++){ d*=x[i]; d%=mod; mx=max(mx,(d*y[i])%mod); } return mx%mod; } int updateY(int pos,int val){ pos++; y[pos]=val; ll d=1; ll mx=0; int n=y.size()-1; for(int i=1;i<=n;i++){ d*=x[i]; d%=mod; mx=max(mx,(d*y[i])%mod); } return mx%mod; }

Compilation message (stderr)

horses.cpp: In function 'int init(int, int*, int*)':
horses.cpp:12:30: warning: declaration of 'Y' shadows a global declaration [-Wshadow]
   12 | int init(int N, int X[], int Y[]) {
      |                          ~~~~^~~
horses.cpp:10:10: note: shadowed declaration is here
   10 | int X[N],Y[N];
      |          ^
horses.cpp:12:21: warning: declaration of 'X' shadows a global declaration [-Wshadow]
   12 | int init(int N, int X[], int Y[]) {
      |                 ~~~~^~~
horses.cpp:10:5: note: shadowed declaration is here
   10 | int X[N],Y[N];
      |     ^
horses.cpp:12:14: warning: declaration of 'N' shadows a global declaration [-Wshadow]
   12 | int init(int N, int X[], int Y[]) {
      |          ~~~~^
horses.cpp:9:11: note: shadowed declaration is here
    9 | const int N=1e5,mod=1e9+7;
      |           ^
horses.cpp:20:18: warning: conversion from 'std::vector<long long int>::size_type' {aka 'long unsigned int'} to 'int' may change value [-Wconversion]
   20 |    int n=x.size()-1;
      |          ~~~~~~~~^~
horses.cpp:26:13: warning: conversion from 'long long int' to 'int' may change value [-Wconversion]
   26 |    return mx%mod;
      |           ~~^~~~
horses.cpp: In function 'int updateX(int, int)':
horses.cpp:33:18: warning: conversion from 'std::vector<long long int>::size_type' {aka 'long unsigned int'} to 'int' may change value [-Wconversion]
   33 |    int n=x.size()-1;
      |          ~~~~~~~~^~
horses.cpp:39:13: warning: conversion from 'long long int' to 'int' may change value [-Wconversion]
   39 |    return mx%mod;
      |           ~~^~~~
horses.cpp: In function 'int updateY(int, int)':
horses.cpp:46:18: warning: conversion from 'std::vector<long long int>::size_type' {aka 'long unsigned int'} to 'int' may change value [-Wconversion]
   46 |    int n=y.size()-1;
      |          ~~~~~~~~^~
horses.cpp:52:13: warning: conversion from 'long long int' to 'int' may change value [-Wconversion]
   52 |    return mx%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...