Submission #921630

#TimeUsernameProblemLanguageResultExecution timeMemory
921630coding_snorlax말 (IOI15_horses)C++14
Compilation error
0 ms0 KiB
//#include "horses.h" #include<bits/stdc++.h> using namespace std; #define ll long long int int init(int N, int X[], int Y[]) { ll answer = 1,tmp=1,i=-1; for(int I=N-1;I>=0;I--){ if(tmp*X[i]>1000000000) {i=I;break;} tmp *= X[i]; } if(i==-1) i=0; int place = i; ll Max=1,tmp2=1; for(int j=i;j<N;j++){ tmp2*=X[j]; tmp2*=Y[j]; if(tmp2>Max){ Max = tmp2; place = j; } tmp2/=Y[j]; for(int j=0;j<=place;j++){ answer*=X[j]; answer %= (1000000007); } answer*=Y[place]; return answer % (1000000007); } int updateX(int pos, int val) { X[pos]=val; return init(N,X,Y); } int updateY(int pos, int val) { Y[pos]=val; return init(N,X,Y); }

Compilation message (stderr)

horses.cpp: In function 'int init(int, int*, int*)':
horses.cpp:12:17: warning: conversion from 'long long int' to 'int' may change value [-Wconversion]
   12 |     int place = i;
      |                 ^
horses.cpp:14:15: warning: conversion from 'long long int' to 'int' may change value [-Wconversion]
   14 |     for(int j=i;j<N;j++){
      |               ^
horses.cpp:22:13: warning: declaration of 'j' shadows a previous local [-Wshadow]
   22 |     for(int j=0;j<=place;j++){
      |             ^
horses.cpp:14:13: note: shadowed declaration is here
   14 |     for(int j=i;j<N;j++){
      |             ^
horses.cpp:27:19: warning: conversion from 'long long int' to 'int' may change value [-Wconversion]
   27 |     return answer % (1000000007);
      |            ~~~~~~~^~~~~~~~~~~~~~
horses.cpp:30:31: error: a function-definition is not allowed here before '{' token
   30 | int updateX(int pos, int val) {
      |                               ^
horses.cpp:35:31: error: a function-definition is not allowed here before '{' token
   35 | int updateY(int pos, int val) {
      |                               ^
horses.cpp:38:1: error: expected '}' at end of input
   38 | }
      | ^
horses.cpp:5:35: note: to match this '{'
    5 | int init(int N, int X[], int Y[]) {
      |                                   ^
horses.cpp:38:1: warning: control reaches end of non-void function [-Wreturn-type]
   38 | }
      | ^