제출 #672323

#제출 시각아이디문제언어결과실행 시간메모리
672323Trisanu_Das말 (IOI15_horses)C++17
컴파일 에러
0 ms0 KiB
#include <bits/stdc++.h> using namespace std; #define MOD 1000000007 #define ll long long int n; int* x, y; int solve(){ ll pref = 1, hrspr = 1, last = 0, ans = 0; for(int i = 0; i < n; i++){ hrspr *= x[i]; pref = pref * x[i] % MOD; if((long double)y[i] * hrspr > last){ ans = pref * y[i] % MOD; hrspr = 1; last = y[i]; } } return ans; } int init(int N, int X[], int Y[]){ n = N; x = X; y = Y; return solve(); } int updateX(int pos, int val){ x[pos] = val; solve(); } int updateY(int pos, int val){ y[pos] = val; solve(); }

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

horses.cpp: In function 'int solve()':
horses.cpp:14:22: error: invalid types 'int[int]' for array subscript
   14 |     if((long double)y[i] * hrspr > last){
      |                      ^
horses.cpp:15:21: error: invalid types 'int[int]' for array subscript
   15 |       ans = pref * y[i] % MOD; hrspr = 1; last = y[i];
      |                     ^
horses.cpp:15:51: error: invalid types 'int[int]' for array subscript
   15 |       ans = pref * y[i] % MOD; hrspr = 1; last = y[i];
      |                                                   ^
horses.cpp:18:10: warning: conversion from 'long long int' to 'int' may change value [-Wconversion]
   18 |   return ans;
      |          ^~~
horses.cpp: In function 'int init(int, int*, int*)':
horses.cpp:22:21: error: invalid conversion from 'int*' to 'int' [-fpermissive]
   22 |   n = N; x = X; y = Y; return solve();
      |                     ^
      |                     |
      |                     int*
horses.cpp: In function 'int updateX(int, int)':
horses.cpp:27:1: warning: no return statement in function returning non-void [-Wreturn-type]
   27 | }
      | ^
horses.cpp: In function 'int updateY(int, int)':
horses.cpp:29:4: error: invalid types 'int[int]' for array subscript
   29 |   y[pos] = val; solve();
      |    ^
horses.cpp:30:1: warning: no return statement in function returning non-void [-Wreturn-type]
   30 | }
      | ^