제출 #827711

#제출 시각아이디문제언어결과실행 시간메모리
827711Supersonic말 (IOI15_horses)C++14
17 / 100
1567 ms16108 KiB
#include "horses.h" #include <bits/stdc++.h> using namespace std; typedef unsigned long long ll; ll h[500001]; ll x[500001]; ll y[500001]; int n; int init(int N, int X[], int Y[]) { n=N; h[0]=X[0]; for(int i=0;i<n;i++){ x[i]=X[i]; y[i]=Y[i]; if(i>0)h[i]=(h[i-1]*x[i])%((ll)1e9); } ll mp=0;ll c=1; for(int i=1;i<n;i++){ c*=x[i]; if(c>y[mp]||y[i]>y[mp]||c*y[i]>y[mp]){mp=i;c=1;} } return (h[mp]*y[mp])%((ll)1e9); } int updateX(int pos, int val) { x[pos]=val; h[0]=x[0]; for(int i=1;i<n;i++){ if(i<pos)continue; h[i]=(h[i-1]*x[i])%((ll)1e9); } ll mp=0;ll c=1; for(int i=1;i<n;i++){ c*=x[i]; if(c>y[mp]||y[i]>y[mp]||c*y[i]>y[mp]){mp=i;c=1;} } return (h[mp]*y[mp])%((ll)1e9); } int updateY(int pos, int val) { y[pos]=val; ll mp=0;ll c=1; for(int i=1;i<n;i++){ c*=x[i]; if(c>y[mp]||y[i]>y[mp]||c*y[i]>y[mp]){mp=i;c=1;} } return (h[mp]*y[mp])%((ll)1e9); } /* a x b y xy>ab x/a > b/y*/

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

horses.cpp: In function 'int init(int, int*, int*)':
horses.cpp:22:22: warning: conversion from 'll' {aka 'long long unsigned int'} to 'int' may change value [-Wconversion]
   22 |  return (h[mp]*y[mp])%((ll)1e9);
      |         ~~~~~~~~~~~~~^~~~~~~~~~
horses.cpp: In function 'int updateX(int, int)':
horses.cpp:37:22: warning: conversion from 'll' {aka 'long long unsigned int'} to 'int' may change value [-Wconversion]
   37 |  return (h[mp]*y[mp])%((ll)1e9);
      |         ~~~~~~~~~~~~~^~~~~~~~~~
horses.cpp: In function 'int updateY(int, int)':
horses.cpp:47:22: warning: conversion from 'll' {aka 'long long unsigned int'} to 'int' may change value [-Wconversion]
   47 |  return (h[mp]*y[mp])%((ll)1e9);
      |         ~~~~~~~~~~~~~^~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...