|
| 1 | +// https://www.codechef.com/EXPP2019/problems/EXUND |
| 2 | + |
| 3 | +/* |
| 4 | + C++ |
| 5 | + encoding: UTF-8 |
| 6 | + Modified: <11/Oct/2019 10:08:44 PM> |
| 7 | +
|
| 8 | + ✪ H4WK3yE乡 |
| 9 | + Mohd. Farhan Tahir |
| 10 | + Indian Institute Of Information Technology (IIIT), Gwalior |
| 11 | +*/ |
| 12 | + |
| 13 | +#include <bits/stdc++.h> |
| 14 | +#ifdef LOCAL_PROJECT |
| 15 | +# include <prettypr.hpp> |
| 16 | +#endif |
| 17 | + |
| 18 | +using namespace std; |
| 19 | + |
| 20 | +// clang-format off |
| 21 | + |
| 22 | +#define ll long long |
| 23 | +#define ve vector |
| 24 | +#define pb push_back |
| 25 | +#define endl "\n" |
| 26 | +#define ff first |
| 27 | +#define ss second |
| 28 | +#define pii pair<int, int> |
| 29 | +#define len(v) int(v.size()) |
| 30 | +#define all(v) v.begin(), v.end() |
| 31 | +#define reset(a, b) memset(a, b, sizeof(a)); |
| 32 | +#define fr(i, s, n) for (int i = s ; i < n ; ++i) |
| 33 | +#define dfr(i, s, n) for (int i = s ; i > n ; --i) |
| 34 | + |
| 35 | +template < typename T > void pr (const T& t) { |
| 36 | + cout << t << "\n"; |
| 37 | +} |
| 38 | + |
| 39 | +template < typename T, typename U, typename... ARGS > |
| 40 | +void pr (const T& t, const U& u, const ARGS&... args) { |
| 41 | + cout << t << " "; |
| 42 | + pr (u, args...); |
| 43 | +} |
| 44 | + |
| 45 | +// clang-format on |
| 46 | + |
| 47 | +const int N = 1e6 + 5; |
| 48 | +int arr[N], s[N], tree[4 * N], lazy[4 * N]; |
| 49 | +int n, q; |
| 50 | + |
| 51 | +signed main () { |
| 52 | + ios_base::sync_with_stdio (false), cin.tie (nullptr); |
| 53 | + cin >> n >> q; |
| 54 | + fr (i, 1, n + 1) cin >> arr[i]; |
| 55 | + int c = 1; |
| 56 | + s[1] = 1; |
| 57 | + fr (i, 2, n + 1) { |
| 58 | + if (arr[i] % arr[i - 1]) continue; |
| 59 | + } |
| 60 | + while (q--) { |
| 61 | + int t; |
| 62 | + cin >> t; |
| 63 | + if (t == 1) { |
| 64 | + int idx, x; |
| 65 | + cin >> idx >> x; |
| 66 | + } else { |
| 67 | + int idx; |
| 68 | + cin >> idx; |
| 69 | + pr (idx); |
| 70 | + } |
| 71 | + } |
| 72 | + return 0; |
| 73 | +} |
0 commit comments