Submission #473312

#TimeUsernameProblemLanguageResultExecution timeMemory
473312Ahmed_SolymanGaraža (COCI17_garaza)C++14
Compilation error
0 ms0 KiB
#include <iostream> using namespace std; typedef long long ll; ll segTree[(4*100000)+5]; ll arr[100000+5]; void build(ll l,ll r,ll p) { if(l>r)return; if(l==r){ segTree[p]=arr[l]; return; } ll mid=(l+r)/2; build(l,mid,p*2); build(mid+1,r,p*2+1); segTree[p]=__gcd(segTree[p*2],segTree[p*2+1])>1; } ll query(ll l,ll r,ll p,ll query_l,ll query_r) { if(query_r<l || query_l>r){ return 1e18; } if(l>=query_l && r<=query_r){ return segTree[p]; } ll mid=(l+r)/2; return __gcd(query(l,mid,p*2,query_l,query_r),query(mid+1,r,p*2+1,query_l,query_r))>!; } void update(ll l,ll r,ll p,ll idx,ll value) { if(l>r)return; if(l==r){ segTree[p]=value; return; } ll mid=(l+r)/2; if(idx>mid){ update(mid+1,r,p*2+1,idx,value); } else{ update(l,mid,p*2,idx,value); } segTree[p]=__gcd(segTree[p*2],segTree[p*2+1])>1; } int main() { ll n,q;cin>>n>>q; for(ll i=1;i<=n;i++)cin>>arr[i]; build(1,n,1); while(q--){ ll type,x,y;cin>>type>>x>>y; x++; if(type==1){ update(1,n,1,x,y); } else{ cout<<query(1,n,1,x,y)<<endl; } } return 0; }

Compilation message (stderr)

garaza.cpp: In function 'void build(ll, ll, ll)':
garaza.cpp:19:16: error: '__gcd' was not declared in this scope; did you mean '__gid_t'?
   19 |     segTree[p]=__gcd(segTree[p*2],segTree[p*2+1])>1;
      |                ^~~~~
      |                __gid_t
garaza.cpp: In function 'll query(ll, ll, ll, ll, ll)':
garaza.cpp:30:12: error: '__gcd' was not declared in this scope; did you mean '__gid_t'?
   30 |     return __gcd(query(l,mid,p*2,query_l,query_r),query(mid+1,r,p*2+1,query_l,query_r))>!;
      |            ^~~~~
      |            __gid_t
garaza.cpp:30:90: error: expected primary-expression before ';' token
   30 |     return __gcd(query(l,mid,p*2,query_l,query_r),query(mid+1,r,p*2+1,query_l,query_r))>!;
      |                                                                                          ^
garaza.cpp: In function 'void update(ll, ll, ll, ll, ll)':
garaza.cpp:46:16: error: '__gcd' was not declared in this scope; did you mean '__gid_t'?
   46 |     segTree[p]=__gcd(segTree[p*2],segTree[p*2+1])>1;
      |                ^~~~~
      |                __gid_t