# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
793563 | duyanhloveav | Growing Trees (BOI11_grow) | C++17 | 1083 ms | 3336 KiB |
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include <bits/stdc++.h>
using namespace std;
#pragma GCC optimize("Ofast,O3,unroll-loops")
#pragma GCC target("avx2,bmi,bmi2,lzcnt,popcnt")
#define int long long
const int N = 9 + 1e5;
const int oo = 7 + 1e9;
int a[N];
void SaKaTa() {
int n, m;
cin >> n >> m;
for (int i = 1; i <= n; i++) cin >> a[i];
sort (a + 1, a + 1 + n);
while (m--) {
char c;
int l, r;
cin >> c >> l >> r;
if (c == 'F') {
int pos = lower_bound(a + 1, a + 1 + n, r) - a;
if (pos != (n + 1)) {
for (int i = pos; i <= n; i++) {
a[i]++;
l--;
if (l == 0) break;
}
sort (a + 1, a + 1 + n);
}
} else {
int pos = lower_bound(a + 1, a + 1 + n, l) - a;
if (pos != (n + 1) && a[pos] <= r) {
int pos_two = upper_bound(a + 1, a + 1 + n, r) - a - 1;
cout << pos_two - pos + 1 << '\n';
} else cout << 0 << '\n';
}
}
}
int32_t main() {
#define TASKNAME "TREE"
cin.tie(0)->sync_with_stdio(0);
if ( fopen( TASKNAME".inp", "r" ) ) {
freopen (TASKNAME".inp", "r", stdin);
freopen (TASKNAME".out", "w", stdout);
}
int testcase = 1;
// scanf("%d", &testcase);
while (testcase--)
SaKaTa();
return 0;
}
컴파일 시 표준 에러 (stderr) 메시지
# | 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... |
# | 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... |