Submission #875857

#TimeUsernameProblemLanguageResultExecution timeMemory
875857Mr_PhWeirdtree (RMI21_weirdtree)C++17
Compilation error
0 ms0 KiB
#include "weirdtree.h" #include "grader.cpp" #include<bits/stdc++.h> using namespace std; vector<int> arr; void initialise(int N, int Q, int h[]) { for(int i=1;i<=N;i++) arr.push_back(h[i]); } void cut(int l, int r, int k) { while(k--) { int mx=-1e18,idx=0; for(int i=l-1;i<r;i++) if(arr[i]>mx)mx=arr[i],idx=i; // cout<<l<<" "<<r<<" "<<idx<<" "<<mx<<endl; if(mx<=0)continue; arr[idx]--; } } void magic(int i, int x) { arr[i-1]=x; } long long int inspect(int l, int r) { int sum=0; for(int i=l-1;i<r;i++)sum+=arr[i]; return sum; }

Compilation message (stderr)

weirdtree.cpp: In function 'void cut(int, int, int)':
weirdtree.cpp:13:12: warning: overflow in conversion from 'double' to 'int' changes value from '-1.0e+18' to '-2147483648' [-Woverflow]
   13 |     int mx=-1e18,idx=0;
      |            ^~~~~
/usr/bin/ld: /tmp/cc5KZARV.o: in function `main':
grader.cpp:(.text.startup+0x0): multiple definition of `main'; /tmp/ccy0gnoV.o:weirdtree.cpp:(.text.startup+0x0): first defined here
collect2: error: ld returned 1 exit status