Submission #135432

#TimeUsernameProblemLanguageResultExecution timeMemory
135432BoxworldHorses (IOI15_horses)C++14
0 / 100
1569 ms8208 KiB
#include "horses.h" #include <bits/stdc++.h> using namespace std; const long long bignum=1e9+7; struct year{int x,y;}a[500100]; int n,ok=1; int cnt(){ long long ans=0,m=0,ho=1,tmp=1; for (int i=0;i<n;i++){ ho=ho*a[i].x%bignum; tmp=tmp*a[i].x; double t=double(a[m].y)/double(a[i].y); if (t<=tmp){ ans=ho*a[i].y%bignum; m=i;tmp=1; } } return ans; } int cnt2(){ long long ans=0,m=n-32,ho=1,tmp=1; for (int i=0;i<n-32;i++)ho=ho*a[i].x%bignum; for (int i=n-32;i<n;i++){ ho=ho*a[i].x%bignum; tmp=tmp*a[i].x; double t=double(a[m].y)/double(a[i].y); if (t<=tmp){ ans=ho*a[i].y%bignum; m=i;tmp=1; } } return ans; } int init(int N, int X[], int Y[]){ n=N; for (int i=0;i<n;i++){a[i].x=X[i];a[i].y=Y[i];if(a[i].x<2)ok=0;} if (ok)return cnt2(); else return cnt(); } int updateX(int pos, int val) { a[pos].x=val; if (val<2)ok=0; if (ok)return cnt2(); else return cnt(); } int updateY(int pos, int val) { a[pos].y=val; if (ok)return cnt2(); else return cnt(); }

Compilation message (stderr)

horses.cpp: In function 'int cnt()':
horses.cpp:13:16: warning: conversion to 'double' from 'long long int' may alter its value [-Wconversion]
         if (t<=tmp){
                ^~~
horses.cpp:18:12: warning: conversion to 'int' from 'long long int' may alter its value [-Wconversion]
     return ans;
            ^~~
horses.cpp: In function 'int cnt2()':
horses.cpp:27:16: warning: conversion to 'double' from 'long long int' may alter its value [-Wconversion]
         if (t<=tmp){
                ^~~
horses.cpp:32:12: warning: conversion to 'int' from 'long long int' may alter its value [-Wconversion]
     return ans;
            ^~~
#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...