Submission #573487

#TimeUsernameProblemLanguageResultExecution timeMemory
573487Sho10Parrots (IOI11_parrots)C++17
Compilation error
0 ms0 KiB
#include <bits/stdc++.h> //Andrei Alexandru a.k.a Sho #include "encoder.h" using ll=long long; using ld=long double; int const INF=1000000005; ll const LINF=1000000000000000005; ll const mod=6700417; ld const PI=3.14159265359; ll const MAX_N=3e5+5; ld const EPS=0.00000001; #pragma GCC optimize("O3") #pragma GCC optimize("Ofast") #define f first #define s second #define pb push_back #define mp make_pair #define endl '\n' #define sz(a) (int)a.size() #define CODE_START ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0); using namespace std; map<ll,vector<ll>>viz; string calc(ll nr){ string s=""; for(ll i=0;i<6;i++) { if((1ll<<i)&nr){ s+='1'; }else s+='0'; } reverse(s.begin(),s.end()); return s; } ll turnback(string s){ ll ans=0,d=0; for(ll i=s.size()-1;i>=0;i--) { if(s[i]=='1'){ ans+=(1ll<<d); } d++; } return ans; } encode(int n,int a[]){ ll val=0; for(ll i1=0;i1<=3;i1++) for(ll i2=i1;i2<=3;i2++) for(ll i3=i2;i3<=3;i3++) for(ll i4=i3;i4<=3;i4++) for(ll i5=i4;i5<=3;i5++) for(ll i6=i5;i6<=3;i6++) for(ll i7=i6;i7<=3;i7++) { vector<ll>x; x.pb(i1); x.pb(i2); x.pb(i3); x.pb(i4); x.pb(i5); x.pb(i6); x.pb(i7); viz[val]=x; val++; } for(ll i=0;i<n;i++) { vector<ll>x=viz[a[i]]; string s=calc(i); for(auto it : x){ if(it==0){ continue; s+='0'; s+='0'; }else if(it==1){ s+='0'; s+='1'; }else if(it==2){ s+='1'; s+='0'; }else if(it==3){ s+='1'; s+='1'; } send(turnback(s)); s.pop_back(); s.pop_back(); } } }

Compilation message (stderr)

encoder.cpp:44:1: error: ISO C++ forbids declaration of 'encode' with no type [-fpermissive]
   44 | encode(int n,int a[]){
      | ^~~~~~
encoder.cpp:44:1: error: ambiguating new declaration of 'int encode(int, int*)'
In file included from encoder.cpp:2:
encoder.h:1:6: note: old declaration 'void encode(int, int*)'
    1 | void encode(int N, int M[]);
      |      ^~~~~~
encoder.cpp: In function 'int encode(int, int*)':
encoder.cpp:85:5: error: 'send' was not declared in this scope; did you mean 'second'?
   85 |     send(turnback(s));
      |     ^~~~
      |     second
encoder.cpp:90:1: warning: no return statement in function returning non-void [-Wreturn-type]
   90 | }
      | ^

/usr/bin/ld: /tmp/ccqMI3H5.o: in function `main':
grader_decoder.cpp:(.text.startup+0x1ef): undefined reference to `decode(int, int, int*)'
collect2: error: ld returned 1 exit status