제출 #718545

#제출 시각아이디문제언어결과실행 시간메모리
718545mseebacher말 (IOI15_horses)C++17
34 / 100
1577 ms12016 KiB
#include "horses.h" #include <stdio.h> #include <stdlib.h> #include <iostream> #include <string> #include <vector> #include <cmath> #include <cstring> #include <algorithm> #include <iomanip> #include <map> #include <set> #include <stack> #include <queue> #include <functional> #include <iostream> #include <fstream> #include <string> using namespace std; vector<int> x; vector<int> y; int n; const int MOD = 1e9+7; int calc(){ double horses_log = log2(1); double p_log = -1e18; long long horses_mod = 1; long long p_mod = -1e18; for(int i = 0;i<n;i++){ horses_log += log2(x[i]); horses_mod = horses_mod * x[i] %MOD; if(horses_log + log2(y[i]) > p_log){ p_log = horses_log+log2(y[i]); p_mod = horses_mod*y[i] %MOD; } } return p_mod%MOD; } int init(int N, int X[], int Y[]) { n = N; x.assign(N,0); y.assign(N,0); 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:42:14: warning: conversion from 'long long int' to 'int' may change value [-Wconversion]
   42 |  return p_mod%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...