# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
708271 | 2023-03-11T13:40:42 Z | Alihan_8 | Horses (IOI15_horses) | C++17 | 1500 ms | 10196 KB |
#include <bits/stdc++.h> #include "horses.h" #define Flag false // include <ext/pb_ds/assoc_container.hpp> // include <ext/pb_ds/tree_policy.hpp> // using namespace __gnu_pbds; using namespace std; #define all(x) x.begin(), x.end() #define pb push_back // define ordered_set tree<int,null_type,less<int>,rb_tree_tag,tree_order_statistics_node_update> #define mpr make_pair #define ln '\n' void IO(string name){freopen((name+".in").c_str(),"r",stdin); freopen((name+".out").c_str(),"w",stdout);} //#define int long long typedef long long ll; const ll Mod = 1e9+7; vector <int> x, y; bool chmax(int &x, int y){ bool flag = false; if ( x < y ){ x = y; flag |= true; } return flag; } int F(){ int n = (int)x.size(), it = 0; auto large = [&](int pos){ int val = y[it]; val /= y[pos]; for ( int i = it+1; i <= pos; i++ ){ val /= x[i]; } return !val; }; for ( int i = 1; i < n; i++ ){ if ( large(i) ) it = i; } ll res = 1; for ( int i = 0; i <= it; i++ ) res = res*x[i]%Mod; return res*y[it]%Mod; } int init(int N, int X[], int Y[]){ int n = N; x.resize(n), y.resize(n); for ( int i = 0; i < n; i++ ){ x[i] = X[i], y[i] = Y[i]; } return F(); } int updateX(int pos, int val){ x[pos] = val; return F(); } int updateY(int pos, int val){ y[pos] = val; return F(); } #if Flag signed main(){ ios_base::sync_with_stdio(false); cin.tie(NULL); int n; cin >> n; int X[n], Y[n]; for ( int i = 0; i < n; i++ ) cin >> X[i]; for ( int i = 0; i < n; i++ ) cin >> Y[i]; cout << init(n, X, Y) << ln; int q; cin >> q; while ( q-- ){ int type, l, r; cin >> type >> l >> r; if ( type == 1 ) cout << updateX(l, r) << ln; else cout << updateY(l, r) << ln; } cout << '\n'; /* 3 2 1 3 3 4 1 1 2 1 2 answer: {8, 6} */ } #endif
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 212 KB | Output is correct |
2 | Correct | 1 ms | 212 KB | Output is correct |
3 | Correct | 1 ms | 212 KB | Output is correct |
4 | Correct | 0 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 | 1 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 | 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 | 1 ms | 300 KB | Output is correct |
15 | Correct | 1 ms | 304 KB | Output is correct |
16 | Correct | 1 ms | 212 KB | Output is correct |
17 | Correct | 1 ms | 212 KB | Output is correct |
18 | Correct | 1 ms | 212 KB | Output is correct |
19 | Correct | 1 ms | 212 KB | Output is correct |
20 | Correct | 1 ms | 212 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 212 KB | Output is correct |
2 | Correct | 1 ms | 212 KB | Output is correct |
3 | Correct | 1 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 | 1 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 | 1 ms | 340 KB | Output is correct |
12 | Correct | 1 ms | 212 KB | Output is correct |
13 | Correct | 1 ms | 212 KB | Output is correct |
14 | Correct | 1 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 | 1 ms | 212 KB | Output is correct |
18 | Correct | 1 ms | 212 KB | Output is correct |
19 | Correct | 1 ms | 212 KB | Output is correct |
20 | Correct | 1 ms | 212 KB | Output is correct |
21 | Correct | 0 ms | 212 KB | Output is correct |
22 | Correct | 1 ms | 212 KB | Output is correct |
23 | Correct | 76 ms | 320 KB | Output is correct |
24 | Correct | 52 ms | 316 KB | Output is correct |
25 | Correct | 16 ms | 352 KB | Output is correct |
26 | Correct | 15 ms | 352 KB | Output is correct |
27 | Correct | 1144 ms | 316 KB | Output is correct |
28 | Correct | 17 ms | 212 KB | Output is correct |
29 | Correct | 1113 ms | 312 KB | Output is correct |
30 | Correct | 396 ms | 324 KB | Output is correct |
31 | Execution timed out | 1582 ms | 212 KB | Time limit exceeded |
32 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Execution timed out | 1562 ms | 10196 KB | Time limit exceeded |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 0 ms | 212 KB | Output is correct |
2 | Correct | 1 ms | 212 KB | Output is correct |
3 | Correct | 0 ms | 212 KB | Output is correct |
4 | Correct | 0 ms | 212 KB | Output is correct |
5 | Correct | 1 ms | 212 KB | Output is correct |
6 | Correct | 0 ms | 212 KB | Output is correct |
7 | Correct | 0 ms | 212 KB | Output is correct |
8 | Correct | 0 ms | 212 KB | Output is correct |
9 | Correct | 0 ms | 212 KB | Output is correct |
10 | Correct | 0 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 | 0 ms | 212 KB | Output is correct |
17 | Correct | 1 ms | 212 KB | Output is correct |
18 | Correct | 1 ms | 212 KB | Output is correct |
19 | Correct | 1 ms | 212 KB | Output is correct |
20 | Correct | 1 ms | 212 KB | Output is correct |
21 | Correct | 1 ms | 212 KB | Output is correct |
22 | Correct | 1 ms | 212 KB | Output is correct |
23 | Correct | 74 ms | 316 KB | Output is correct |
24 | Correct | 53 ms | 316 KB | Output is correct |
25 | Correct | 15 ms | 352 KB | Output is correct |
26 | Correct | 16 ms | 340 KB | Output is correct |
27 | Correct | 1150 ms | 320 KB | Output is correct |
28 | Correct | 17 ms | 340 KB | Output is correct |
29 | Correct | 1067 ms | 312 KB | Output is correct |
30 | Correct | 400 ms | 324 KB | Output is correct |
31 | Execution timed out | 1565 ms | 212 KB | Time limit exceeded |
32 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 336 KB | Output is correct |
2 | Correct | 0 ms | 212 KB | Output is correct |
3 | Correct | 0 ms | 212 KB | Output is correct |
4 | Correct | 0 ms | 212 KB | Output is correct |
5 | Correct | 0 ms | 212 KB | Output is correct |
6 | Correct | 0 ms | 212 KB | Output is correct |
7 | Correct | 0 ms | 212 KB | Output is correct |
8 | Correct | 1 ms | 212 KB | Output is correct |
9 | Correct | 0 ms | 212 KB | Output is correct |
10 | Correct | 0 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 | 1 ms | 212 KB | Output is correct |
15 | Correct | 0 ms | 212 KB | Output is correct |
16 | Correct | 0 ms | 212 KB | Output is correct |
17 | Correct | 0 ms | 212 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 | Correct | 1 ms | 212 KB | Output is correct |
22 | Correct | 1 ms | 212 KB | Output is correct |
23 | Correct | 73 ms | 312 KB | Output is correct |
24 | Correct | 57 ms | 212 KB | Output is correct |
25 | Correct | 18 ms | 340 KB | Output is correct |
26 | Correct | 16 ms | 340 KB | Output is correct |
27 | Correct | 1148 ms | 312 KB | Output is correct |
28 | Correct | 16 ms | 336 KB | Output is correct |
29 | Correct | 1051 ms | 308 KB | Output is correct |
30 | Correct | 405 ms | 324 KB | Output is correct |
31 | Execution timed out | 1550 ms | 212 KB | Time limit exceeded |
32 | Halted | 0 ms | 0 KB | - |