답안 #572023

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
572023 2022-06-03T10:59:55 Z beaconmc 말 (IOI15_horses) C++14
0 / 100
1500 ms 14176 KB
#include <bits/stdc++.h>
#pragma GCC optimize("O3")
typedef long long ll;

#define FOR(i,x,y) for(ll i=x; i<y; i++)
#define FORNEG(i,x,y) for(ll i=x; i>y; i--)
#define double long double

// #include "horses.h"
using namespace std;


vector<ll> x, y, xx, yy;
ll n;


int solve(){
	ll maxsum = 1;
	ll maxpos = -1;
	ll cur = 1;

	FOR(i,0,n){
		cur *= x[i];
		if (y[i] * cur >= maxsum){
			cur = 1;
			maxsum = y[i];
			maxpos = i;
		}
	}

	ll maxi = 1;
	FOR(i,0,maxpos){
		maxi *= x[i];
		maxi %= 1000000007;
	}


	return maxi * maxsum % 1000000007;

}

int init(int N, int X[], int Y[]) {
	n = N;
	FOR(i,0,N){
		x.push_back(X[i]);
		y.push_back(Y[i]);
	}
	return solve();

}

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

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

}



// int main(){
// 	ll n = 10;
// 	int x[10] = {10, 10, 10, 10, 10, 10, 1, 1, 1, 1};
// 	int y[10] = {1, 1, 1, 1, 9, 5, 4, 7, 3, 2};

// 	cout << init(n, x, y) << endl;

// 	cout << updateX(5, 1) << endl;
// 	cout << updateY(5, 123456789) << endl;
// 	cout << updateX(5, 1) << endl;
// 	cout << updateX(8, 987654321) << endl;


// }

Compilation message

horses.cpp: In function 'int solve()':
horses.cpp:38:23: warning: conversion from 'll' {aka 'long long int'} to 'int' may change value [-Wconversion]
   38 |  return maxi * maxsum % 1000000007;
      |         ~~~~~~~~~~~~~~^~~~~~~~~~~~
# 결과 실행 시간 메모리 Grader output
1 Incorrect 1 ms 212 KB Output isn't correct
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 1 ms 212 KB Output isn't correct
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Execution timed out 1559 ms 14176 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 0 ms 212 KB Output isn't correct
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 1 ms 212 KB Output isn't correct
2 Halted 0 ms 0 KB -