#include <bits/stdc++.h>
#define lp(i,a,b) for(int i=a;i<b;i++)
#define ff first
#define ss second
#define pb push_back
#define ll long long
#define sz size()
using namespace std ;
int type , t , n , a , b ;
vector<int> v ;
bool ok = false ;
bool isOn(int m, int bit) { return ((1<<bit)&m) != 0 ; }
int encode(int n , int x , int y)
{
if(!ok)
{
lp(i,1,(1<<12))
if( __builtin_popcount(i) == 6 ) v.pb( i ) ;
ok = true ;
}
lp(i,0,12)
if( isOn(v[x-1],i) && !isOn(v[y-1], i) )
return i+1 ;
}
#include <bits/stdc++.h>
#define lp(i,a,b) for(int i=a;i<b;i++)
#define ff first
#define ss second
#define pb push_back
#define ll long long
#define sz size()
using namespace std ;
vector<int> v ;
bool ok = false ;
bool isOn(int m, int bit) { return ((1<<bit)&m) != 0 ; }
bool decode(int n, int q, int h)
{
if(!ok)
{
lp(i,1,(1<<12))
if( __builtin_popcount(i) == 6 ) v.pb(i) ;
ok = true ;
}
if( isOn(v[q-1],h-1) ) return true ;
return false ;
}
Compilation message
encoder.cpp: In function 'int encode(int, int, int)':
encoder.cpp:32:1: warning: control reaches end of non-void function [-Wreturn-type]
}
^
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1618 ms |
86056 KB |
Output is correct - maxh = 12 |
2 |
Correct |
1650 ms |
85768 KB |
Output is correct - maxh = 12 |