제출 #1245589

#제출 시각아이디문제언어결과실행 시간메모리
1245589santi3223말 (IOI15_horses)C++20
17 / 100
1593 ms8280 KiB
#include <bits/stdc++.h> #include "horses.h" using namespace std; #define ll long long #define vb vector<bool> #define pb push_back #define ff(aa, bb, cc) for(int aa = bb; aa < cc; aa++) #define vl vector<ll> #define pll pair<ll, ll> #define fi first #define se second #define ed "\n" #define all(aaa) aaa.begin(), aaa.end() #define rall(aaa) aaa.rbegin(), aaa.rend() ll MOD = 1e9+7; vector<int> X, Y; int n; int init(int N, int x[], int y[]){ n = N; X = vector<int>(n); Y = vector<int>(n); ff(i, 0, n){ X[i] = x[i]; Y[i] = y[i]; } ll prev = 1, maxx = 0; ff(i, 0, n){ //cout << i << " | " << prev << " " << maxx << ed; prev *= X[i]; maxx = max(maxx, prev*Y[i]); maxx %= MOD; prev %= MOD; } return maxx; } int updateX(int pos, int val) { X[pos] = val; ll prev = 1, maxx = 0; //cout << X.size() << " " << Y.size() << ed; ff(i, 0, n){ //cout << prev << " " << maxx << ed; prev *= X[i]; ll a = prev*Y[i]; maxx = max(maxx, a); } return maxx%MOD; } int updateY(int pos, int val){ Y[pos] = val; ll prev = 1, maxx = 0; ff(i, 0, n){ prev *= X[i]; ll a = prev*Y[i]; maxx = max(maxx, a); } return maxx%MOD; } /* int main() { int N; cin >> N; int XX[N], YY[N]; ff(i, 0, N){ cin >> XX[i]; } ff(i, 0, N){ cin >> YY[i]; } //cout << "IN " << N << ed; cout << init(N, XX, YY) << ed; int M; cin >> M; ff(i, 0, M){ int a, b, c; cin >> a >> b >> c; if(a == 1){ cout << updateX(b, c) << ed; } else if(a == 2){ cout << updateY(b, c) << ed; } } return 0; } */
#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...