Submission #199706

#TimeUsernameProblemLanguageResultExecution timeMemory
199706FieryPhoenix말 (IOI15_horses)C++11
Compilation error
0 ms0 KiB
#include <iostream>
#include <vector>
#include <algorithm>
#include <cmath>
#include <cstdio>
#include <map>
#include <queue>
#include <set>
#include <iomanip>
#include <deque>
#include <cassert>
#include <ctime>
#include <cstring>
#include <cstdlib>
#include <chrono>
#include <ctime>
#include <random>
#include <stack>
#include <unordered_set>
#include <unordered_map>
#include <iterator>
#include <climits>
#include <horses.h>
using namespace std;

mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
typedef long long ll;
typedef long double ld;
#define INF 2001001001
#define MOD 1000000007

ll worth[1005],X[1005],Y[1005];
bool over[1005];

int calc(){
  for (int i=0;i<N;i++){
    worth[i]=0;
    over[i]=false;
  }
  for (int i=N-1;i>=0;i--){
    if (over[i+1])
      worth[i]=X[i]*worth[i+1];
    else
      worth[i]=X[i]*max(Y[i],worth[i+1]);
    over[i]=(worth[i]>1000000000) | over[i+1];
    if (over[i])
      worth[i]%=MOD;
  }
  return worth[0];
}

int init(int N, int x[], int y[]){
  for (int i=0;i<N;i++){
    X[i]=x[i];
    Y[i]=y[i];
  }

  return calc();
}

int updateX(int pos, int val){
  X[pos]=val;
  return calc();
}

int updateY(int pos, int val){
  Y[pos]=val;
  return calc();
}

Compilation message (stderr)

horses.cpp: In function 'int calc()':
horses.cpp:36:18: error: 'N' was not declared in this scope
   for (int i=0;i<N;i++){
                  ^
horses.cpp:40:14: error: 'N' was not declared in this scope
   for (int i=N-1;i>=0;i--){
              ^
horses.cpp:49:17: warning: conversion to 'int' from 'll {aka long long int}' may alter its value [-Wconversion]
   return worth[0];
          ~~~~~~~^