Submission #871070

#TimeUsernameProblemLanguageResultExecution timeMemory
871070Ahmed57Weirdtree (RMI21_weirdtree)C++17
Compilation error
0 ms0 KiB
#include <bits/stdc++.h> using namespace std; #define int long long long long arr[10001],n; void initialise(int32_t N, int32_t Q,int32_t h[]){ n = N; for(int i = 1;i<=n;i++){ arr[i] = h[i]; } } void cut(int32_t l, int32_t r, int32_t k){ vector<int> v; for(int i = l;i<=r;i++){ v.push_back(arr[i]); } sort(v.begin(),v.end()); vector<int> xd; int all = 0; for(int i = v.size()-1;i>=0;i--){ all+=v[i]; xd.push_back(all); } reverse(xd.begin(),xd.end()); int nah = 0; for(int i = v.size()-1;i>=0;i--){ if(i&&v[i]==v[i-1])continue; int elem = v.size()-i; if(k-(xd[i]-(elem*v[i]))>=0){ nah = i; } } int elem = v.size()-nah; long long num = v[nah]-((k-(xd[nah]-(elem*v[nah])))/elem); num = max(num,0ll); long long rem = k-(xd[nah]-(num*elem)); for(int i = l;i<=r;i++){ arr[i] = min(arr[i],num); if(arr[i]==num&&rem&&arr[i]!=0){ arr[i]--; rem--; } } } void magic(int32_t i, int32_t x){ arr[i] = x; } long long int inspect(int32_t l, int32_t r){ long long sum = 0; for(int i = l;i<=r;i++){ sum+=arr[i]; } return sum; } /* signed main(){ ios_base::sync_with_stdio(false);cin.tie(0); initialise(6,1,{0,1,2,3,1,2,3}); cut(1,6,3); cout<<inspect(1,6)<<endl; }*/

Compilation message (stderr)

weirdtree.cpp:3:13: error: 'long long long' is too long for GCC
    3 | #define int long long
      |             ^~~~
weirdtree.cpp:47:11: note: in expansion of macro 'int'
   47 | long long int inspect(int32_t l, int32_t r){
      |           ^~~
weirdtree.cpp:3:18: error: 'long long long' is too long for GCC
    3 | #define int long long
      |                  ^~~~
weirdtree.cpp:47:11: note: in expansion of macro 'int'
   47 | long long int inspect(int32_t l, int32_t r){
      |           ^~~