답안 #594448

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
594448 2022-07-12T13:08:55 Z davi_bart 말 (IOI15_horses) C++14
17 / 100
1500 ms 14436 KB
#pragma GCC optimize("O3")
#include <bits/stdc++.h>

#include "horses.h"
using namespace std;
#define ll long long
#define int ll
#define fi first
#define se second
#define ld long double
#define pb push_back
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
static const int mod = 1e9 + 7;
vector<int> X, Y;
int N;
int calc() {
    int ma = 0;
    int cur = 1;
    for (int i = 0; i < N; i++) {
        cur *= X[i];
        ma = max(ma, cur * Y[i] % mod);
    }
    return ma;
}
signed init(signed N, signed x[], signed y[]) {
    ::N = N;
    for (int i = 0; i < N; i++) {
        X.pb(x[i]);
        Y.pb(y[i]);
    }
    return calc();
}

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

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

Compilation message

horses.cpp: In function 'int init(int, int*, int*)':
horses.cpp:25:20: warning: declaration of 'N' shadows a global declaration [-Wshadow]
   25 | signed init(signed N, signed x[], signed y[]) {
      |             ~~~~~~~^
horses.cpp:15:5: note: shadowed declaration is here
   15 | int N;
      |     ^
horses.cpp:31:16: warning: conversion from 'long long int' to 'int' may change value [-Wconversion]
   31 |     return calc();
      |            ~~~~^~
horses.cpp: In function 'int updateX(int, int)':
horses.cpp:36:16: warning: conversion from 'long long int' to 'int' may change value [-Wconversion]
   36 |     return calc();
      |            ~~~~^~
horses.cpp: In function 'int updateY(int, int)':
horses.cpp:41:16: warning: conversion from 'long long int' to 'int' may change value [-Wconversion]
   41 |     return calc();
      |            ~~~~^~
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 212 KB Output is correct
2 Correct 0 ms 312 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 304 KB Output is correct
7 Correct 0 ms 212 KB Output is correct
8 Correct 1 ms 308 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 212 KB Output is correct
12 Correct 1 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 1 ms 212 KB Output is correct
17 Correct 0 ms 308 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 312 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 212 KB Output is correct
2 Correct 1 ms 212 KB Output is correct
3 Correct 0 ms 304 KB Output is correct
4 Correct 0 ms 212 KB Output is correct
5 Correct 1 ms 304 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 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 0 ms 212 KB Output is correct
16 Correct 0 ms 340 KB Output is correct
17 Correct 0 ms 304 KB Output is correct
18 Correct 1 ms 304 KB Output is correct
19 Correct 1 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 Execution timed out 1572 ms 14436 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 308 KB Output is correct
2 Correct 1 ms 212 KB Output is correct
3 Correct 1 ms 304 KB Output is correct
4 Correct 0 ms 212 KB Output is correct
5 Correct 1 ms 308 KB Output is correct
6 Correct 1 ms 212 KB Output is correct
7 Correct 1 ms 212 KB Output is correct
8 Correct 1 ms 304 KB Output is correct
9 Correct 0 ms 308 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 0 ms 212 KB Output is correct
14 Correct 1 ms 212 KB Output is correct
15 Correct 0 ms 212 KB Output is correct
16 Correct 1 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 1 ms 212 KB Output is correct
20 Correct 0 ms 304 KB Output is correct
21 Incorrect 0 ms 212 KB Output isn't correct
22 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 304 KB Output is correct
2 Correct 0 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 1 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 308 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 308 KB Output is correct
12 Correct 0 ms 308 KB Output is correct
13 Correct 0 ms 308 KB Output is correct
14 Correct 1 ms 212 KB Output is correct
15 Correct 1 ms 304 KB Output is correct
16 Correct 0 ms 212 KB Output is correct
17 Correct 1 ms 304 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 -