Submission #97886

#TimeUsernameProblemLanguageResultExecution timeMemory
97886someone_aaHorses (IOI15_horses)C++17
0 / 100
21 ms11384 KiB
#include "horses.h" #include <bits/stdc++.h> #define ll long long using namespace std; const int maxn = 100100; const ll mod = 1e9 + 7; ll x[maxn], y[maxn], n; int solve() { ll h = 1LL; ll result = (1LL * x[0] * y[0])%mod; ll pref = x[0]; for(int i=1;i<n;i++) { ll curr = 1LL * x[i] * y[i]; pref *= 1LL * x[i]; if(curr < y[i-1]) { continue; } else if(curr >= y[i-1]) { result = (pref * y[i]) % mod; } } return result % mod; } int init(int N, int X[], int Y[]) { n = N; for(int i=0;i<N;i++) { x[i] = X[i]; y[i] = Y[i]; } return solve(); } int updateX(int pos, int val) { x[pos] = val; return solve(); } int updateY(int pos, int val) { y[pos] = val; return solve(); }

Compilation message (stderr)

horses.cpp: In function 'int solve()':
horses.cpp:23:19: warning: conversion to 'int' from 'long long int' may alter its value [-Wconversion]
     return result % mod;
            ~~~~~~~^~~~~
horses.cpp:10:8: warning: unused variable 'h' [-Wunused-variable]
     ll h = 1LL;
        ^
#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...