This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
//記得跳題
#pragma GCC optimize("O3,unroll_loops")
#pragma GCC target("avx2")
#include<iostream>
#include<array>
#include<vector>
#include<string>
#include<algorithm>
#include<set>
#include<queue>
#include<stack>
#include<math.h>
#include<map>
#include<unordered_map>
#include<unordered_set>
#include<cstring>
#include<iomanip>
#include<bitset>
#include<tuple>
#include<random>
using namespace std;
#define ll long long
#define FOR(i,a,b) for(int i=a;i<b;i++)
#define REP(i,a,b) for(int i=a;i>=b;i--)
#define INF (ll)(4e18)
#define pb push_back
#define mp make_pair
#define AC ios::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define endl "\n"
ll a[100005];
int t[100005], x[100005], y[100005];
signed main() {
AC;
// plz
int n; cin >> n;
FOR(i, 1, n+1) cin >> a[i];
int q; cin >> q;
FOR(i, 0, q) cin >> t[i] >> x[i] >> y[i];
a[0] = a[n+1] = INF;
if (n <= 500 && q <= 500) {
FOR(i, 0, q) {
if (t[i] == 1) {
a[x[i]] = y[i];
} else {
int ans = 0;
ll inia = a[x[i] - 1], inib = a[y[i] + 1];
a[x[i] - 1] = a[y[i] + 1] = INF;
ll maxn = 0;
FOR(j, x[i], y[i] + 1) {
maxn = max(maxn, a[j]);
}
FOR(j, x[i], y[i] + 1) {
int l = j - 1, r = j + 1;
ll now = a[j];
while (1) {
if (a[l] > now && a[r] > now) break;
if (a[l] <= now) {
now += a[l]; l--;
}
if (a[r] <= now) {
now += a[r]; r++;
}
}
if (now >= maxn) {
ans++;
}
}
cout << ans << endl;
a[x[i] - 1] = inia;
a[y[i] + 1] = inib;
}
}
}
}
Compilation message (stderr)
fish2.cpp:2:39: warning: bad option '-funroll_loops' to pragma 'optimize' [-Wpragmas]
2 | #pragma GCC optimize("O3,unroll_loops")
| ^
fish2.cpp:3:26: warning: bad option '-funroll_loops' to attribute 'optimize' [-Wattributes]
3 | #pragma GCC target("avx2")
| ^
fish2.cpp:3:26: warning: bad option '-funroll_loops' to attribute 'optimize' [-Wattributes]
fish2.cpp:3:26: warning: bad option '-funroll_loops' to attribute 'optimize' [-Wattributes]
fish2.cpp:3:26: warning: bad option '-funroll_loops' to attribute 'optimize' [-Wattributes]
fish2.cpp:3:26: warning: bad option '-funroll_loops' to attribute 'optimize' [-Wattributes]
fish2.cpp:3:26: warning: bad option '-funroll_loops' to attribute 'optimize' [-Wattributes]
fish2.cpp:3:26: warning: bad option '-funroll_loops' to attribute 'optimize' [-Wattributes]
fish2.cpp:3:26: warning: bad option '-funroll_loops' to attribute 'optimize' [-Wattributes]
fish2.cpp:3:26: warning: bad option '-funroll_loops' to attribute 'optimize' [-Wattributes]
fish2.cpp:3:26: warning: bad option '-funroll_loops' to attribute 'optimize' [-Wattributes]
fish2.cpp:3:26: warning: bad option '-funroll_loops' to attribute 'optimize' [-Wattributes]
fish2.cpp:3:26: warning: bad option '-funroll_loops' to attribute 'optimize' [-Wattributes]
fish2.cpp:3:26: warning: bad option '-funroll_loops' to attribute 'optimize' [-Wattributes]
fish2.cpp:3:26: warning: bad option '-funroll_loops' to attribute 'optimize' [-Wattributes]
fish2.cpp:3:26: warning: bad option '-funroll_loops' to attribute 'optimize' [-Wattributes]
fish2.cpp:3:26: warning: bad option '-funroll_loops' to attribute 'optimize' [-Wattributes]
fish2.cpp:3:26: warning: bad option '-funroll_loops' to attribute 'optimize' [-Wattributes]
fish2.cpp:3:26: warning: bad option '-funroll_loops' to attribute 'optimize' [-Wattributes]
fish2.cpp:3:26: warning: bad option '-funroll_loops' to attribute 'optimize' [-Wattributes]
fish2.cpp:3:26: warning: bad option '-funroll_loops' to attribute 'optimize' [-Wattributes]
fish2.cpp:3:26: warning: bad option '-funroll_loops' to attribute 'optimize' [-Wattributes]
fish2.cpp:3:26: warning: bad option '-funroll_loops' to attribute 'optimize' [-Wattributes]
fish2.cpp:3:26: warning: bad option '-funroll_loops' to attribute 'optimize' [-Wattributes]
fish2.cpp:3:26: warning: bad option '-funroll_loops' to attribute 'optimize' [-Wattributes]
fish2.cpp:3:26: warning: bad option '-funroll_loops' to attribute 'optimize' [-Wattributes]
fish2.cpp:3:26: warning: bad option '-funroll_loops' to attribute 'optimize' [-Wattributes]
fish2.cpp:3:26: warning: bad option '-funroll_loops' to attribute 'optimize' [-Wattributes]
fish2.cpp:3:26: warning: bad option '-funroll_loops' to attribute 'optimize' [-Wattributes]
fish2.cpp:3:26: warning: bad option '-funroll_loops' to attribute 'optimize' [-Wattributes]
fish2.cpp:3:26: warning: bad option '-funroll_loops' to attribute 'optimize' [-Wattributes]
fish2.cpp:3:26: warning: bad option '-funroll_loops' to attribute 'optimize' [-Wattributes]
fish2.cpp:3:26: warning: bad option '-funroll_loops' to attribute 'optimize' [-Wattributes]
fish2.cpp:3:26: warning: bad option '-funroll_loops' to attribute 'optimize' [-Wattributes]
fish2.cpp:3:26: warning: bad option '-funroll_loops' to attribute 'optimize' [-Wattributes]
fish2.cpp:3:26: warning: bad option '-funroll_loops' to attribute 'optimize' [-Wattributes]
fish2.cpp:3:26: warning: bad option '-funroll_loops' to attribute 'optimize' [-Wattributes]
fish2.cpp:3:26: warning: bad option '-funroll_loops' to attribute 'optimize' [-Wattributes]
fish2.cpp:3:26: warning: bad option '-funroll_loops' to attribute 'optimize' [-Wattributes]
fish2.cpp:3:26: warning: bad option '-funroll_loops' to attribute 'optimize' [-Wattributes]
fish2.cpp:3:26: warning: bad option '-funroll_loops' to attribute 'optimize' [-Wattributes]
fish2.cpp:3:26: warning: bad option '-funroll_loops' to attribute 'optimize' [-Wattributes]
fish2.cpp:3:26: warning: bad option '-funroll_loops' to attribute 'optimize' [-Wattributes]
fish2.cpp:3:26: warning: bad option '-funroll_loops' to attribute 'optimize' [-Wattributes]
fish2.cpp:3:26: warning: bad option '-funroll_loops' to attribute 'optimize' [-Wattributes]
fish2.cpp:3:26: warning: bad option '-funroll_loops' to attribute 'optimize' [-Wattributes]
fish2.cpp:3:26: warning: bad option '-funroll_loops' to attribute 'optimize' [-Wattributes]
fish2.cpp:3:26: warning: bad option '-funroll_loops' to attribute 'optimize' [-Wattributes]
fish2.cpp:3:26: warning: bad option '-funroll_loops' to attribute 'optimize' [-Wattributes]
fish2.cpp:3:26: warning: bad option '-funroll_loops' to attribute 'optimize' [-Wattributes]
fish2.cpp:3:26: warning: bad option '-funroll_loops' to attribute 'optimize' [-Wattributes]
fish2.cpp:3:26: warning: bad option '-funroll_loops' to attribute 'optimize' [-Wattributes]
fish2.cpp:3:26: warning: bad option '-funroll_loops' to attribute 'optimize' [-Wattributes]
fish2.cpp:3:26: warning: bad option '-funroll_loops' to attribute 'optimize' [-Wattributes]
fish2.cpp:3:26: warning: bad option '-funroll_loops' to attribute 'optimize' [-Wattributes]
fish2.cpp:3:26: warning: bad option '-funroll_loops' to attribute 'optimize' [-Wattributes]
fish2.cpp:3:26: warning: bad option '-funroll_loops' to attribute 'optimize' [-Wattributes]
fish2.cpp:3:26: warning: bad option '-funroll_loops' to attribute 'optimize' [-Wattributes]
fish2.cpp:3:26: warning: bad option '-funroll_loops' to attribute 'optimize' [-Wattributes]
fish2.cpp:3:26: warning: bad option '-funroll_loops' to attribute 'optimize' [-Wattributes]
fish2.cpp:3:26: warning: bad option '-funroll_loops' to attribute 'optimize' [-Wattributes]
fish2.cpp:3:26: warning: bad option '-funroll_loops' to attribute 'optimize' [-Wattributes]
fish2.cpp:3:26: warning: bad option '-funroll_loops' to attribute 'optimize' [-Wattributes]
fish2.cpp:3:26: warning: bad option '-funroll_loops' to attribute 'optimize' [-Wattributes]
fish2.cpp:3:26: warning: bad option '-funroll_loops' to attribute 'optimize' [-Wattributes]
fish2.cpp:3:26: warning: bad option '-funroll_loops' to attribute 'optimize' [-Wattributes]
fish2.cpp:3:26: warning: bad option '-funroll_loops' to attribute 'optimize' [-Wattributes]
fish2.cpp:3:26: warning: bad option '-funroll_loops' to attribute 'optimize' [-Wattributes]
fish2.cpp:3:26: warning: bad option '-funroll_loops' to attribute 'optimize' [-Wattributes]
fish2.cpp:3:26: warning: bad option '-funroll_loops' to attribute 'optimize' [-Wattributes]
fish2.cpp:3:26: warning: bad option '-funroll_loops' to attribute 'optimize' [-Wattributes]
fish2.cpp:3:26: warning: bad option '-funroll_loops' to attribute 'optimize' [-Wattributes]
fish2.cpp:3:26: warning: bad option '-funroll_loops' to attribute 'optimize' [-Wattributes]
fish2.cpp:3:26: warning: bad option '-funroll_loops' to attribute 'optimize' [-Wattributes]
fish2.cpp:3:26: warning: bad option '-funroll_loops' to attribute 'optimize' [-Wattributes]
fish2.cpp:3:26: warning: bad option '-funroll_loops' to attribute 'optimize' [-Wattributes]
fish2.cpp:3:26: warning: bad option '-funroll_loops' to attribute 'optimize' [-Wattributes]
fish2.cpp:3:26: warning: bad option '-funroll_loops' to attribute 'optimize' [-Wattributes]
fish2.cpp:3:26: warning: bad option '-funroll_loops' to attribute 'optimize' [-Wattributes]
fish2.cpp:3:26: warning: bad option '-funroll_loops' to attribute 'optimize' [-Wattributes]
fish2.cpp:3:26: warning: bad option '-funroll_loops' to attribute 'optimize' [-Wattributes]
fish2.cpp:3:26: warning: bad option '-funroll_loops' to attribute 'optimize' [-Wattributes]
fish2.cpp:3:26: warning: bad option '-funroll_loops' to attribute 'optimize' [-Wattributes]
fish2.cpp:3:26: warning: bad option '-funroll_loops' to attribute 'optimize' [-Wattributes]
fish2.cpp:3:26: warning: bad option '-funroll_loops' to attribute 'optimize' [-Wattributes]
fish2.cpp:3:26: warning: bad option '-funroll_loops' to attribute 'optimize' [-Wattributes]
fish2.cpp:3:26: warning: bad option '-funroll_loops' to attribute 'optimize' [-Wattributes]
fish2.cpp:3:26: warning: bad option '-funroll_loops' to attribute 'optimize' [-Wattributes]
fish2.cpp:3:26: warning: bad option '-funroll_loops' to attribute 'optimize' [-Wattributes]
fish2.cpp:3:26: warning: bad option '-funroll_loops' to attribute 'optimize' [-Wattributes]
fish2.cpp:3:26: warning: bad option '-funroll_loops' to attribute 'optimize' [-Wattributes]
fish2.cpp:3:26: warning: bad option '-funroll_loops' to attribute 'optimize' [-Wattributes]
fish2.cpp:3:26: warning: bad option '-funroll_loops' to attribute 'optimize' [-Wattributes]
fish2.cpp:3:26: warning: bad option '-funroll_loops' to attribute 'optimize' [-Wattributes]
fish2.cpp:3:26: warning: bad option '-funroll_loops' to attribute 'optimize' [-Wattributes]
fish2.cpp:3:26: warning: bad option '-funroll_loops' to attribute 'optimize' [-Wattributes]
fish2.cpp:3:26: warning: bad option '-funroll_loops' to attribute 'optimize' [-Wattributes]
fish2.cpp:3:26: warning: bad option '-funroll_loops' to attribute 'optimize' [-Wattributes]
fish2.cpp:3:26: warning: bad option '-funroll_loops' to attribute 'optimize' [-Wattributes]
fish2.cpp:3:26: warning: bad option '-funroll_loops' to attribute 'optimize' [-Wattributes]
fish2.cpp:3:26: warning: bad option '-funroll_loops' to attribute 'optimize' [-Wattributes]
fish2.cpp:3:26: warning: bad option '-funroll_loops' to attribute 'optimize' [-Wattributes]
fish2.cpp:3:26: warning: bad option '-funroll_loops' to attribute 'optimize' [-Wattributes]
fish2.cpp:3:26: warning: bad option '-funroll_loops' to attribute 'optimize' [-Wattributes]
fish2.cpp:3:26: warning: bad option '-funroll_loops' to attribute 'optimize' [-Wattributes]
fish2.cpp:3:26: warning: bad option '-funroll_loops' to attribute 'optimize' [-Wattributes]
fish2.cpp:3:26: warning: bad option '-funroll_loops' to attribute 'optimize' [-Wattributes]
fish2.cpp:3:26: warning: bad option '-funroll_loops' to attribute 'optimize' [-Wattributes]
fish2.cpp:3:26: warning: bad option '-funroll_loops' to attribute 'optimize' [-Wattributes]
fish2.cpp:3:26: warning: bad option '-funroll_loops' to attribute 'optimize' [-Wattributes]
fish2.cpp:3:26: warning: bad option '-funroll_loops' to attribute 'optimize' [-Wattributes]
fish2.cpp:3:26: warning: bad option '-funroll_loops' to attribute 'optimize' [-Wattributes]
fish2.cpp:3:26: warning: bad option '-funroll_loops' to attribute 'optimize' [-Wattributes]
fish2.cpp:3:26: warning: bad option '-funroll_loops' to attribute 'optimize' [-Wattributes]
fish2.cpp:3:26: warning: bad option '-funroll_loops' to attribute 'optimize' [-Wattributes]
fish2.cpp:3:26: warning: bad option '-funroll_loops' to attribute 'optimize' [-Wattributes]
fish2.cpp:3:26: warning: bad option '-funroll_loops' to attribute 'optimize' [-Wattributes]
fish2.cpp:3:26: warning: bad option '-funroll_loops' to attribute 'optimize' [-Wattributes]
fish2.cpp:3:26: warning: bad option '-funroll_loops' to attribute 'optimize' [-Wattributes]
fish2.cpp:3:26: warning: bad option '-funroll_loops' to attribute 'optimize' [-Wattributes]
fish2.cpp:3:26: warning: bad option '-funroll_loops' to attribute 'optimize' [-Wattributes]
fish2.cpp:3:26: warning: bad option '-funroll_loops' to attribute 'optimize' [-Wattributes]
fish2.cpp:3:26: warning: bad option '-funroll_loops' to attribute 'optimize' [-Wattributes]
fish2.cpp:3:26: warning: bad option '-funroll_loops' to attribute 'optimize' [-Wattributes]
fish2.cpp:3:26: warning: bad option '-funroll_loops' to attribute 'optimize' [-Wattributes]
fish2.cpp:3:26: warning: bad option '-funroll_loops' to attribute 'optimize' [-Wattributes]
fish2.cpp:3:26: warning: bad option '-funroll_loops' to attribute 'optimize' [-Wattributes]
fish2.cpp:3:26: warning: bad option '-funroll_loops' to attribute 'optimize' [-Wattributes]
fish2.cpp:3:26: warning: bad option '-funroll_loops' to attribute 'optimize' [-Wattributes]
fish2.cpp:3:26: warning: bad option '-funroll_loops' to attribute 'optimize' [-Wattributes]
fish2.cpp:3:26: warning: bad option '-funroll_loops' to attribute 'optimize' [-Wattributes]
fish2.cpp:3:26: warning: bad option '-funroll_loops' to attribute 'optimize' [-Wattributes]
fish2.cpp:3:26: warning: bad option '-funroll_loops' to attribute 'optimize' [-Wattributes]
fish2.cpp:3:26: warning: bad option '-funroll_loops' to attribute 'optimize' [-Wattributes]
fish2.cpp:3:26: warning: bad option '-funroll_loops' to attribute 'optimize' [-Wattributes]
fish2.cpp:3:26: warning: bad option '-funroll_loops' to attribute 'optimize' [-Wattributes]
fish2.cpp:3:26: warning: bad option '-funroll_loops' to attribute 'optimize' [-Wattributes]
fish2.cpp:3:26: warning: bad option '-funroll_loops' to attribute 'optimize' [-Wattributes]
fish2.cpp:3:26: warning: bad option '-funroll_loops' to attribute 'optimize' [-Wattributes]
fish2.cpp:3:26: warning: bad option '-funroll_loops' to attribute 'optimize' [-Wattributes]
fish2.cpp:3:26: warning: bad option '-funroll_loops' to attribute 'optimize' [-Wattributes]
fish2.cpp:3:26: warning: bad option '-funroll_loops' to attribute 'optimize' [-Wattributes]
fish2.cpp:3:26: warning: bad option '-funroll_loops' to attribute 'optimize' [-Wattributes]
fish2.cpp:3:26: warning: bad option '-funroll_loops' to attribute 'optimize' [-Wattributes]
fish2.cpp:3:26: warning: bad option '-funroll_loops' to attribute 'optimize' [-Wattributes]
fish2.cpp:3:26: warning: bad option '-funroll_loops' to attribute 'optimize' [-Wattributes]
fish2.cpp:3:26: warning: bad option '-funroll_loops' to attribute 'optimize' [-Wattributes]
fish2.cpp:3:26: warning: bad option '-funroll_loops' to attribute 'optimize' [-Wattributes]
fish2.cpp:3:26: warning: bad option '-funroll_loops' to attribute 'optimize' [-Wattributes]
fish2.cpp:3:26: warning: bad option '-funroll_loops' to attribute 'optimize' [-Wattributes]
fish2.cpp:3:26: warning: bad option '-funroll_loops' to attribute 'optimize' [-Wattributes]
fish2.cpp:3:26: warning: bad option '-funroll_loops' to attribute 'optimize' [-Wattributes]
fish2.cpp:3:26: warning: bad option '-funroll_loops' to attribute 'optimize' [-Wattributes]
fish2.cpp:3:26: warning: bad option '-funroll_loops' to attribute 'optimize' [-Wattributes]
fish2.cpp:3:26: warning: bad option '-funroll_loops' to attribute 'optimize' [-Wattributes]
fish2.cpp:3:26: warning: bad option '-funroll_loops' to attribute 'optimize' [-Wattributes]
fish2.cpp:3:26: warning: bad option '-funroll_loops' to attribute 'optimize' [-Wattributes]
fish2.cpp:3:26: warning: bad option '-funroll_loops' to attribute 'optimize' [-Wattributes]
fish2.cpp:3:26: warning: bad option '-funroll_loops' to attribute 'optimize' [-Wattributes]
fish2.cpp:3:26: warning: bad option '-funroll_loops' to attribute 'optimize' [-Wattributes]
fish2.cpp:3:26: warning: bad option '-funroll_loops' to attribute 'optimize' [-Wattributes]
fish2.
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |