제출 #921633

#제출 시각아이디문제언어결과실행 시간메모리
921633coding_snorlax말 (IOI15_horses)C++14
컴파일 에러
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); }

컴파일 시 표준 에러 (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:28:19: warning: conversion from 'long long int' to 'int' may change value [-Wconversion]
   28 |     return answer % (1000000007);
      |            ~~~~~~~^~~~~~~~~~~~~~
horses.cpp: In function 'int updateX(int, int)':
horses.cpp:32:5: error: 'X' was not declared in this scope
   32 |     X[pos]=val;
      |     ^
horses.cpp:33:17: error: 'N' was not declared in this scope
   33 |     return init(N,X,Y);
      |                 ^
horses.cpp:33:21: error: 'Y' was not declared in this scope
   33 |     return init(N,X,Y);
      |                     ^
horses.cpp: In function 'int updateY(int, int)':
horses.cpp:37:5: error: 'Y' was not declared in this scope
   37 |     Y[pos]=val;
      |     ^
horses.cpp:38:17: error: 'N' was not declared in this scope
   38 |     return init(N,X,Y);
      |                 ^
horses.cpp:38:19: error: 'X' was not declared in this scope
   38 |     return init(N,X,Y);
      |                   ^