제출 #203601

#제출 시각아이디문제언어결과실행 시간메모리
203601mohammad말 (IOI15_horses)C++14
컴파일 에러
0 ms0 KiB
/* ░░░░██████████████████ ░░▄███████▀▀▀▀▀▀███████▄ ░▐████▀▒mohammad▒▀██████▄ ░███▀▒▒▒▒alaa▒▒▒▒▒▒▀█████ ░▐██▒▒▒alwrawrah▒▒▒▒▒████▌ ░▐█▌▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒████▌ ░░█▒▄▀▀▀▀▀▄▒▒▄▀▀▀▀▀▄▒▐███▌ ░░░▐░░░▄▄░░▌▐░░░▄▄░░▌▐███▌ ░▄▀▌░░░▀▀░░▌▐░░░▀▀░░▌▒▀▒█▌ ░▌▒▀▄░░░░▄▀▒▒▀▄░░░▄▀▒▒▄▀▒▌ ░▀▄▐▒▀▀▀▀▒▒▒▒▒▒▀▀▀▒▒▒▒▒▒█ ░░░▀▌▒▄██▄▄▄▄████▄▒▒▒▒█▀ ░░░░▄██████████████▒▒▐▌ ░░░▀███▀▀████▀█████▀▒▌ ░░░░░▌▒▒▒▄▒▒▒▄▒▒▒▒▒▒▐ ░░░░░▌▒▒▒▒▀▀▀▒▒▒▒▒▒▒▐ */ #include<bits/stdc++.h> #include "horses.h" using namespace std; typedef long long ll ; const ll oo = 1e13 ; const double PI = acos(-1) ; const ll M = 1e9 + 7 ; ll x[500010] , y[500010] , n; ll f = 1 , mp[33] ; ll fastpower( ll x , ll n ){ ll res = 1 ; while(n > 0){ if(n % 2 == 1) res = (res * x) % M; x = ( x * x ) % M; n = n / 2 ; } return res; } int init(int N, int X[], int Y[]){ n = N; for(int i = 0 ; i < N ; ++i)x[i] = X[i] , y[i] = Y[i] , f = (x[i] * f) % M; ll x1 = 1 , pl = 0 , ans = 1; for(int i = max(0ll,n - 31) ; i < N ; ++i){ x1 *= x[i]; if(y[pl] < x1 * y[i]) x1 = 1 ,pl = i ; if(i != max(0ll , n - 31)) mp[i] = (mp[i - 1] * x[i]) % M; else mp[i] = x[i]; } ans = (f * fastpower(((mp[N - 1] * fastpower(mp[pl] , M - 2)) % M) , M - 2)) % M; return (ans * y[pl]) % M; } int updateX(int pos, int val){ ll pr = x[pos]; f = (f * fastpower(pr , M - 2)) % M; f = (f * val) % M; x[pos] = val; ll x1 = 1 , pl = 0 , ans = 1; for(int i = max(0ll,n - 31) ; i < n ; ++i){ x1 *= x[i]; if(y[pl] < x1 * y[i]) x1 = 1 ,pl = i ; if(i != max(0ll , n - 31)) mp[i] = (mp[i - 1] * x[i]) % M; else mp[i] = x[i]; } ans = (f * fastpower(((mp[N - 1] * fastpower(mp[pl] , M - 2)) % M) , M - 2)) % M; return (ans * y[pl]) % M; } int updateY(int pos, int val){ y[pos] = val; ll x1 = 1 , pl = 0 , ans = 1; for(int i = max(0ll,n - 31) ; i < n; ++i){ x1 *= x[i]; if(y[pl] < x1 * y[i]) x1 = 1 ,pl = i ; } ans = (f * fastpower(((mp[N - 1] * fastpower(mp[pl] , M - 2)) % M) , M - 2)) % M; return (ans * y[pl]) % M; }

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

horses.cpp: In function 'll fastpower(ll, ll)':
horses.cpp:32:27: warning: declaration of 'n' shadows a global declaration [-Wshadow]
 ll fastpower( ll x , ll n ){
                           ^
horses.cpp:29:28: note: shadowed declaration is here
 ll x[500010] , y[500010] , n;
                            ^
horses.cpp:32:27: warning: declaration of 'x' shadows a global declaration [-Wshadow]
 ll fastpower( ll x , ll n ){
                           ^
horses.cpp:29:4: note: shadowed declaration is here
 ll x[500010] , y[500010] , n;
    ^
horses.cpp: In function 'int init(int, int*, int*)':
horses.cpp:47:17: warning: conversion to 'int' from 'long long int' may alter its value [-Wconversion]
  for(int i = max(0ll,n - 31) ; i < N ; ++i){
              ~~~^~~~~~~~~~~~
horses.cpp:56:23: warning: conversion to 'int' from 'll {aka long long int}' may alter its value [-Wconversion]
  return (ans * y[pl]) % M;
         ~~~~~~~~~~~~~~^~~
horses.cpp: In function 'int updateX(int, int)':
horses.cpp:65:17: warning: conversion to 'int' from 'long long int' may alter its value [-Wconversion]
  for(int i = max(0ll,n - 31) ; i < n ; ++i){
              ~~~^~~~~~~~~~~~
horses.cpp:73:28: error: 'N' was not declared in this scope
  ans = (f * fastpower(((mp[N - 1] * fastpower(mp[pl] , M - 2)) % M) , M - 2)) % M;
                            ^
horses.cpp:74:23: warning: conversion to 'int' from 'll {aka long long int}' may alter its value [-Wconversion]
  return (ans * y[pl]) % M;
         ~~~~~~~~~~~~~~^~~
horses.cpp: In function 'int updateY(int, int)':
horses.cpp:80:17: warning: conversion to 'int' from 'long long int' may alter its value [-Wconversion]
  for(int i = max(0ll,n - 31) ; i < n; ++i){
              ~~~^~~~~~~~~~~~
horses.cpp:85:28: error: 'N' was not declared in this scope
  ans = (f * fastpower(((mp[N - 1] * fastpower(mp[pl] , M - 2)) % M) , M - 2)) % M;
                            ^
horses.cpp:86:23: warning: conversion to 'int' from 'll {aka long long int}' may alter its value [-Wconversion]
  return (ans * y[pl]) % M;
         ~~~~~~~~~~~~~~^~~