제출 #353868

#제출 시각아이디문제언어결과실행 시간메모리
353868antontsiorvasHorses (IOI15_horses)C++14
17 / 100
1582 ms12104 KiB
#include "horses.h"
#include <algorithm>

long long int n, x[500005], y[500005];

int init(int N, int X[], int Y[]) {
	for(int i=0; i<N; i++){
		x[i] = X[i];
		y[i] = Y[i];
	}
	n = N;
	long long int horses=1;
	long long int ret=0;
	for(int i=0; i<N; i++){
		horses *= x[i];
		ret %= 1000000007;
		horses %= 1000000007;
		ret = std::max(ret, (horses*y[i])%1000000007);
	}
	int ret2 = ret;
	return ret2;
}

int updateX(int pos, int val) {	
	x[pos] = val;
	long long int horses=1;
	long long int ret=0;
	for(int i=0; i<n; i++){
		horses *= x[i];
		ret %= 1000000007;
		horses %= 1000000007;
		ret = std::max(ret, (horses*y[i])%1000000007);
	}
	int ret2 = ret;
	return ret2;
}

int updateY(int pos, int val) {
	y[pos] = val;
	long long int horses=1;
	long long int ret=0;
	for(int i=0; i<n; i++){
		horses *= x[i];
		ret %= 1000000007;
		horses %= 1000000007;
		ret = std::max(ret, (horses*y[i])%1000000007);
	}
	int ret2 = ret;
	return ret2;
}

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

horses.cpp: In function 'int init(int, int*, int*)':
horses.cpp:20:13: warning: conversion from 'long long int' to 'int' may change value [-Wconversion]
   20 |  int ret2 = ret;
      |             ^~~
horses.cpp: In function 'int updateX(int, int)':
horses.cpp:34:13: warning: conversion from 'long long int' to 'int' may change value [-Wconversion]
   34 |  int ret2 = ret;
      |             ^~~
horses.cpp: In function 'int updateY(int, int)':
horses.cpp:48:13: warning: conversion from 'long long int' to 'int' may change value [-Wconversion]
   48 |  int ret2 = ret;
      |             ^~~
#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...