제출 #116947

#제출 시각아이디문제언어결과실행 시간메모리
116947someone_aa말 (IOI15_horses)C++17
34 / 100
60 ms14840 KiB
#include "horses.h" #include <bits/stdc++.h> #define ll long long using namespace std; const int maxn = 501000; const ll mod = 1e9 + 7; ll x[maxn], y[maxn], n; int solve() { if(n <= 1000) { ll result = (1LL * x[0] * y[0])%mod; ll prod = 1LL; ll pref = x[0]; ll ind = 0; for(int i=1;i<n;i++) { prod *= x[i]; ll curr = prod * y[i]; pref *= x[i]; pref %= mod; if(curr >= y[ind]) { // buy this one result = (pref * y[i])%mod; prod = 1LL; ind = i; } } return result%mod; } else { ll result = (1LL * x[n-40] * y[n-40])%mod; ll prod = 1LL; ll pref = x[n-40]; ll ind = 0; for(int i=n-39;i<n;i++) { prod *= x[i]; ll curr = prod * y[i]; pref *= x[i]; pref %= mod; if(curr >= y[ind]) { // buy this one result = (pref * y[i])%mod; prod = 1LL; ind = i; } } 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(); }

컴파일 시 표준 에러 (stderr) 메시지

horses.cpp: In function 'int solve()':
horses.cpp:26:22: warning: conversion to 'int' from 'long long int' may alter its value [-Wconversion]
         return result%mod;
                ~~~~~~^~~~
horses.cpp:33:20: warning: conversion to 'int' from 'long long int' may alter its value [-Wconversion]
         for(int i=n-39;i<n;i++) {
                   ~^~~
horses.cpp:44:22: warning: conversion to 'int' from 'long long int' may alter its value [-Wconversion]
         return result%mod;
                ~~~~~~^~~~
#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...