Submission #234244

#TimeUsernameProblemLanguageResultExecution timeMemory
234244dannber_BRHorses (IOI15_horses)C++17
0 / 100
1596 ms8320 KiB
#include "horses.h" #include <bits/stdc++.h> using namespace std; const short HORSE = 0; const short CASH = 1; const long long MODUL = pow(10,9) + 7; int actual_X[999999]; int actual_Y[999999]; int actual_N = 0; long update(int horses,int X[],int Y[],int pos,int N) { int maxY = 0; for(int i = 0;i < N;i++) { if(maxY < Y[i] && i == pos) { maxY = Y[i]; } } if (maxY != Y[pos]) { return 0; } else { long long answ = ((horses - 1)* maxY) % MODUL; return answ; } } int init(int N, int X[], int Y[]) { long long horses_cash[2] = {1,0}; for(int i = 0;i < N;i++) { actual_X[i] = X[i]; actual_Y[i] = Y[i]; } actual_N = N; for(int i = 0;i < N;i++) { horses_cash[HORSE] *= X[i]; if(horses_cash[HORSE] > 1) { long long mmry = horses_cash[CASH]; horses_cash[CASH] += update(horses_cash[HORSE],X,Y,i,N); if(horses_cash[CASH] != mmry) { horses_cash[HORSE]; } } } return horses_cash[CASH]; } int updateX(int pos, int val) { actual_X[pos] = val; long long horses_cash[2] = {1,0}; for(int i = 0;i < actual_N;i++) { horses_cash[HORSE] *= actual_X[i]; if(horses_cash[HORSE] > 1) { long long mmry = horses_cash[CASH]; horses_cash[CASH] += update(horses_cash[HORSE],actual_X,actual_Y,i,actual_N); if(horses_cash[CASH] != mmry) { horses_cash[HORSE]; } } } return horses_cash[CASH]; } int updateY(int pos, int val) { actual_Y[pos] = val; long long horses_cash[2] = {1,0}; for(int i = 0;i < actual_N;i++) { horses_cash[HORSE] *= actual_X[i]; if(horses_cash[HORSE] > 1) { long long mmry = horses_cash[CASH]; horses_cash[CASH] += update(horses_cash[HORSE],actual_X,actual_Y,i,actual_N); if(horses_cash[CASH] != mmry) { horses_cash[HORSE]; } } } return horses_cash[CASH]; }

Compilation message (stderr)

horses.cpp: In function 'long int update(int, int*, int*, int, int)':
horses.cpp:14:30: warning: unused parameter 'X' [-Wunused-parameter]
 long update(int horses,int X[],int Y[],int pos,int N)
                              ^
horses.cpp: In function 'int init(int, int*, int*)':
horses.cpp:52:49: warning: conversion to 'int' from 'long long int' may alter its value [-Wconversion]
    horses_cash[CASH] += update(horses_cash[HORSE],X,Y,i,N);
                                ~~~~~~~~~~~~~~~~~^
horses.cpp:55:22: warning: statement has no effect [-Wunused-value]
     horses_cash[HORSE];
     ~~~~~~~~~~~~~~~~~^
horses.cpp:59:25: warning: conversion to 'int' from 'long long int' may alter its value [-Wconversion]
  return horses_cash[CASH];
         ~~~~~~~~~~~~~~~~^
horses.cpp: In function 'int updateX(int, int)':
horses.cpp:73:49: warning: conversion to 'int' from 'long long int' may alter its value [-Wconversion]
    horses_cash[CASH] += update(horses_cash[HORSE],actual_X,actual_Y,i,actual_N);
                                ~~~~~~~~~~~~~~~~~^
horses.cpp:76:22: warning: statement has no effect [-Wunused-value]
     horses_cash[HORSE];
     ~~~~~~~~~~~~~~~~~^
horses.cpp:80:25: warning: conversion to 'int' from 'long long int' may alter its value [-Wconversion]
  return horses_cash[CASH];
         ~~~~~~~~~~~~~~~~^
horses.cpp: In function 'int updateY(int, int)':
horses.cpp:94:49: warning: conversion to 'int' from 'long long int' may alter its value [-Wconversion]
    horses_cash[CASH] += update(horses_cash[HORSE],actual_X,actual_Y,i,actual_N);
                                ~~~~~~~~~~~~~~~~~^
horses.cpp:97:22: warning: statement has no effect [-Wunused-value]
     horses_cash[HORSE];
     ~~~~~~~~~~~~~~~~~^
horses.cpp:101:25: warning: conversion to 'int' from 'long long int' may alter its value [-Wconversion]
  return horses_cash[CASH];
         ~~~~~~~~~~~~~~~~^
#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...