제출 #1191994

#제출 시각아이디문제언어결과실행 시간메모리
1191994nagorn_ph말 (IOI15_horses)C++20
17 / 100
7 ms4420 KiB
#include <bits/stdc++.h> #include "horses.h" using namespace std; const int mod = 1e9 + 7; int nn; vector <int> a(1005), b(1005); int init(int n, int x[], int y[]) { nn = n; for (int i = 0; i < n; i++) { a[i] = x[i]; b[i] = y[i]; } long long idx = 0, xx = 1, yy = 0; for (int i = 0; i < nn; i++) { xx *= a[i]; if (xx * b[i] >= yy) { yy = b[i]; idx = i; xx = 1; } } int ans = b[idx]; for (int i = 0; i <= idx; i++) { ans *= a[i]; ans %= mod; } return ans; } int updateX(int pos, int val) { a[pos] = val; long long idx = 0, xx = 1, yy = 0; for (int i = 0; i < nn; i++) { xx *= a[i]; if (xx * b[i] >= yy) { yy = b[i]; idx = i; xx = 1; } } int ans = b[idx]; for (int i = 0; i <= idx; i++) { ans *= a[i]; ans %= mod; } return ans; } int updateY(int pos, int val) { b[pos] = val; long long idx = 0, xx = 1, yy = 0; for (int i = 0; i < nn; i++) { xx *= a[i]; if (xx * b[i] >= yy) { yy = b[i]; idx = i; xx = 1; } } int ans = b[idx]; for (int i = 0; i <= idx; i++) { ans *= a[i]; ans %= mod; } return ans; }
#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...