Please sign in first.
Submission #19830596
Source Code Expand
#include <bits/stdc++.h>
#include <atcoder/all>
using namespace std;
using namespace atcoder;
using ll = long long;
int op(int a, int b){ return max(a, b); }
int e() { return -1; }
int target;
bool f(int val){ return val < target; }
int main()
{
int n, q;
cin >> n >> q;
segtree<int, op, e> seg(n);
for (int i = 0; i < n; i++){
int t;
cin >> t;
seg.set(i, t);
}
for (int i = 0; i < q; i++){
int t, x, y;
cin >> t >> x >> y;
x--;
switch(t){
case 1:
seg.set(x, y);
break;
case 2:
cout << seg.prod(x, y) << endl;
break;
case 3:
target = y;
cout << seg.max_right<f>(x) + 1 << endl;
break;
}
}
return 0;
}
Submission Info
| Submission Time | |
|---|---|
| Task | J - Segment Tree |
| User | unnohideyuki |
| Language | C++ (GCC 9.2.1 with AC Library) |
| Score | 100 |
| Code Size | 747 Byte |
| Status | AC |
| Exec Time | 386 ms |
| Memory | 6132 KiB |
Judge Result
| Set Name | Sample | All | ||||
|---|---|---|---|---|---|---|
| Score / Max Score | 0 / 0 | 100 / 100 | ||||
| Status |
|
|
| Set Name | Test Cases |
|---|---|
| Sample | 00-sample-01.txt |
| All | 00-sample-01.txt, 01-01.txt, 01-02.txt, 01-03.txt, 01-04.txt, 01-05.txt, 01-06.txt, 01-07.txt, 01-08.txt, 01-09.txt, 01-10.txt, 01-11.txt, 01-12.txt, 01-13.txt, 01-14.txt, 01-15.txt, 01-16.txt, 01-17.txt, 01-18.txt, 01-19.txt, 01-20.txt, 01-21.txt |
| Case Name | Status | Exec Time | Memory |
|---|---|---|---|
| 00-sample-01.txt | AC | 8 ms | 3520 KiB |
| 01-01.txt | AC | 2 ms | 3560 KiB |
| 01-02.txt | AC | 306 ms | 5744 KiB |
| 01-03.txt | AC | 311 ms | 4740 KiB |
| 01-04.txt | AC | 53 ms | 3584 KiB |
| 01-05.txt | AC | 104 ms | 3708 KiB |
| 01-06.txt | AC | 238 ms | 6052 KiB |
| 01-07.txt | AC | 100 ms | 3556 KiB |
| 01-08.txt | AC | 219 ms | 5824 KiB |
| 01-09.txt | AC | 179 ms | 5868 KiB |
| 01-10.txt | AC | 165 ms | 4500 KiB |
| 01-11.txt | AC | 70 ms | 4356 KiB |
| 01-12.txt | AC | 386 ms | 5944 KiB |
| 01-13.txt | AC | 338 ms | 5940 KiB |
| 01-14.txt | AC | 386 ms | 6016 KiB |
| 01-15.txt | AC | 335 ms | 6056 KiB |
| 01-16.txt | AC | 381 ms | 6064 KiB |
| 01-17.txt | AC | 341 ms | 5932 KiB |
| 01-18.txt | AC | 385 ms | 6008 KiB |
| 01-19.txt | AC | 338 ms | 6132 KiB |
| 01-20.txt | AC | 381 ms | 6132 KiB |
| 01-21.txt | AC | 343 ms | 6048 KiB |