# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
850224 | 2023-09-16T06:44:26 Z | Essa2006 | Growing Trees (BOI11_grow) | C++14 | 1000 ms | 7136 KB |
#ifndef _GLIBCXX_NO_ASSERT #include <cassert> #endif #include <cctype> #include <cerrno> #include <cfloat> #include <ciso646> #include <climits> #include <clocale> #include <cmath> #include <csetjmp> #include <csignal> #include <cstdarg> #include <cstddef> #include <cstdio> #include <cstdlib> #include <cstring> #include <ctime> #if __cplusplus >= 201103L #include <ccomplex> #include <cfenv> #include <cinttypes> #include <cstdbool> #include <cstdint> #include <ctgmath> #include <cwchar> #include <cwctype> #endif // C++ #include <algorithm> #include <bitset> #include <complex> #include <deque> #include <exception> #include <fstream> #include <functional> #include <iomanip> #include <ios> #include <iosfwd> #include <iostream> #include <istream> #include <iterator> #include <limits> #include <list> #include <locale> #include <map> #include <memory> #include <new> #include <numeric> #include <ostream> #include <queue> #include <set> #include <sstream> #include <stack> #include <stdexcept> #include <streambuf> #include <string> #include <typeinfo> #include <utility> #include <valarray> #include <vector> #if __cplusplus >= 201103L #include <array> #include <atomic> #include <chrono> #include <condition_variable> #include <forward_list> #include <future> #include <initializer_list> #include <mutex> #include <random> #include <ratio> #include <regex> #include <scoped_allocator> #include <system_error> #include <thread> #include <tuple> #include <typeindex> #include <type_traits> #include <unordered_map> #include <unordered_set> #endif using namespace std; #define ll long long #define endl '\n' #define FF first #define SS second #define all(a) a.begin(), a.end() #define mod (ll)(1000000007) int main(){ ios_base::sync_with_stdio(0);cin.tie(0); int n, m; cin>>n>>m; map<int, int>mp; for(int i=0, a;i<n;i++){ cin>>a; mp[a]++; } while(m--){ char type; int x, y; cin>>type>>x>>y; if(type=='F'){ auto it=mp.lower_bound(y); vector<array<int, 2> >Inc; while(x && it!=mp.end()){ int cur=min(x, it->SS); it->SS-=cur; x-=cur; array<int, 2>a={it->FF+1, cur}; Inc.push_back(a); it++; } for(int i=0;i<Inc.size();i++){ mp[Inc[i][0]]+=Inc[i][1]; } } else{ int ans=0; auto it=mp.lower_bound(x); while(it!=mp.end()){ if(it->FF>y) break; ans+=it->SS; it++; } cout<<ans<<endl; } } }
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Execution timed out | 1041 ms | 2036 KB | Time limit exceeded |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 344 KB | Output is correct |
2 | Correct | 1 ms | 344 KB | Output is correct |
3 | Correct | 9 ms | 604 KB | Output is correct |
4 | Correct | 1 ms | 344 KB | Output is correct |
5 | Correct | 191 ms | 1872 KB | Output is correct |
6 | Correct | 56 ms | 1616 KB | Output is correct |
7 | Correct | 148 ms | 896 KB | Output is correct |
8 | Correct | 16 ms | 1120 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 24 ms | 1624 KB | Output is correct |
2 | Execution timed out | 1038 ms | 1912 KB | Time limit exceeded |
3 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 202 ms | 2132 KB | Output is correct |
2 | Correct | 76 ms | 1876 KB | Output is correct |
3 | Correct | 387 ms | 988 KB | Output is correct |
4 | Execution timed out | 1034 ms | 1996 KB | Time limit exceeded |
5 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 115 ms | 1620 KB | Output is correct |
2 | Execution timed out | 1042 ms | 2396 KB | Time limit exceeded |
3 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 136 ms | 1620 KB | Output is correct |
2 | Correct | 964 ms | 2572 KB | Output is correct |
3 | Execution timed out | 1008 ms | 1908 KB | Time limit exceeded |
4 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 114 ms | 1616 KB | Output is correct |
2 | Execution timed out | 1046 ms | 2056 KB | Time limit exceeded |
3 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Execution timed out | 1045 ms | 7072 KB | Time limit exceeded |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 146 ms | 2128 KB | Output is correct |
2 | Execution timed out | 1040 ms | 6884 KB | Time limit exceeded |
3 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Execution timed out | 1042 ms | 7136 KB | Time limit exceeded |
2 | Halted | 0 ms | 0 KB | - |