제출 #396694

#제출 시각아이디문제언어결과실행 시간메모리
396694rainboyHorses (IOI15_horses)C11
34 / 100
24 ms12188 KiB
#include "horses.h"
#include <string.h>

#define N	1000
#define MD	1000000007

int xx[N], yy[N], n;

int solve() {
	long long p, q;
	int i, ans, x;

	p = 0, q = 1, ans = 0, x = 1;
	for (i = 0; i < n; i++) {
		q *= xx[i];
		x = (long long) x * xx[i] % MD;
		if (p / q < yy[i])
			p = yy[i], q = 1, ans = (long long) x * yy[i] % MD;
	}
	return ans;
}

int init(int n_, int *xx_, int *yy_) {
	n = n_;
	memcpy(xx, xx_, n * sizeof *xx_), memcpy(yy, yy_, n * sizeof *yy_);
	return solve();
}

int updateX(int i, int x) {	
	xx[i] = x;
	return solve();
}

int updateY(int i, int y) {
	yy[i] = y;
	return solve();
}

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

horses.c: In function 'solve':
horses.c:16:7: warning: conversion from 'long long int' to 'int' may change value [-Wconversion]
   16 |   x = (long long) x * xx[i] % MD;
      |       ^
horses.c:18:28: warning: conversion from 'long long int' to 'int' may change value [-Wconversion]
   18 |    p = yy[i], q = 1, ans = (long long) x * yy[i] % MD;
      |                            ^
horses.c: In function 'init':
horses.c:25:20: warning: conversion to 'long unsigned int' from 'int' may change the sign of the result [-Wsign-conversion]
   25 |  memcpy(xx, xx_, n * sizeof *xx_), memcpy(yy, yy_, n * sizeof *yy_);
      |                    ^
horses.c:25:54: warning: conversion to 'long unsigned int' from 'int' may change the sign of the result [-Wsign-conversion]
   25 |  memcpy(xx, xx_, n * sizeof *xx_), memcpy(yy, yy_, n * sizeof *yy_);
      |                                                      ^
#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...