제출 #1016316

#제출 시각아이디문제언어결과실행 시간메모리
1016316ayankarimova말 (IOI15_horses)C++14
100 / 100
126 ms67156 KiB
#include "horses.h" #include <bits/stdc++.h> using namespace std; #define endl '\n' #define ll long long const ll mod=1e9+7; const ll sz=5e5+5; struct d { double sum, lpre; ll mul, pre; }; d st[sz*4]; ll x[sz], y[sz], n; double xl[sz], yl[sz]; d make(ll pos) { d cur; cur.sum=xl[pos]; cur.mul=x[pos]; cur.lpre=xl[pos]+yl[pos]; cur.pre=((x[pos]%mod)*(y[pos]%mod))%mod; return cur; } void mrg(d a, d b, d &c) { c.sum=a.sum+b.sum; c.mul=((a.mul%mod)*(b.mul%mod))%mod; if(a.lpre>a.sum+b.lpre){ c.lpre=a.lpre; c.pre=a.pre; } else{ c.lpre=a.sum+b.lpre; c.pre=((a.mul%mod)*(b.pre%mod)%mod); } } void build(ll l, ll r, ll in) { if(l==r){ st[in]=make(l); return; } ll mid=(l+r)/2; build(l, mid, in*2); build(mid+1, r, in*2+1); mrg(st[in*2], st[in*2+1], st[in]); } void update(ll l, ll r, ll in, ll pos) { if(l==r){ st[in]=make(l); return; } ll mid=(l+r)/2; if(pos<=mid){ update(l, mid, in*2, pos); } else{ update(mid+1, r, in*2+1, pos); } mrg(st[in*2], st[in*2+1], st[in]); } int init(int N, int X[], int Y[]) { ll num=1, ans=0; n=N; for(int i=0; i<n; i++){ x[i+1]=(X[i]); y[i+1]=(Y[i]); xl[i+1]=log10(X[i]); yl[i+1]=log10(Y[i]); } build(1, n, 1); return st[1].pre; } int updateX(int pos, int val) { pos++; x[pos]=val; xl[pos]=log10(val); update(1, n, 1, pos); return st[1].pre; } int updateY(int pos, int val) { pos++; y[pos]=val; yl[pos]=log10(val); update(1, n, 1, pos); return st[1].pre; }

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

horses.cpp: In function 'int init(int, int*, int*)':
horses.cpp:75:15: warning: conversion from 'long long int' to 'int' may change value [-Wconversion]
   75 |  return st[1].pre;
      |         ~~~~~~^~~
horses.cpp:66:8: warning: unused variable 'num' [-Wunused-variable]
   66 |     ll num=1, ans=0;
      |        ^~~
horses.cpp:66:15: warning: unused variable 'ans' [-Wunused-variable]
   66 |     ll num=1, ans=0;
      |               ^~~
horses.cpp: In function 'int updateX(int, int)':
horses.cpp:83:15: warning: conversion from 'long long int' to 'int' may change value [-Wconversion]
   83 |  return st[1].pre;
      |         ~~~~~~^~~
horses.cpp: In function 'int updateY(int, int)':
horses.cpp:91:15: warning: conversion from 'long long int' to 'int' may change value [-Wconversion]
   91 |  return st[1].pre;
      |         ~~~~~~^~~
#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...