Submission #795284

# Submission time Handle Problem Language Result Execution time Memory
795284 2023-07-27T08:06:15 Z Josia Horses (IOI15_horses) C++17
17 / 100
1500 ms 12040 KB
#include "horses.h"
#include <bits/stdc++.h>

using namespace std;

#define ll long long
#define int long long

const ll mod = 1e9+7;

int N;
vector<ll> X, Y;

struct getSol {
	int sol = 0;

	getSol() {
        int currProd = 1;
		for (int i = 0; i<N; i++) {
            currProd *= X[i];
            if (currProd * Y[i] > sol) sol = currProd*Y[i];
        }
	}
};




signed init(signed _N, signed _X[], signed _Y[]) {
	N = _N;
	X.resize(N);
	Y.resize(N);
	for (int i = 0; i<N; i++) X[i] = _X[i];
	for (int i = 0; i<N; i++) Y[i] = _Y[i];

	return getSol().sol;
}

signed updateX(signed pos, signed val) {
	X[pos] = val;

	return getSol().sol;
}

signed updateY(signed pos, signed val) {
	Y[pos] = val;

	return getSol().sol;
}

Compilation message

horses.cpp: In function 'int init(int, int*, int*)':
horses.cpp:36:18: warning: conversion from 'long long int' to 'int' may change value [-Wconversion]
   36 |  return getSol().sol;
      |         ~~~~~~~~~^~~
horses.cpp: In function 'int updateX(int, int)':
horses.cpp:42:18: warning: conversion from 'long long int' to 'int' may change value [-Wconversion]
   42 |  return getSol().sol;
      |         ~~~~~~~~~^~~
horses.cpp: In function 'int updateY(int, int)':
horses.cpp:48:18: warning: conversion from 'long long int' to 'int' may change value [-Wconversion]
   48 |  return getSol().sol;
      |         ~~~~~~~~~^~~
# Verdict Execution time Memory 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 1 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 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 1 ms 212 KB Output is correct
14 Correct 1 ms 212 KB Output is correct
15 Correct 1 ms 212 KB Output is correct
16 Correct 0 ms 212 KB Output is correct
17 Correct 1 ms 212 KB Output is correct
18 Correct 0 ms 212 KB Output is correct
19 Correct 1 ms 296 KB Output is correct
20 Correct 0 ms 300 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 0 ms 212 KB Output is correct
2 Correct 0 ms 212 KB Output is correct
3 Correct 1 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 1 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 1 ms 296 KB Output is correct
13 Correct 1 ms 212 KB Output is correct
14 Correct 0 ms 296 KB Output is correct
15 Correct 1 ms 212 KB Output is correct
16 Correct 0 ms 212 KB Output is correct
17 Correct 1 ms 212 KB Output is correct
18 Correct 1 ms 212 KB Output is correct
19 Correct 1 ms 212 KB Output is correct
20 Correct 1 ms 212 KB Output is correct
21 Incorrect 0 ms 212 KB Output isn't correct
22 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 1556 ms 12040 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory 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 1 ms 212 KB Output is correct
7 Correct 1 ms 296 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 212 KB Output is correct
11 Correct 1 ms 304 KB Output is correct
12 Correct 1 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 1 ms 296 KB Output is correct
16 Correct 1 ms 292 KB Output is correct
17 Correct 1 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 1 ms 212 KB Output is correct
21 Incorrect 1 ms 212 KB Output isn't correct
22 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 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 296 KB Output is correct
8 Correct 1 ms 296 KB Output is correct
9 Correct 1 ms 212 KB Output is correct
10 Correct 0 ms 296 KB Output is correct
11 Correct 0 ms 212 KB Output is correct
12 Correct 1 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 Incorrect 0 ms 212 KB Output isn't correct
22 Halted 0 ms 0 KB -