제출 #348801

#제출 시각아이디문제언어결과실행 시간메모리
348801Sprdalo말 (IOI15_horses)C++17
0 / 100
24 ms16364 KiB
#include <bits/stdc++.h>

using namespace std;

typedef long long ll;
typedef long double ld;
typedef pair<int, int> pi;
typedef pair<ll, ll> pl;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef vector<double> vd;
typedef vector<bool> vb;
typedef vector<char> vc;
typedef vector<string> vs;
typedef vector<pi> vp;
typedef vector<pl> vpl;

const int mod = 1e9 + 7;

void f(ll& x){
    if (x >= mod)
        x %= mod;
}

ll g(ll x){
    f(x);
    return x;
}

vi x, y;
int n;

int solve(){
    ll sol = 0, s = 1;
    for (int i = 0; i < n; ++i){
        s *= x[i];
        f(s);
        sol = max(sol, g(s * y[i]));
    }
}

int init(int N, int X[], int Y[]){
    n = N;
    x = vi(n); y = vi(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();
}
/*
int main()
{
    ios_base::sync_with_stdio(false); 
    cin.tie(nullptr); 
    cout.tie(nullptr); 
    cerr.tie(nullptr);    

    int n;
    cin >> n;

    int x[n], y[n];
    for (int i = 0; i < n; ++i)
        cin >> x[i] >> y[i];

    cout << init(n,x,y) << '\n';
}*/

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

horses.cpp: In function 'int solve()':
horses.cpp:40:1: warning: no return statement in function returning non-void [-Wreturn-type]
   40 | }
      | ^
#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...