Submission #1085332

#TimeUsernameProblemLanguageResultExecution timeMemory
1085332guagua0407Horses (IOI15_horses)C++17
34 / 100
1594 ms16124 KiB
#include "horses.h" #include <bits/stdc++.h> using namespace std; #define ll long long #define pii pair<int,int> #define f first #define s second #define all(x) x.begin(),x.end() #define _ ios::sync_with_stdio(0); cin.tie(0); cout.tie(0); int n; vector<ll> x,y; const ll inf=1e9; const ll mod=1e9+7; int init(int N, int X[], int Y[]) { n=N; x.resize(n); y.resize(n); for(int i=0;i<n;i++){ x[i]=X[i]; y[i]=Y[i]; } int best=n-1; ll cur=y[n-1]; for(int i=n-1;i>=0;i--){ if(y[i]>cur){ best=i; cur=y[i]; } if(cur*x[i]>inf) break; cur*=x[i]; } ll ans=1; for(int i=0;i<=best;i++){ ans=ans*x[i]%mod; } ans=ans*y[best]%mod; return ans; } int updateX(int pos, int val) { x[pos]=val; int best=n-1; ll cur=y[n-1]; for(int i=n-1;i>=0;i--){ if(y[i]>cur){ best=i; cur=y[i]; } if(cur*x[i]>inf) break; cur*=x[i]; } ll ans=1; for(int i=0;i<=best;i++){ ans=ans*x[i]%mod; } ans=ans*y[best]%mod; return ans; } int updateY(int pos, int val) { y[pos]=val; int best=n-1; ll cur=y[n-1]; for(int i=n-1;i>=0;i--){ if(y[i]>cur){ best=i; cur=y[i]; } if(cur*x[i]>inf) break; cur*=x[i]; } ll ans=1; for(int i=0;i<=best;i++){ ans=ans*x[i]%mod; } ans=ans*y[best]%mod; return ans; }

Compilation message (stderr)

horses.cpp: In function 'int init(int, int*, int*)':
horses.cpp:39:9: warning: conversion from 'long long int' to 'int' may change value [-Wconversion]
   39 |  return ans;
      |         ^~~
horses.cpp: In function 'int updateX(int, int)':
horses.cpp:59:9: warning: conversion from 'long long int' to 'int' may change value [-Wconversion]
   59 |  return ans;
      |         ^~~
horses.cpp: In function 'int updateY(int, int)':
horses.cpp:79:9: warning: conversion from 'long long int' to 'int' may change value [-Wconversion]
   79 |  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...