제출 #832548

#제출 시각아이디문제언어결과실행 시간메모리
832548AkramElOmrani말 (IOI15_horses)C++17
17 / 100
13 ms8404 KiB
#include <stdio.h> #include <stdlib.h> #include <bits/stdc++.h> using namespace std; #include <bits/stdc++.h> using namespace std; #pragma GCC optimize("O3,unroll-loops") #pragma GCC target("avx,avx2,bmi,bmi2,popcnt,lzcnt") #define ll long long template<typename A, typename B> ostream& operator<<(ostream &os, const pair<A, B> &p) { return os << '(' << p.first << ", " << p.second << ')'; } template<typename T_container, typename T = typename enable_if<!is_same<T_container, string>::value, typename T_container::value_type>::type> ostream& operator<<(ostream &os, const T_container &v) { os << '{'; string sep; for (const T &x : v) os << sep << x, sep = ", "; return os << '}'; } void dbg_out() { cerr << endl; } template<typename Head, typename... Tail> void dbg_out(Head H, Tail... T) { cerr << ' ' << H; dbg_out(T...); } #define dbg(...) cerr << "(" << #__VA_ARGS__ << "):", dbg_out(__VA_ARGS__); const int mod = 1e9 + 7; void max_self(ll& a, ll b) { a = max(a, b); } ll add(ll a, ll b) { a += b; if(a > mod) { a -= mod; } return a; } ll mul(ll a, ll b) { a = (ll)a * b % mod; return a; } const int N = 1e3 + 1; int n; ll x[N], y[N]; int solve() { ll h = 1, p = 1, ans = 0; long double l = 0; int last = max(0, n - 30); for(int i = last; i < n; ++i) { h *= x[i]; p = (ll)p * x[i] % mod; long double profit = (long double)y[i] * h; if(profit > l) { ans = mul(p, y[i]); h = 1; l = y[i]; } } return ans; } 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) { x[pos] = val; return solve(); }

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

horses.cpp: In function 'int solve()':
horses.cpp:56:9: warning: conversion from 'long long int' to 'int' may change value [-Wconversion]
   56 |  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...