답안 #830377

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
830377 2023-08-19T04:52:58 Z mindiyak 말 (IOI15_horses) C++14
34 / 100
1500 ms 14284 KB
#include "horses.h"
#include <vector>
#include <iostream>
 
using namespace std;
typedef long long ll;
 
vector<ll> x;
vector<ll> y;
int n;
int M = 1e9+7;
 
ll multi(ll a,ll b){
	return ((a%M)*(b%M))%M;
}
 
int calc(){
	int MX_pos = 0;
	ll cur = 1;

	for(int i=1;i<n;i++){
		ll multiply = cur*x[i];
		if(multiply*y[i]>=y[MX_pos]){
			MX_pos = i;
			cur=1;
		}else{
			cur=multiply;
		}
	}

	ll MX = 1;
	for(int i=0;i<MX_pos+1;i++){
		MX = multi(MX,x[i]);
	}
	int ans = multi(MX,y[MX_pos]);
	return ans;
}
 
int init(int N, int X[], int Y[]) {
	n = N;
	for(int i=0;i<N;i++)x.push_back(X[i]);
	for(int i=0;i<N;i++)y.push_back(Y[i]);
 
	return calc();
}
 
int updateX(int pos, int val) {	
	x[pos]=val;
	return calc();
}
 
int updateY(int pos, int val) {
	y[pos]=val;
	return calc();
}

Compilation message

horses.cpp: In function 'int calc()':
horses.cpp:35:17: warning: conversion from 'll' {aka 'long long int'} to 'int' may change value [-Wconversion]
   35 |  int ans = multi(MX,y[MX_pos]);
      |            ~~~~~^~~~~~~~~~~~~~
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 212 KB Output is correct
2 Correct 0 ms 212 KB Output is correct
3 Correct 0 ms 212 KB Output is correct
4 Correct 0 ms 212 KB Output is correct
5 Correct 0 ms 212 KB Output is correct
6 Correct 1 ms 212 KB Output is correct
7 Correct 0 ms 212 KB Output is correct
8 Correct 0 ms 212 KB Output is correct
9 Correct 0 ms 212 KB Output is correct
10 Correct 0 ms 212 KB Output is correct
11 Correct 1 ms 212 KB Output is correct
12 Correct 0 ms 212 KB Output is correct
13 Correct 0 ms 212 KB Output is correct
14 Correct 0 ms 212 KB Output is correct
15 Correct 0 ms 212 KB Output is correct
16 Correct 1 ms 212 KB Output is correct
17 Correct 0 ms 212 KB Output is correct
18 Correct 0 ms 212 KB Output is correct
19 Correct 0 ms 212 KB Output is correct
20 Correct 0 ms 212 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 212 KB Output is correct
2 Correct 1 ms 212 KB Output is correct
3 Correct 0 ms 212 KB Output is correct
4 Correct 0 ms 212 KB Output is correct
5 Correct 0 ms 212 KB Output is correct
6 Correct 0 ms 212 KB Output is correct
7 Correct 0 ms 212 KB Output is correct
8 Correct 0 ms 212 KB Output is correct
9 Correct 0 ms 212 KB Output is correct
10 Correct 0 ms 212 KB Output is correct
11 Correct 0 ms 212 KB Output is correct
12 Correct 0 ms 212 KB Output is correct
13 Correct 0 ms 212 KB Output is correct
14 Correct 0 ms 212 KB Output is correct
15 Correct 0 ms 212 KB Output is correct
16 Correct 0 ms 212 KB Output is correct
17 Correct 0 ms 212 KB Output is correct
18 Correct 0 ms 212 KB Output is correct
19 Correct 0 ms 212 KB Output is correct
20 Correct 0 ms 212 KB Output is correct
21 Correct 0 ms 212 KB Output is correct
22 Correct 0 ms 212 KB Output is correct
23 Correct 15 ms 328 KB Output is correct
24 Correct 15 ms 336 KB Output is correct
25 Correct 18 ms 328 KB Output is correct
26 Correct 19 ms 328 KB Output is correct
27 Correct 13 ms 340 KB Output is correct
28 Correct 15 ms 340 KB Output is correct
29 Correct 15 ms 328 KB Output is correct
30 Correct 16 ms 328 KB Output is correct
31 Correct 5 ms 212 KB Output is correct
32 Correct 11 ms 212 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Execution timed out 1580 ms 14276 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 212 KB Output is correct
2 Correct 0 ms 212 KB Output is correct
3 Correct 0 ms 212 KB Output is correct
4 Correct 0 ms 212 KB Output is correct
5 Correct 0 ms 212 KB Output is correct
6 Correct 0 ms 212 KB Output is correct
7 Correct 0 ms 212 KB Output is correct
8 Correct 0 ms 212 KB Output is correct
9 Correct 0 ms 212 KB Output is correct
10 Correct 1 ms 256 KB Output is correct
11 Correct 0 ms 212 KB Output is correct
12 Correct 0 ms 212 KB Output is correct
13 Correct 0 ms 212 KB Output is correct
14 Correct 0 ms 212 KB Output is correct
15 Correct 0 ms 212 KB Output is correct
16 Correct 0 ms 212 KB Output is correct
17 Correct 0 ms 212 KB Output is correct
18 Correct 0 ms 212 KB Output is correct
19 Correct 0 ms 212 KB Output is correct
20 Correct 0 ms 212 KB Output is correct
21 Correct 0 ms 212 KB Output is correct
22 Correct 0 ms 212 KB Output is correct
23 Correct 15 ms 324 KB Output is correct
24 Correct 15 ms 328 KB Output is correct
25 Correct 18 ms 336 KB Output is correct
26 Correct 19 ms 212 KB Output is correct
27 Correct 13 ms 328 KB Output is correct
28 Correct 15 ms 332 KB Output is correct
29 Correct 14 ms 328 KB Output is correct
30 Correct 16 ms 332 KB Output is correct
31 Correct 5 ms 332 KB Output is correct
32 Correct 11 ms 332 KB Output is correct
33 Execution timed out 1588 ms 14272 KB Time limit exceeded
34 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 212 KB Output is correct
2 Correct 0 ms 212 KB Output is correct
3 Correct 0 ms 212 KB Output is correct
4 Correct 0 ms 212 KB Output is correct
5 Correct 0 ms 212 KB Output is correct
6 Correct 0 ms 212 KB Output is correct
7 Correct 0 ms 212 KB Output is correct
8 Correct 0 ms 212 KB Output is correct
9 Correct 0 ms 212 KB Output is correct
10 Correct 0 ms 212 KB Output is correct
11 Correct 0 ms 212 KB Output is correct
12 Correct 0 ms 340 KB Output is correct
13 Correct 0 ms 212 KB Output is correct
14 Correct 0 ms 212 KB Output is correct
15 Correct 0 ms 212 KB Output is correct
16 Correct 0 ms 212 KB Output is correct
17 Correct 0 ms 212 KB Output is correct
18 Correct 0 ms 212 KB Output is correct
19 Correct 0 ms 212 KB Output is correct
20 Correct 0 ms 212 KB Output is correct
21 Correct 0 ms 212 KB Output is correct
22 Correct 0 ms 212 KB Output is correct
23 Correct 15 ms 324 KB Output is correct
24 Correct 15 ms 212 KB Output is correct
25 Correct 18 ms 328 KB Output is correct
26 Correct 19 ms 212 KB Output is correct
27 Correct 13 ms 340 KB Output is correct
28 Correct 15 ms 332 KB Output is correct
29 Correct 15 ms 324 KB Output is correct
30 Correct 16 ms 340 KB Output is correct
31 Correct 5 ms 212 KB Output is correct
32 Correct 11 ms 328 KB Output is correct
33 Execution timed out 1574 ms 14284 KB Time limit exceeded
34 Halted 0 ms 0 KB -