제출 #284494

#제출 시각아이디문제언어결과실행 시간메모리
284494Shafin666말 (IOI15_horses)C++14
34 / 100
1587 ms19960 KiB
#include "horses.h" #include <bits/stdc++.h> #define pb push_back #define pii pair<ll, ll> #define nyan "(=^・ω・^=)" #define read_input freopen("in.txt","r", stdin) #define print_output freopen("out.txt","w", stdout) typedef long long ll; typedef long double ld; using namespace std; const int maxn = 5e5+10, mod = 1e9+7; ll x[maxn], y[maxn], n; double lgx[maxn]; 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]; lgx[0] = log(x[0]); for(int i = 1; i < N; i++) lgx[i] = lgx[i-1] + log(x[i]); double mx = -1; int ans = 0; for(int i = 0; i < N; i++) { double now = lgx[i] + log(y[i]); if(now >= mx) { mx = now; ans = i; } } ll ret = 1; for(int i = 0; i <= ans; i++) { ret = (ret * x[i]) % mod; } ret = (ret * y[ans]) % mod; return ret; } int updateX(int pos, int val) { x[pos] = val; lgx[0] = log(x[0]); for(int i = 1; i < n; i++) lgx[i] = lgx[i-1] + log(x[i]); double mx = -1; int ans = 0; for(int i = 0; i < n; i++) { double now = lgx[i] + log(y[i]); if(now >= mx) { mx = now; ans = i; } } ll ret = 1; for(int i = 0; i <= ans; i++) { ret = (ret * x[i]) % mod; } ret = (ret * y[ans]) % mod; return ret; } int updateY(int pos, int val) { y[pos] = val; lgx[0] = log(x[0]); for(int i = 1; i < n; i++) lgx[i] = lgx[i-1] + log(x[i]); double mx = -1; int ans = 0; for(int i = 0; i < n; i++) { double now = lgx[i] + log(y[i]); if(now >= mx) { mx = now; ans = i; } } ll ret = 1; for(int i = 0; i <= ans; i++) { ret = (ret * x[i]) % mod; } ret = (ret * y[ans]) % mod; return ret; }

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

horses.cpp: In function 'int init(int, int*, int*)':
horses.cpp:36:9: warning: conversion from 'll' {aka 'long long int'} to 'int' may change value [-Wconversion]
   36 |  return ret;
      |         ^~~
horses.cpp: In function 'int updateX(int, int)':
horses.cpp:58:9: warning: conversion from 'll' {aka 'long long int'} to 'int' may change value [-Wconversion]
   58 |  return ret;
      |         ^~~
horses.cpp: In function 'int updateY(int, int)':
horses.cpp:80:9: warning: conversion from 'll' {aka 'long long int'} to 'int' may change value [-Wconversion]
   80 |  return ret;
      |         ^~~
#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...