제출 #592219

#제출 시각아이디문제언어결과실행 시간메모리
592219l_reho말 (IOI15_horses)C++14
17 / 100
1567 ms8148 KiB


#include <bits/stdc++.h>
using namespace std;

vector<int> A, B;
int L;

long long MOD = 1000000007;

long long modMult(long long a, long long b){
	a %= MOD;
	b %= MOD;
	
	return ((a%MOD)*(b%MOD))%MOD;
}



long long test(){
	
	long long curr = 1;
	long long best = 0;
	
	for(int i = 0; i < L; i++){
		curr = modMult(curr, A[i]);
		if(modMult(curr, B[i]) > best)
			best = modMult(curr, B[i]);
	}
	
	return best;
}

int init(int N, int X[], int Y[]) {
	A.assign(N, 0);
	B.assign(N, 0);
	L = N;
	
	for(int i = 0; i < N; i++) A[i] = X[i], B[i] = Y[i];
	
	
	return test();
}

int updateX(int pos, int val) {
	A[pos] = val;
	return test();
}

int updateY(int pos, int val) {
	B[pos] = val;
	return test();
}

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

horses.cpp: In function 'int init(int, int*, int*)':
horses.cpp:42:13: warning: conversion from 'long long int' to 'int' may change value [-Wconversion]
   42 |  return test();
      |         ~~~~^~
horses.cpp: In function 'int updateX(int, int)':
horses.cpp:47:13: warning: conversion from 'long long int' to 'int' may change value [-Wconversion]
   47 |  return test();
      |         ~~~~^~
horses.cpp: In function 'int updateY(int, int)':
horses.cpp:52:13: warning: conversion from 'long long int' to 'int' may change value [-Wconversion]
   52 |  return test();
      |         ~~~~^~
#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...