Submission #296673

#TimeUsernameProblemLanguageResultExecution timeMemory
296673peti1234말 (IOI15_horses)C++17
0 / 100
194 ms56056 KiB
#include<bits/stdc++.h> using namespace std; const int c=524288; long long n, mod=1e9+7; struct s{ long long r, x, y; double R, X, Y; } t[2*c]; void upd(int a) { int x=2*a, y=x+1; t[a].X=t[x].X+t[y].X, t[a].x=t[x].x+t[y].x%mod; if (t[x].R>t[x].X+t[y].R) { t[a].R=t[x].R, t[a].r=t[x].r; } else { t[a].R=t[x].X+t[y].R; t[a].r=t[x].x*t[y].r%mod; } if (a>1) upd(a/2); } void add(int a, int x, int y) { if (x) t[a].x=x, t[a].X=log(x); if (y) t[a].y=y, t[a].Y=log(y); t[a].r=t[a].x*t[a].y%mod, t[a].R=t[a].X+t[a].y; upd(a/2); } int init(int a, int x[], int y[]) { n=a; for (int i=0; i<n; i++) add(c+i, x[i], y[i]); return t[1].R; } int updateX(int a, int b) { add(c+a, b, 0); return t[1].R; } int updateY(int a, int b) { add(c+a, 0, b); return t[1].R; }

Compilation message (stderr)

horses.cpp: In function 'void add(int, int, int)':
horses.cpp:23:50: warning: conversion from 'long long int' to 'double' may change value [-Wconversion]
   23 |     t[a].r=t[a].x*t[a].y%mod, t[a].R=t[a].X+t[a].y;
      |                                             ~~~~~^
horses.cpp: In function 'int init(int, int*, int*)':
horses.cpp:29:17: warning: conversion from 'double' to 'int' may change value [-Wfloat-conversion]
   29 |     return t[1].R;
      |            ~~~~~^
horses.cpp: In function 'int updateX(int, int)':
horses.cpp:33:17: warning: conversion from 'double' to 'int' may change value [-Wfloat-conversion]
   33 |     return t[1].R;
      |            ~~~~~^
horses.cpp: In function 'int updateY(int, int)':
horses.cpp:37:17: warning: conversion from 'double' to 'int' may change value [-Wfloat-conversion]
   37 |     return t[1].R;
      |            ~~~~~^
#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...