Submission #1085331

#TimeUsernameProblemLanguageResultExecution timeMemory
1085331guagua0407Horses (IOI15_horses)C++17
0 / 100
1555 ms10228 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<int> 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(cur*x[i]>inf) break; cur*=x[i]; if(y[i]>cur){ best=i; cur=y[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(cur*x[i]>inf) break; cur*=x[i]; if(y[i]>cur){ best=i; cur=y[i]; } } ll ans=1; for(int i=0;i<=best;i++){ ans=ans*x[i]%mod; } ans=ans*y[best]%mod; return ans; return 0; } 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(cur*x[i]>inf) break; cur*=x[i]; if(y[i]>cur){ best=i; cur=y[i]; } } ll ans=1; for(int i=0;i<=best;i++){ ans=ans*x[i]%mod; } ans=ans*y[best]%mod; return ans; return 0; }

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:80:9: warning: conversion from 'long long int' to 'int' may change value [-Wconversion]
   80 |  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...