이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include <iostream>
#include <vector>
#include <algorithm>
#include <cmath>
#include <cstdio>
#include <map>
#include <queue>
#include <set>
#include <iomanip>
#include <deque>
#include <cassert>
#include <ctime>
#include <cstring>
#include <cstdlib>
#include <chrono>
#include <ctime>
#include <random>
#include <stack>
#include <unordered_set>
#include <unordered_map>
#include <iterator>
#include <climits>
#include <horses.h>
using namespace std;
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
typedef long long ll;
typedef long double ld;
#define INF 2001001001
#define MOD 1000000007
int N;
ll worth[1005],X[1005],Y[1005];
bool over[1005];
int calc(){
for (int i=0;i<N;i++){
worth[i]=0;
over[i]=false;
}
for (int i=N-1;i>=0;i--){
if (over[i+1])
worth[i]=X[i]*worth[i+1];
else
worth[i]=X[i]*max(Y[i],worth[i+1]);
over[i]=(worth[i]>1000000000) | over[i+1];
if (over[i])
worth[i]%=MOD;
}
return worth[0];
}
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 calc();
}
int updateX(int pos, int val){
X[pos]=val;
return calc();
}
int updateY(int pos, int val){
Y[pos]=val;
return calc();
}
컴파일 시 표준 에러 (stderr) 메시지
horses.cpp: In function 'int calc()':
horses.cpp:50:17: warning: conversion to 'int' from 'll {aka long long int}' may alter its value [-Wconversion]
return worth[0];
~~~~~~~^
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |