Submission #1030257

# Submission time Handle Problem Language Result Execution time Memory
1030257 2024-07-22T01:32:31 Z pcc Horses (IOI15_horses) C++17
0 / 100
12 ms 10576 KB
#include "horses.h"
#include <bits/stdc++.h>
using namespace std;

#define ll long long
#define pll pair<ll,ll>
#define fs first
#define sc second
const ll mod = 1e9+7;
const ll mxn = 1010;

ll suf[mxn];
ll N;
ll arr[mxn],brr[mxn];


int init(int NN, int X[], int Y[]) {
	N = NN;
	for(int i = 0;i<N;i++){
		arr[i] = X[i];
		brr[i] = Y[i];
	}
	suf[N-1] = arr[N-1];
	for(int i = N-2;i>=0;i--)suf[i] = suf[i+1]*arr[i];
	vector<int> v(N);
	iota(v.begin(),v.end(),0);
	sort(v.begin(),v.end(),[](int a,int b){return suf[a]*arr[a]<suf[b]*arr[b];});
	ll tar = v.back();
	ll ans = 1;
	for(int i = 0;i<=tar;i++)ans *= arr[i];
	return (ans*brr[tar])%mod;
}

int updateX(int pos, int val) {	
	return 0;
}

int updateY(int pos, int val) {
	return 0;
}

Compilation message

horses.cpp: In function 'int init(int, int*, int*)':
horses.cpp:24:15: warning: conversion from 'long long int' to 'int' may change value [-Wconversion]
   24 |  for(int i = N-2;i>=0;i--)suf[i] = suf[i+1]*arr[i];
      |              ~^~
horses.cpp:31:23: warning: conversion from 'long long int' to 'int' may change value [-Wconversion]
   31 |  return (ans*brr[tar])%mod;
      |         ~~~~~~~~~~~~~~^~~~
horses.cpp: In function 'int updateX(int, int)':
horses.cpp:34:17: warning: unused parameter 'pos' [-Wunused-parameter]
   34 | int updateX(int pos, int val) {
      |             ~~~~^~~
horses.cpp:34:26: warning: unused parameter 'val' [-Wunused-parameter]
   34 | int updateX(int pos, int val) {
      |                      ~~~~^~~
horses.cpp: In function 'int updateY(int, int)':
horses.cpp:38:17: warning: unused parameter 'pos' [-Wunused-parameter]
   38 | int updateY(int pos, int val) {
      |             ~~~~^~~
horses.cpp:38:26: warning: unused parameter 'val' [-Wunused-parameter]
   38 | int updateY(int pos, int val) {
      |                      ~~~~^~~
# Verdict Execution time Memory Grader output
1 Correct 0 ms 344 KB Output is correct
2 Incorrect 1 ms 344 KB Output isn't correct
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 0 ms 348 KB Output is correct
2 Incorrect 0 ms 348 KB Output isn't correct
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 12 ms 10576 KB Execution killed with signal 11
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 0 ms 348 KB Output is correct
2 Incorrect 0 ms 348 KB Output isn't correct
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 0 ms 348 KB Output is correct
2 Incorrect 0 ms 348 KB Output isn't correct
3 Halted 0 ms 0 KB -