| # | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
|---|---|---|---|---|---|---|---|
| 826317 | 12345678 | Deda (COCI17_deda) | C++17 | 81 ms | 7892 KiB |
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include <bits/stdc++.h>
using namespace std;
const int nx=2e5+5;
int n, q, x, y;
char opr;
struct segtree
{
int d[4*nx];
void update(int l, int r, int i, int idx, int val)
{
if (idx<l||r<idx) return;
if (l==r) return void(d[i]=val);
int md=(l+r)/2;
update(l, md, 2*i, idx, val);
update(md+1, r, 2*i+1, idx, val);
d[i]=min(d[2*i], d[2*i+1]);
}
int query(int l, int r, int i, int B, int Y)
{
if (r<B||d[i]>Y) return -1;
if (l==r) return l;
int md=(l+r)/2, lf=query(l, md, 2*i, B, Y);
if (lf!=-1) return lf;
return query(md+1, r, 2*i+1, B, Y);
}
} s;
int main()
{
cin.tie(NULL)->sync_with_stdio(false);
cin>>n>>q;
for (int i=0; i<4*nx; i++) s.d[i]=1e9+5;
while (q--)
{
cin>>opr>>x>>y;
if (opr=='M') s.update(1, n, 1, y, x);
else cout<<s.query(1, n, 1, y, x)<<'\n';
}
}
| # | Verdict | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
