# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
955648 | n3rm1n | Growing Trees (BOI11_grow) | C++17 | 1056 ms | 6884 KiB |
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include<bits/stdc++.h>
#define endl '\n'
using namespace std;
const int MAXN = 1e5 + 10;
void speed()
{
ios_base::sync_with_stdio(false);
cin.tie(NULL);
cout.tie(NULL);
}
int n, m;
int a[MAXN];
multiset < int > s;
void read_array()
{
cin >> n >> m;
for (int i = 1; i <= n; ++ i)
{
cin >> a[i];
s.insert(a[i]);
}
}
void solve()
{
char type;
int x, y;
while(m --)
{
cin >> type >> x >> y;
if(type == 'F')
{
multiset < int >::iterator it = s.lower_bound(y);
vector < int > g;
int cnt = 0;
for (multiset < int >:: iterator i = it; i != s.end();)
{
cnt ++;
int val = *i;
g.push_back(val);
if(cnt == x)break;
std::advance(i, 1);
}
for (int i = 0; i < g.size(); ++ i)
{
s.erase(s.find(g[i]));
s.insert(g[i] + 1);
}
}
else
{
int cut = std::distance(s.begin(), s.lower_bound(x)) - 1;
int add = std::distance(s.begin(), s.upper_bound(y)) - 1;
cout << add - cut << endl;
}
}
}
int main()
{
speed();
read_array();
solve();
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... |