Submission #750172

#TimeUsernameProblemLanguageResultExecution timeMemory
750172ammar124Zalmoxis (BOI18_zalmoxis)C++17
Compilation error
0 ms0 KiB
#include <bits/stdc++.h> #include <ext/pb_ds/assoc_container.hpp> #include <ext/pb_ds/tree_policy.hpp> #define endl '\n' #define ll long long #define fbo find_by_order #define ofk order_of_key using namespace std; using namespace __gnu_pbds; template<class T> using indexed_set = tree<T,null_type,less<T>,rb_tree_tag, tree_order_statistics_node_update>; ll power(ll a, ll b) { ll ans = 1; while (b) { if (b % 2) ans *= a; a *= a; b /= 2; } return ans; } int const maxin = 1e6+6; ll const mod = 1e9+7; int arr[maxin]; int a,b; vector<int>v(1e7 + 6 , -1); int meow = 0; int cnt = 0; int x1 , y1; int xc = 0 , yc = 0; void solve(int l , int r , int num) { if(cnt == a + b) { return; } int indx = (l+r)/2; if(meow == a) { int g = a+b - cnt; int g2; int g3; for(int i=0;i<100;i++) { if(power(2 , i) > g) break; g2 = power(2,i); g3 = i; } x1 = num - g3; y1 = num - g3 - 1; yc = (g - g2)*2; xc = g - yc; cnt = a+b; return; } if(num < arr[meow]) { v[indx] = num; return; cnt++; } if(num == arr[meow]) { v[indx] = arr[meow]; meow++; cnt++; return; } solve(l , indx , num-1); solve(indx , r , num-1); } int main() { ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0); cin>>a>>b; for(int i=0;i<a;i++) { cin>>arr[i]; } solve(0 , 1e7+5 , 30); for(int i=0;i<1e7+6;i++) { if(v[i] != -1) cout<<v[i]<<" "; } for(int i=0;i<xc;i++) { cout<<x1<<" "; } for(int i=0;i<yc;i++) { cout<<y1<<" "; } return 0; }

Compilation message (stderr)

zalmoxis.cpp:20:10: error: 'int y1' redeclared as different kind of entity
   20 | int x1 , y1;
      |          ^~
In file included from /usr/include/features.h:461,
                 from /usr/include/x86_64-linux-gnu/c++/10/bits/os_defines.h:39,
                 from /usr/include/x86_64-linux-gnu/c++/10/bits/c++config.h:518,
                 from /usr/include/c++/10/cassert:43,
                 from /usr/include/x86_64-linux-gnu/c++/10/bits/stdc++.h:33,
                 from zalmoxis.cpp:1:
/usr/include/x86_64-linux-gnu/bits/mathcalls.h:221:1: note: previous declaration 'double y1(double)'
  221 | __MATHCALL (y1,, (_Mdouble_));
      | ^~~~~~~~~~
zalmoxis.cpp: In function 'void solve(int, int, int)':
zalmoxis.cpp:42:12: error: assignment of function 'double y1(double)'
   42 |         y1 = num - g3 - 1;
      |         ~~~^~~~~~~~~~~~~~
zalmoxis.cpp: In function 'int main()':
zalmoxis.cpp:84:15: warning: the address of 'double y1(double)' will never be NULL [-Waddress]
   84 |         cout<<y1<<" ";
      |               ^~