제출 #408748

#제출 시각아이디문제언어결과실행 시간메모리
408748MDario말 (IOI15_horses)C++11
0 / 100
77 ms44260 KiB
#include "horses.h" #include<bits/stdc++.h> using namespace std; typedef long long ll; #define F first #define S second const ll mod=1e9+7; ll n; ll a[500001], b[500001]; pair<pair<ll, ll>, pair<ll, ll>> st[1000001]; void f(ll xf){ if(st[xf*2+1].S.F==1){ st[xf]={{(((st[xf*2].F.F*st[xf*2].S.S)%mod)*st[xf*2+1].F.F)%mod, st[xf*2+1].F.S}, {1, st[xf*2+1].S.S}}; } else{ if(st[xf*2].F.S<st[xf*2].S.S*st[xf*2+1].F.F*st[xf*2+1].F.S){ st[xf]={{(((st[xf*2].F.F*st[xf*2].S.S)%mod)*st[xf*2+1].F.F)%mod, st[xf*2+1].F.S}, {(st[xf*2].S.F||(st[xf*2].S.S*st[xf*2+1].F.F*st[xf*2+1].F.S*st[xf*2].F.F)>=1e9), st[xf*2+1].S.S}}; } else{ st[xf]=st[xf*2]; st[xf].S.S*=st[xf*2+1].S.S*st[xf*2+1].F.F; } } return ; } void update(ll xf){ xf/=2; while(xf>0){ f(xf); xf/=2; } return ; } int init(int N, int X[], int Y[]) { n=N; for(int i=0; i<N; i++){ a[i]=X[i]; b[i]=Y[i]; } for(int i=0; i<n; i++){ st[i+n]={{a[i], b[i]}, {(a[i]*b[i]>=1e9), 1}}; } for(int i=n-1; i>0; i--){ f(i); } return (st[1].F.F*st[1].F.S)%mod; } int updateX(int pos, int val) { a[pos]=val; st[pos+n]={{a[pos], b[pos]}, {(a[pos]*b[pos]>=1e9), 1}}; update(pos+n); return (st[1].F.F*st[1].F.S)%mod; } int updateY(int pos, int val) { b[pos]=val; st[pos+n]={{a[pos], b[pos]}, {(a[pos]*b[pos]>=1e9), 1}}; update(pos+n); return (st[1].F.F*st[1].F.S)%mod; }

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

horses.cpp: In function 'void f(ll)':
horses.cpp:17:154: warning: conversion from 'long long int' to 'double' may change value [-Wconversion]
   17 |             st[xf]={{(((st[xf*2].F.F*st[xf*2].S.S)%mod)*st[xf*2+1].F.F)%mod, st[xf*2+1].F.S}, {(st[xf*2].S.F||(st[xf*2].S.S*st[xf*2+1].F.F*st[xf*2+1].F.S*st[xf*2].F.F)>=1e9), st[xf*2+1].S.S}};
      |                                                                                                               ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~
horses.cpp: In function 'int init(int, int*, int*)':
horses.cpp:41:38: warning: conversion from 'll' {aka 'long long int'} to 'double' may change value [-Wconversion]
   41 |         st[i+n]={{a[i], b[i]}, {(a[i]*b[i]>=1e9), 1}};
      |                                  ~~~~^~~~~
horses.cpp:43:16: warning: conversion from 'll' {aka 'long long int'} to 'int' may change value [-Wconversion]
   43 |     for(int i=n-1; i>0; i--){
      |               ~^~
horses.cpp:46:30: warning: conversion from 'long long int' to 'int' may change value [-Wconversion]
   46 |  return (st[1].F.F*st[1].F.S)%mod;
      |         ~~~~~~~~~~~~~~~~~~~~~^~~~
horses.cpp: In function 'int updateX(int, int)':
horses.cpp:51:42: warning: conversion from 'll' {aka 'long long int'} to 'double' may change value [-Wconversion]
   51 |     st[pos+n]={{a[pos], b[pos]}, {(a[pos]*b[pos]>=1e9), 1}};
      |                                    ~~~~~~^~~~~~~
horses.cpp:53:30: warning: conversion from 'long long int' to 'int' may change value [-Wconversion]
   53 |  return (st[1].F.F*st[1].F.S)%mod;
      |         ~~~~~~~~~~~~~~~~~~~~~^~~~
horses.cpp: In function 'int updateY(int, int)':
horses.cpp:58:42: warning: conversion from 'll' {aka 'long long int'} to 'double' may change value [-Wconversion]
   58 |     st[pos+n]={{a[pos], b[pos]}, {(a[pos]*b[pos]>=1e9), 1}};
      |                                    ~~~~~~^~~~~~~
horses.cpp:60:30: warning: conversion from 'long long int' to 'int' may change value [-Wconversion]
   60 |  return (st[1].F.F*st[1].F.S)%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...