제출 #234243

#제출 시각아이디문제언어결과실행 시간메모리
234243jhtan말 (IOI15_horses)C++14
17 / 100
1574 ms20488 KiB
#include "horses.h" #include <algorithm> using namespace std; typedef long long ll; const ll MOD = 1000000007; ll V[500000]; ll XX[500000]; ll YY[500000]; ll MX[500000]; ll MY[500000]; int n; int init(int N, int X[], int Y[]) { // For 17 points /* int V[N]; V[0] = X[0]; for(int i=1; i<N; i++) V[i] = V[i-1] * X[i]; int mx = 0; for(int i=0; i<N; i++) mx = max(mx, V[i] * Y[i]); */ n = N; for(int i=0; i<N; i++) { YY[i] = Y[i]; XX[i] = X[i]; } MX[0] = X[0] / MOD; V[0] = X[0] % MOD; for(int i=1; i<N; i++) { ll m = V[i-1] * X[i]; MX[i] = (m / MOD) + (MX[i-1] * X[i]); V[i] = m % MOD; } ll mm = 0, mx = 0; for(int i=0; i<N; i++) { ll m1 = MX[i] * Y[i] + ((V[i] * Y[i]) / MOD); ll m2 = (V[i] * Y[i]) % MOD; if(m1 > mm) { mm = m1; mx = m2; } else if (m1 == mm && m2 > mx) { mx = m2; } } return mx; } int updateX(int pos, int val) { XX[pos] = val; for(int i=pos; i<n; i++) V[i] = (V[i-1] * XX[i]); ll mx = 0; for(int i=0; i<n; i++) mx = max(mx, (V[i] * YY[i])); return mx % MOD; } int updateY(int pos, int val) { YY[pos] = val; ll mx = 0; for(int i=0; i<n; i++) mx = max(mx, (V[i] * YY[i])); return mx % MOD; }

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

horses.cpp: In function 'int init(int, int*, int*)':
horses.cpp:55:9: warning: conversion to 'int' from 'll {aka long long int}' may alter its value [-Wconversion]
  return mx;
         ^~
horses.cpp: In function 'int updateX(int, int)':
horses.cpp:63:12: warning: conversion to 'int' from 'll {aka long long int}' may alter its value [-Wconversion]
  return mx % MOD;
         ~~~^~~~~
horses.cpp: In function 'int updateY(int, int)':
horses.cpp:70:12: warning: conversion to 'int' from 'll {aka long long int}' may alter its value [-Wconversion]
  return mx % MOD;
         ~~~^~~~~
#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...