제출 #238161

#제출 시각UTC-0아이디문제언어결과실행 시간메모리
2381612020-06-10 05:36:06rama_pang말 (IOI15_horses)C++14
100 / 100
962 ms22024 KiB
#include "horses.h"
#include <bits/stdc++.h>
using namespace std;
const int mod = 1e9 + 7;
// It is always optimal to sell all horses in a single year
class SegmentTree {
private:
struct Mint {
int val = 0;
bool overflow = 0;
const Mint operator * (const Mint &x) const {
return {(int) (1ll * this->val * x.val % mod),
(bool) (this->overflow || x.overflow || (1ll * this->val * x.val >= mod))};
}
};
int sz;
vector<Mint> X;
vector<int> Y;
vector<int> optimal;
void Pull(int n, int lc, int rc) {
X[n] = X[lc] * X[rc];
Mint in_between = QueryX(1, 0, sz - 1, optimal[lc] + 1, optimal[rc]);
if (in_between.overflow) {
optimal[n] = optimal[rc];
} else if (Y[optimal[lc]] > 1ll * Y[optimal[rc]] * in_between.val) {
optimal[n] = optimal[lc];
 
הההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההה
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX

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

horses.cpp: In member function 'int SegmentTree::Query()':
horses.cpp:104:74: warning: conversion to 'int' from 'long long int' may alter its value [-Wconversion]
     return 1ll * QueryX(1, 0, sz - 1, 0, optimal[1]).val * Y[optimal[1]] % 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...