답안 #1039456

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
1039456 2024-07-30T22:49:55 Z HappyCapybara 말 (IOI15_horses) C++17
0 / 100
1500 ms 8028 KB
#include "horses.h"
#include<bits/stdc++.h>
using namespace std;

#define ll long long

int n;
vector<int> x, y;

int init(int N, int X[], int Y[]){
	n = N;
	x.resize(N);
	y.resize(N);
	for (int i=0; i<N; i++){
		y[i] = Y[i];
		x[i] = X[i];
	}

	double curd = 0, bsfd = 0;
	ll cur = 1, bsf = 0;
	for (int i=0; i<N; i++){
		curd += log(x[i]);
		cur = (cur*x[i]) % 1000000007;
		if (curd+log(Y[i]) > bsfd){
			bsfd = curd+log(Y[i]);
			bsf = (cur*y[i]) % 1000000007;
		}
	}
	return bsf;
}

int updateX(int pos, int val){
	x[pos] = val;

	double curd = 0, bsfd = 0;
	ll cur = 1, bsf = 0;
	for (int i=0; i<n; i++){
		curd += log(x[i]);
		cur = (cur*x[i]) % 1000000007;
		if (curd+log(y[i]) > bsfd){
			bsfd = curd+log(y[i]);
			bsf = (cur*y[i]) % 1000000007;
		}
	}
	return bsf;
}

int updateY(int pos, int val){
	y[pos] = val;

	double curd = 0, bsfd = 0;
	ll cur = 1, bsf = 0;
	for (int i=0; i<n; i++){
		curd += log(x[i]);
		cur = (cur*x[i]) % 1000000007;
		if (curd+log(y[i]) > bsfd){
			bsfd = curd+log(y[i]);
			bsf = (cur*y[i]) % 1000000007;
		}
	}
	return bsf;
}

Compilation message

horses.cpp: In function 'int init(int, int*, int*)':
horses.cpp:29:9: warning: conversion from 'long long int' to 'int' may change value [-Wconversion]
   29 |  return bsf;
      |         ^~~
horses.cpp: In function 'int updateX(int, int)':
horses.cpp:45:9: warning: conversion from 'long long int' to 'int' may change value [-Wconversion]
   45 |  return bsf;
      |         ^~~
horses.cpp: In function 'int updateY(int, int)':
horses.cpp:61:9: warning: conversion from 'long long int' to 'int' may change value [-Wconversion]
   61 |  return bsf;
      |         ^~~
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 348 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Correct 0 ms 348 KB Output is correct
4 Correct 0 ms 348 KB Output is correct
5 Correct 1 ms 348 KB Output is correct
6 Correct 0 ms 348 KB Output is correct
7 Correct 1 ms 344 KB Output is correct
8 Correct 0 ms 348 KB Output is correct
9 Correct 0 ms 348 KB Output is correct
10 Correct 1 ms 348 KB Output is correct
11 Correct 0 ms 348 KB Output is correct
12 Incorrect 0 ms 348 KB Output isn't correct
13 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 344 KB Output is correct
2 Correct 1 ms 348 KB Output is correct
3 Correct 0 ms 348 KB Output is correct
4 Correct 0 ms 348 KB Output is correct
5 Correct 0 ms 348 KB Output is correct
6 Correct 0 ms 348 KB Output is correct
7 Correct 0 ms 408 KB Output is correct
8 Correct 0 ms 348 KB Output is correct
9 Correct 0 ms 348 KB Output is correct
10 Correct 0 ms 348 KB Output is correct
11 Correct 0 ms 348 KB Output is correct
12 Incorrect 1 ms 348 KB Output isn't correct
13 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Execution timed out 1558 ms 8028 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 348 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Correct 1 ms 348 KB Output is correct
4 Correct 0 ms 348 KB Output is correct
5 Correct 0 ms 344 KB Output is correct
6 Correct 0 ms 348 KB Output is correct
7 Correct 0 ms 348 KB Output is correct
8 Correct 0 ms 348 KB Output is correct
9 Correct 0 ms 348 KB Output is correct
10 Correct 0 ms 348 KB Output is correct
11 Correct 0 ms 348 KB Output is correct
12 Incorrect 0 ms 348 KB Output isn't correct
13 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 348 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Correct 0 ms 348 KB Output is correct
4 Correct 0 ms 348 KB Output is correct
5 Correct 0 ms 348 KB Output is correct
6 Correct 0 ms 348 KB Output is correct
7 Correct 0 ms 348 KB Output is correct
8 Correct 0 ms 348 KB Output is correct
9 Correct 0 ms 348 KB Output is correct
10 Correct 0 ms 348 KB Output is correct
11 Correct 0 ms 348 KB Output is correct
12 Incorrect 0 ms 344 KB Output isn't correct
13 Halted 0 ms 0 KB -