Submission #447918

#TimeUsernameProblemLanguageResultExecution timeMemory
447918KarliverHorses (IOI15_horses)C++14
Compilation error
0 ms0 KiB
#include "horses.h" #include <bits/stdc++.h> #define FIXED_FLOAT(x) std::fixed <<std::setprecision(20) << (x) #define all(v) (v).begin(), (v).end() using namespace std; #define forn(i,n) for (int i = 0; i < (n); ++i) #define rforn(i, n) for(int i = (n) - 1;i >= 0;--i) using ll = long long; int mod = (ll)1e9 + 7; #define PI acos(-1) typedef pair<int, int> pairs; const int INF = 1e9 + 1; //const int N = 2e5 + 100; const double eps = 1e-7; template <class T> using V = vector<T>; template <class T> using VV = V<V<T>>; template <typename XPAX> void ckma(XPAX &x, XPAX y) { x = (x < y ? y : x); } template <typename XPAX> void ckmi(XPAX &x, XPAX y) { x = (x > y ? y : x); } int n; int A[10000], B[100000]; int init(int N, int X[], int Y[]) { ll ans = 0; ll tot = 1; n = N; forn(i, N) { tot *= X[i]; ckma(ans, tot * Y[i]); A[i] = X[i]; B[i] = Y[i]; } return ans; } int updateX(int pos, int val) { A[pos] = val; ll tot = 1; forn(i, n) { tot *= A[i]; ckma(ans, tot * B[i]); } return ans; } int updateY(int pos, int val) { B[pos] = val; ll tot = 1; forn(i, n) { tot *= A[i]; ckma(ans, tot * B[i]); } return ans; }

Compilation message (stderr)

horses.cpp: In function 'int init(int, int*, int*)':
horses.cpp:45:9: warning: conversion from 'll' {aka 'long long int'} to 'int' may change value [-Wconversion]
   45 |  return ans;
      |         ^~~
horses.cpp: In function 'int updateX(int, int)':
horses.cpp:54:8: error: 'ans' was not declared in this scope; did you mean 'abs'?
   54 |   ckma(ans, tot * B[i]);
      |        ^~~
      |        abs
horses.cpp:57:9: error: 'ans' was not declared in this scope; did you mean 'abs'?
   57 |  return ans;
      |         ^~~
      |         abs
horses.cpp: In function 'int updateY(int, int)':
horses.cpp:67:8: error: 'ans' was not declared in this scope; did you mean 'abs'?
   67 |   ckma(ans, tot * B[i]);
      |        ^~~
      |        abs
horses.cpp:70:9: error: 'ans' was not declared in this scope; did you mean 'abs'?
   70 |  return ans;
      |         ^~~
      |         abs