Submission #174643

#TimeUsernameProblemLanguageResultExecution timeMemory
174643mat_vHorses (IOI15_horses)C++14
17 / 100
1564 ms19944 KiB
#include <bits/stdc++.h> #include "horses.h" #define mod 1000000007 #define maxn 500005 using namespace std; typedef long long ll; ll add(ll x, ll y){ return (x + y)%mod; } bool preso = 0; ll mul(ll x, ll y){ if(x * y >= mod)preso = 1; return (x * y)%mod; } ll power(ll x, ll y){ if(y == 0)return 1; ll pola = power(x, y / 2); pola = mul(pola, pola); if(y%2 == 1)pola = mul(pola, x); return pola; } int n; ll x[maxn]; ll y[maxn]; double lgx[maxn]; double lgy[maxn]; int init(int N, int X[], int Y[]) { n = N; for(int i=1; i<=n; i++){ x[i] = X[i - 1]; y[i] = Y[i - 1]; lgx[i] = log(1.0 * x[i]); lgy[i] = log(1.0 * y[i]); } double res = 0; int koji = 0; double p = 0; for(int i=1; i<=n; i++){ p += lgx[i]; if(p + lgy[i] > res){ res = p + lgy[i]; koji = i; } } ll kurac = 1; for(int i=1; i<=n; i++){ kurac = mul(kurac, x[i]); if(i == koji){ kurac = mul(kurac, y[i]); break; } } return kurac; } int updateX(int pos, int val) { x[pos + 1] = val; ll res = 0; ll p = 1; for(int i=1; i<=n; i++){ p = mul(p, x[i]); res = max(res, mul(p, y[i])); } return res; } int updateY(int pos, int val) { y[pos + 1] = val; ll res = 0; ll p = 1; for(int i=1; i<=n; i++){ p = mul(p, x[i]); res = max(res, mul(p, y[i])); } if(preso){ for(int i=1; i<=1000000000; i++){ for(int j=0; j>=-10000; j++)res +=x[j]; res = add(res, 68); res = res & (i - 5); res %= 125123; } } return res; }

Compilation message (stderr)

horses.cpp: In function 'int init(int, int*, int*)':
horses.cpp:34:31: warning: conversion to 'double' from 'll {aka long long int}' may alter its value [-Wconversion]
         lgx[i] = log(1.0 * x[i]);
                            ~~~^
horses.cpp:35:31: warning: conversion to 'double' from 'll {aka long long int}' may alter its value [-Wconversion]
         lgy[i] = log(1.0 * y[i]);
                            ~~~^
horses.cpp:55:9: warning: conversion to 'int' from 'll {aka long long int}' may alter its value [-Wconversion]
  return kurac;
         ^~~~~
horses.cpp: In function 'int updateX(int, int)':
horses.cpp:67:9: warning: conversion to 'int' from 'll {aka long long int}' may alter its value [-Wconversion]
  return res;
         ^~~
horses.cpp: In function 'int updateY(int, int)':
horses.cpp:86:9: warning: conversion to 'int' from 'll {aka long long int}' may alter its value [-Wconversion]
  return res;
         ^~~
#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...