Submission #430205

# Submission time Handle Problem Language Result Execution time Memory
430205 2021-06-16T12:06:13 Z Abdulmohsen1284 Horses (IOI15_horses) C++14
0 / 100
51 ms 20736 KB
//#include "horses.h"
#include <bits/stdc++.h>
using namespace std;
long long ma=0,mod=1000000007;
long long x[1000005],y[1000005],n,all[500005];
int init(int N, int X[], int Y[]) {
    long long horse=1;
    n=N;

    for(int i=0;i<N;i++)
    {
        all[i+1]=X[i]*all[i];
        x[i]=X[i];
        y[i]=Y[i];
    }
    long long st=n-30,bef=0;
    if(st<0)
        st=0;
    for(int i=st;i<n;i++)
    {
        horse*=x[i];
        if(horse*y[i]>=bef)
        {
            bef=y[i];
            horse=1;
            ma=(horse*y[i])%mod;
        }
    }
	return ma;
}

int updateX(int pos, int val) {
    x[pos]=val;
    long long st=n-30,horse=1,bef=0;
    if(st<0)
        st=0;
    for(int i=st;i<n;i++)
    {
        horse*=x[i];
        if(horse*y[i]>=bef)
        {
            bef=y[i];
            horse=1;
            ma=(horse*y[i])%mod;
        }
    }
	return ma;
}

int updateY(int pos, int val) {
    y[pos]=val;
    long long horse=1;
    long long st=n-30,bef=0;
    if(st<0)
        st=0;
    for(int i=st;i<n;i++)
    {
        horse*=x[i];
        if(horse*y[i]>=bef)
        {
            bef=y[i];
            horse=1;
            ma=(horse*y[i])%mod;
        }
    }
	return ma;
}

Compilation message

horses.cpp: In function 'int init(int, int*, int*)':
horses.cpp:19:15: warning: conversion from 'long long int' to 'int' may change value [-Wconversion]
   19 |     for(int i=st;i<n;i++)
      |               ^~
horses.cpp:29:9: warning: conversion from 'long long int' to 'int' may change value [-Wconversion]
   29 |  return ma;
      |         ^~
horses.cpp: In function 'int updateX(int, int)':
horses.cpp:37:15: warning: conversion from 'long long int' to 'int' may change value [-Wconversion]
   37 |     for(int i=st;i<n;i++)
      |               ^~
horses.cpp:47:9: warning: conversion from 'long long int' to 'int' may change value [-Wconversion]
   47 |  return ma;
      |         ^~
horses.cpp: In function 'int updateY(int, int)':
horses.cpp:56:15: warning: conversion from 'long long int' to 'int' may change value [-Wconversion]
   56 |     for(int i=st;i<n;i++)
      |               ^~
horses.cpp:66:9: warning: conversion from 'long long int' to 'int' may change value [-Wconversion]
   66 |  return ma;
      |         ^~
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 204 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 204 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 51 ms 20736 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 336 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 204 KB Output isn't correct
2 Halted 0 ms 0 KB -