제출 #552852

#제출 시각아이디문제언어결과실행 시간메모리
552852elazarkoren말 (IOI15_horses)C++17
17 / 100
1535 ms14352 KiB
#include "horses.h"
#include <bits/stdc++.h>
#define x first
#define y second
#define all(v) v.begin(), v.end()
#define chkmin(a, b) a = min(a, b)
#define chkmax(a, b) a = max(a, b)
using namespace std;
typedef long long ll;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef pair<int, int> pii;
typedef vector<pii> vii;

const int MAX_N = 5e5 + 5;
const int mod = 1e9 + 7;

int n;
ll x[MAX_N], y[MAX_N];

int Solve() {
    ll ans = 0;
    ll cnt = 1;
    for (int i = 0; i < n; i++) {
        cnt *= x[i];
        chkmax(ans, y[i] * cnt);
    }
    return ans % mod;
}

int init(int N, int X[], int Y[]) {
    n = N;
    for (int i = 0; i < n; i++) {
        x[i] = X[i], y[i] = Y[i];
    }
    return Solve();
}

int updateX(int pos, int val) {
    x[pos] = val;
    return Solve();
}

int updateY(int pos, int val) {
    y[pos] = val;
    return Solve();
}

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

horses.cpp: In function 'int Solve()':
horses.cpp:28:16: warning: conversion from 'll' {aka 'long long int'} to 'int' may change value [-Wconversion]
   28 |     return ans % mod;
      |            ~~~~^~~~~
#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...