# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
1000565 |
2024-06-17T19:31:25 Z |
De3b0o |
Fish 2 (JOI22_fish2) |
C++14 |
|
4000 ms |
2136 KB |
#include<bits/stdc++.h>
#define ll long long
#define F first
#define S second
#define in insert
#define pb push_back
#define ppb pop_back()
#define d3 ios::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define cans cout << ans << "\n";
#define yes cout << "Yes" << "\n";
#define no cout << "No" << "\n";
#define pll pair<ll,ll>
#define lin cout << "\n";
#define sqr 340
#define mod 1000000007
#define mid ((l+r)/2)
#define lc (2*x)
#define rc (2*x+1)
using namespace std;
ll n , q;
ll a[100009];
ll gt(ll l , ll r)
{
ll ans = 0;
for(int i = l ; r>=i ; i++)
{
ll l1 = i-1 , r1 = i+1;
bool g = 0;
ll sum = a[i];
while(true)
{
if(l1==l-1&&r1==r+1)
{
g=1;
break;
}
if(l1==l-1)
{
if(sum>=a[r1])
{
sum+=a[r1];
r1++;
}
else
break;
}
else if(r1==r+1)
{
if(sum>=a[l1])
{
sum+=a[l1];
l1--;
}
else
break;
}
else
{
if(a[l1]>a[r1])
{
if(sum>=a[r1])
{
sum+=a[r1];
r1++;
}
else
break;
}
else
{
if(sum>=a[l1])
{
sum+=a[l1];
l1--;
}
else
break;
}
}
}
if(g)
ans++;
}
return ans;
}
int main()
{
d3
cin >> n;
for(int i = 1 ; n>=i ; i++)
cin >> a[i];
cin >> q;
while(q--)
{
ll t;
cin >> t;
if(t==1)
{
ll x , y;
cin >> x >> y;
a[x]=y;
}
else
{
ll l , r;
cin >> l >> r;
ll ans = gt(l,r);
cans
}
}
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
344 KB |
Output is correct |
2 |
Correct |
1 ms |
468 KB |
Output is correct |
3 |
Correct |
0 ms |
348 KB |
Output is correct |
4 |
Correct |
0 ms |
344 KB |
Output is correct |
5 |
Correct |
2 ms |
480 KB |
Output is correct |
6 |
Correct |
2 ms |
348 KB |
Output is correct |
7 |
Correct |
1 ms |
348 KB |
Output is correct |
8 |
Correct |
1 ms |
348 KB |
Output is correct |
9 |
Correct |
6 ms |
348 KB |
Output is correct |
10 |
Correct |
4 ms |
348 KB |
Output is correct |
11 |
Correct |
12 ms |
484 KB |
Output is correct |
12 |
Correct |
1 ms |
344 KB |
Output is correct |
13 |
Correct |
2 ms |
344 KB |
Output is correct |
14 |
Correct |
2 ms |
348 KB |
Output is correct |
15 |
Correct |
2 ms |
348 KB |
Output is correct |
16 |
Correct |
6 ms |
348 KB |
Output is correct |
17 |
Correct |
1 ms |
348 KB |
Output is correct |
18 |
Correct |
3 ms |
476 KB |
Output is correct |
19 |
Correct |
3 ms |
348 KB |
Output is correct |
20 |
Correct |
26 ms |
484 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
344 KB |
Output is correct |
2 |
Correct |
435 ms |
1800 KB |
Output is correct |
3 |
Correct |
51 ms |
1344 KB |
Output is correct |
4 |
Correct |
460 ms |
1804 KB |
Output is correct |
5 |
Correct |
55 ms |
1552 KB |
Output is correct |
6 |
Execution timed out |
4033 ms |
2136 KB |
Time limit exceeded |
7 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
344 KB |
Output is correct |
2 |
Correct |
1 ms |
468 KB |
Output is correct |
3 |
Correct |
0 ms |
348 KB |
Output is correct |
4 |
Correct |
0 ms |
344 KB |
Output is correct |
5 |
Correct |
2 ms |
480 KB |
Output is correct |
6 |
Correct |
2 ms |
348 KB |
Output is correct |
7 |
Correct |
1 ms |
348 KB |
Output is correct |
8 |
Correct |
1 ms |
348 KB |
Output is correct |
9 |
Correct |
6 ms |
348 KB |
Output is correct |
10 |
Correct |
4 ms |
348 KB |
Output is correct |
11 |
Correct |
12 ms |
484 KB |
Output is correct |
12 |
Correct |
1 ms |
344 KB |
Output is correct |
13 |
Correct |
2 ms |
344 KB |
Output is correct |
14 |
Correct |
2 ms |
348 KB |
Output is correct |
15 |
Correct |
2 ms |
348 KB |
Output is correct |
16 |
Correct |
6 ms |
348 KB |
Output is correct |
17 |
Correct |
1 ms |
348 KB |
Output is correct |
18 |
Correct |
3 ms |
476 KB |
Output is correct |
19 |
Correct |
3 ms |
348 KB |
Output is correct |
20 |
Correct |
26 ms |
484 KB |
Output is correct |
21 |
Correct |
0 ms |
344 KB |
Output is correct |
22 |
Correct |
435 ms |
1800 KB |
Output is correct |
23 |
Correct |
51 ms |
1344 KB |
Output is correct |
24 |
Correct |
460 ms |
1804 KB |
Output is correct |
25 |
Correct |
55 ms |
1552 KB |
Output is correct |
26 |
Execution timed out |
4033 ms |
2136 KB |
Time limit exceeded |
27 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
344 KB |
Output is correct |
2 |
Correct |
435 ms |
1800 KB |
Output is correct |
3 |
Correct |
51 ms |
1344 KB |
Output is correct |
4 |
Correct |
460 ms |
1804 KB |
Output is correct |
5 |
Correct |
55 ms |
1552 KB |
Output is correct |
6 |
Execution timed out |
4033 ms |
2136 KB |
Time limit exceeded |
7 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
344 KB |
Output is correct |
2 |
Correct |
435 ms |
1800 KB |
Output is correct |
3 |
Correct |
51 ms |
1344 KB |
Output is correct |
4 |
Correct |
460 ms |
1804 KB |
Output is correct |
5 |
Correct |
55 ms |
1552 KB |
Output is correct |
6 |
Execution timed out |
4033 ms |
2136 KB |
Time limit exceeded |
7 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
344 KB |
Output is correct |
2 |
Correct |
1 ms |
468 KB |
Output is correct |
3 |
Correct |
0 ms |
348 KB |
Output is correct |
4 |
Correct |
0 ms |
344 KB |
Output is correct |
5 |
Correct |
2 ms |
480 KB |
Output is correct |
6 |
Correct |
2 ms |
348 KB |
Output is correct |
7 |
Correct |
1 ms |
348 KB |
Output is correct |
8 |
Correct |
1 ms |
348 KB |
Output is correct |
9 |
Correct |
6 ms |
348 KB |
Output is correct |
10 |
Correct |
4 ms |
348 KB |
Output is correct |
11 |
Correct |
12 ms |
484 KB |
Output is correct |
12 |
Correct |
1 ms |
344 KB |
Output is correct |
13 |
Correct |
2 ms |
344 KB |
Output is correct |
14 |
Correct |
2 ms |
348 KB |
Output is correct |
15 |
Correct |
2 ms |
348 KB |
Output is correct |
16 |
Correct |
6 ms |
348 KB |
Output is correct |
17 |
Correct |
1 ms |
348 KB |
Output is correct |
18 |
Correct |
3 ms |
476 KB |
Output is correct |
19 |
Correct |
3 ms |
348 KB |
Output is correct |
20 |
Correct |
26 ms |
484 KB |
Output is correct |
21 |
Correct |
0 ms |
344 KB |
Output is correct |
22 |
Correct |
435 ms |
1800 KB |
Output is correct |
23 |
Correct |
51 ms |
1344 KB |
Output is correct |
24 |
Correct |
460 ms |
1804 KB |
Output is correct |
25 |
Correct |
55 ms |
1552 KB |
Output is correct |
26 |
Execution timed out |
4033 ms |
2136 KB |
Time limit exceeded |
27 |
Halted |
0 ms |
0 KB |
- |