(UPD: 2024-12-04 14:48 UTC) Judge is not working due to Cloudflare incident. (URL) We can do nothing about it, sorry. After the incident is resolved, we will grade all submissions.

Submission #1122141

#TimeUsernameProblemLanguageResultExecution timeMemory
1122141vjudge1Growing Trees (BOI11_grow)C++14
30 / 100
1057 ms1868 KiB
#include<bits/stdc++.h> #define ll long long #define endl "\n" using namespace std; const ll mod = 1e9 + 7; const int N = 1e5 + 5; int n, q; int val[100005]; int main(){ ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0); cin >> n >> q; for (int i = 1; i <= n; i ++ ) cin >> val[i]; sort(val + 1, val + n + 1); while (q -- ){ char type; int a, b; cin >> type >> a >> b; if (type == 'F'){ int pos = lower_bound(val + 1, val + n + 1, b) - val; for (int i = pos; i <= min(n, pos + a - 1); i ++ ) val[i] ++; sort(val + 1, val + n + 1); } else { int pos1 = upper_bound(val + 1, val + n + 1, b) - val; int pos2 = lower_bound(val + 1, val + n + 1, a) - val; cout << pos1 - pos2 <<endl; } } }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...