제출 #1011337

#제출 시각아이디문제언어결과실행 시간메모리
1011337nisanduu말 (IOI15_horses)C++14
컴파일 에러
0 ms0 KiB
/****************************************************************************** Online C++ Compiler. Code, Compile, Run and Debug C++ program online. Write your code in this editor and press "Run" button to compile and execute it. *******************************************************************************/ #include <bits/stdc++.h> using namespace std; typedef long long ll; const int N = 1e4; int a[N],b[N]; ll mod = 1e9 + 7; int init(int n,int* X,int* Y){ for(int i=0;i<n;i++) { a[i]=X[i]; b[i]=Y[i]; } // a=X; // b=Y; // N=n; ll ans = 0; ll cr = 1; for(int i=0;i<n;i++){ cr = (cr*1LL*a[i])%mod; ans = max(ans,(cr*b[i]*1LL)%mod); } return (int)ans; } int updateX(int pos,int val){ a[pos]=val; ll ans = 0; ll cr = 1; for(int i=0;i<n;i++){ cr = (cr*1LL*a[i])%mod; ans = max(ans,(cr*b[i]*1LL)%mod); } return (int)ans; } int updateY(int pos,int val){ b[pos]=val; ll ans = 0; ll cr = 1; for(int i=0;i<n;i++){ cr = (cr*1LL*a[i])%mod; ans = max(ans,(cr*b[i]*1LL)%mod); } return (int)ans; }

컴파일 시 표준 에러 (stderr) 메시지

horses.cpp: In function 'int updateX(int, int)':
horses.cpp:35:19: error: 'n' was not declared in this scope
   35 |     for(int i=0;i<n;i++){
      |                   ^
horses.cpp: In function 'int updateY(int, int)':
horses.cpp:45:19: error: 'n' was not declared in this scope
   45 |     for(int i=0;i<n;i++){
      |                   ^