제출 #1004990

#제출 시각아이디문제언어결과실행 시간메모리
1004990Mr_Husanboy말 (IOI15_horses)C++17
17 / 100
32 ms16988 KiB
#include "horses.h" #include<bits/stdc++.h> using namespace std; #define ll long long template<typename T> int len(T &a){return a.size();} #define ff first #define ss second #define all(a) (a).begin(), (a).end() int mod = 1e9 + 7; vector<ll> x, y; const int inf = 1e9; int n; vector<ll> pref; int init(int N, int X[], int Y[]) { n = N; x.resize(n), y.resize(n); pref.resize(n); for(int i = 0; i < n; i ++) x[i] = X[i], y[i] = Y[i]; pref[0] = x[0]; for(int i = 1; i < n; i ++) pref[i] = pref[i - 1] * x[i] % mod; ll mult = 1; ll mx = 0; int lim = -1; for(int i = n - 1; i >= 0; i --){ mult *= x[i]; if(mult >= inf){ lim = i; break; } } mult = 1; for(int i = lim + 1; i < n; i ++){ mult *= x[i]; mx = max(mx, mult * y[i]); } mx %= mod; if(lim >= 0) mx = mx * pref[lim] % mod; //cout << mx << endl; return mx; } int updateX(int pos, int val) { x[pos] = val; ll mult = 1; ll mx = 0; int lim = -1; for(int i = n - 1; i >= 0; i --){ mult *= x[i]; if(mult >= inf){ lim = i - 1; break; } } mult = 1; for(int i = lim + 1; i < n; i ++){ mult *= x[i]; mx = max(mx, mult * y[i]); } mx %= mod; if(lim >= 0) mx = mx * pref[lim] % mod; //cout << mx << endl; return mx; } int updateY(int pos, int val) { y[pos] = val; ll mult = 1; ll mx = 0; int lim = -1; for(int i = n - 1; i >= 0; i --){ mult *= x[i]; if(mult >= inf){ lim = i; break; } } mult = 1; for(int i = lim + 1; i < n; i ++){ mult *= x[i]; mx = max(mx, mult * y[i]); } mx %= mod; if(lim >= 0) mx = pref[lim] * mx % mod; //cout << mx << endl; return mx; }

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

horses.cpp: In function 'int init(int, int*, int*)':
horses.cpp:46:9: warning: conversion from 'long long int' to 'int' may change value [-Wconversion]
   46 |  return mx;
      |         ^~
horses.cpp: In function 'int updateX(int, int)':
horses.cpp:71:9: warning: conversion from 'long long int' to 'int' may change value [-Wconversion]
   71 |  return mx;
      |         ^~
horses.cpp: In function 'int updateY(int, int)':
horses.cpp:96:9: warning: conversion from 'long long int' to 'int' may change value [-Wconversion]
   96 |  return mx;
      |         ^~
#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...