답안 #831047

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
831047 2023-08-19T15:58:15 Z skittles1412 말 (IOI15_horses) C++17
17 / 100
24 ms 14164 KB
#include "bits/extc++.h"

using namespace std;

template <typename T, typename... U>
void dbgh(const T& t, const U&... u) {
    cerr << t;
    ((cerr << " | " << u), ...);
    cerr << endl;
}

#ifdef DEBUG
#define dbg(...)                                              \
    cerr << "L" << __LINE__ << " [" << #__VA_ARGS__ << "]: "; \
    dbgh(__VA_ARGS__)
#else
#define dbg(...)
#define cerr   \
    if (false) \
    cerr
#endif

#define endl "\n"
#define long int64_t
#define sz(x) int(std::size(x))

struct Solver {
    vector<int> arr_x, arr_y;
    Solver() {}
    Solver(const vector<int>& arr_x, const vector<int>& arr_y)
        : arr_x(arr_x), arr_y(arr_y) {}

    int query() {
        int n = sz(arr_x);

        int ans = 0;

        for (int i = 0, mul = 1; i < n; i++) {
            mul *= arr_x[i];
            ans = max(ans, mul * arr_y[i]);
        }

        return ans;
    }
} solver;

int init(int n, int arr_x[], int arr_y[]) {
    solver =
        Solver(vector<int>(arr_x, arr_x + n), vector<int>(arr_y, arr_y + n));
    return solver.query();
}

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

Compilation message

horses.cpp: In constructor 'Solver::Solver(const std::vector<int>&, const std::vector<int>&)':
horses.cpp:30:57: warning: declaration of 'arr_y' shadows a member of 'Solver' [-Wshadow]
   30 |     Solver(const vector<int>& arr_x, const vector<int>& arr_y)
      |                                      ~~~~~~~~~~~~~~~~~~~^~~~~
horses.cpp:28:24: note: shadowed declaration is here
   28 |     vector<int> arr_x, arr_y;
      |                        ^~~~~
horses.cpp:30:31: warning: declaration of 'arr_x' shadows a member of 'Solver' [-Wshadow]
   30 |     Solver(const vector<int>& arr_x, const vector<int>& arr_y)
      |            ~~~~~~~~~~~~~~~~~~~^~~~~
horses.cpp:28:17: note: shadowed declaration is here
   28 |     vector<int> arr_x, arr_y;
      |                 ^~~~~
horses.cpp: In constructor 'Solver::Solver(const std::vector<int>&, const std::vector<int>&)':
horses.cpp:30:57: warning: declaration of 'arr_y' shadows a member of 'Solver' [-Wshadow]
   30 |     Solver(const vector<int>& arr_x, const vector<int>& arr_y)
      |                                      ~~~~~~~~~~~~~~~~~~~^~~~~
horses.cpp:28:24: note: shadowed declaration is here
   28 |     vector<int> arr_x, arr_y;
      |                        ^~~~~
horses.cpp:30:31: warning: declaration of 'arr_x' shadows a member of 'Solver' [-Wshadow]
   30 |     Solver(const vector<int>& arr_x, const vector<int>& arr_y)
      |            ~~~~~~~~~~~~~~~~~~~^~~~~
horses.cpp:28:17: note: shadowed declaration is here
   28 |     vector<int> arr_x, arr_y;
      |                 ^~~~~
horses.cpp: In constructor 'Solver::Solver(const std::vector<int>&, const std::vector<int>&)':
horses.cpp:30:57: warning: declaration of 'arr_y' shadows a member of 'Solver' [-Wshadow]
   30 |     Solver(const vector<int>& arr_x, const vector<int>& arr_y)
      |                                      ~~~~~~~~~~~~~~~~~~~^~~~~
horses.cpp:28:24: note: shadowed declaration is here
   28 |     vector<int> arr_x, arr_y;
      |                        ^~~~~
horses.cpp:30:31: warning: declaration of 'arr_x' shadows a member of 'Solver' [-Wshadow]
   30 |     Solver(const vector<int>& arr_x, const vector<int>& arr_y)
      |            ~~~~~~~~~~~~~~~~~~~^~~~~
horses.cpp:28:17: note: shadowed declaration is here
   28 |     vector<int> arr_x, arr_y;
      |                 ^~~~~
horses.cpp: In function 'int updateX(int, int)':
horses.cpp:53:17: warning: unused parameter 'pos' [-Wunused-parameter]
   53 | int updateX(int pos, int val) {
      |             ~~~~^~~
horses.cpp:53:26: warning: unused parameter 'val' [-Wunused-parameter]
   53 | int updateX(int pos, int val) {
      |                      ~~~~^~~
horses.cpp: In function 'int updateY(int, int)':
horses.cpp:56:17: warning: unused parameter 'pos' [-Wunused-parameter]
   56 | int updateY(int pos, int val) {
      |             ~~~~^~~
horses.cpp:56:26: warning: unused parameter 'val' [-Wunused-parameter]
   56 | int updateY(int pos, int val) {
      |                      ~~~~^~~
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 212 KB Output is correct
2 Correct 1 ms 296 KB Output is correct
3 Correct 1 ms 296 KB Output is correct
4 Correct 0 ms 212 KB Output is correct
5 Correct 0 ms 300 KB Output is correct
6 Correct 1 ms 300 KB Output is correct
7 Correct 0 ms 212 KB Output is correct
8 Correct 1 ms 296 KB Output is correct
9 Correct 1 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 0 ms 212 KB Output is correct
15 Correct 1 ms 212 KB Output is correct
16 Correct 0 ms 300 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 0 ms 212 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 300 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 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 292 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 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 1 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 -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 24 ms 14164 KB Output isn't correct
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 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 1 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 1 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 212 KB Output is correct
13 Correct 1 ms 340 KB Output is correct
14 Correct 1 ms 296 KB Output is correct
15 Correct 0 ms 304 KB Output is correct
16 Correct 0 ms 212 KB Output is correct
17 Correct 0 ms 300 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 -
# 결과 실행 시간 메모리 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 300 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 1 ms 212 KB Output is correct
11 Correct 1 ms 304 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 300 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 300 KB Output is correct
21 Incorrect 0 ms 212 KB Output isn't correct
22 Halted 0 ms 0 KB -