제출 #707686

#제출 시각아이디문제언어결과실행 시간메모리
707686MODDI말 (IOI15_horses)C++14
17 / 100
1552 ms9156 KiB
//#include "horses.h"
#include <bits/stdc++.h>
#define ll long long
#define pb push_back
#define vi vector<int>
#define vl vector<ll>
using namespace std;
const int mod = 1e9 + 7;
vi X, Y;
ll mul(ll a, ll b){
	return (a * b) % mod;
}
int N;
int init(int n, int x[], int y[]){
	N = n;
	for(int i = 0; i < n; i++)
		X.pb(x[i]);
	for(int i = 0; i < n; i++)
		Y.pb(y[i]);

	ll ans = 0, mult = 1;
	for(int i = 0; i < n; i++){
		mult = mul(mult, X[i]);
		mult %= mod;
		ll cur_sell = mul(mult, Y[i]);
		cur_sell %= mod;
		if(cur_sell < 0)	assert(false);
		ans = max(ans, cur_sell);
	}
	if(ans < 0)	assert(false);
	return ans;
}
int updateX(int pos, int val){
	X[pos] = val;
	ll ans = 0, mult = 1;
	for(int i = 0; i < N; i++){
		mult = mul(mult, X[i]);
		mult %= mod;
		ll cur_sell = mul(mult, Y[i]);
		cur_sell %= mod;
		if(cur_sell < 0)
			assert(false);
		ans = max(ans, cur_sell);
	}
	if(ans < 0)	assert(false);
	return ans;
}
int updateY(int pos, int val){
	Y[pos] = val;
	ll ans = 0, mult = 1;
	for(int i = 0; i < N; i++){
		mult = mul(mult, X[i]);
		mult %= mod;
		ll cur_sell = mul(mult, Y[i]);
		cur_sell %= mod;
		ans = max(ans, cur_sell);
	}
	if(ans < 0)	assert(false);
	return ans;
}

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

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