#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace std;
using namespace __gnu_pbds;
#define fi first
#define se second
#define mp make_pair
#define pb push_back
#define fbo find_by_order
#define ook order_of_key
typedef long long ll;
typedef pair<ll,ll> ii;
typedef vector<ll> vi;
typedef long double ld;
typedef tree<ll, null_type, less<ll>, rb_tree_tag, tree_order_statistics_node_update> pbds;
typedef set<ll>::iterator sit;
typedef map<ll,ll>::iterator mit;
const int C = 12;
int encode (int n, int x, int y)
{
for(int i = 0; i < C; i++)
{
int b1 = 0; int b2 = 0;
if(x&(1<<i)) b1=1;
if(y&(1<<i)) b2=1;
if(b1!=b2)
{
if(b1) return 2*i+1;
else return 2*i+2;
}
}
}
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace std;
using namespace __gnu_pbds;
#define fi first
#define se second
#define mp make_pair
#define pb push_back
#define fbo find_by_order
#define ook order_of_key
typedef long long ll;
typedef pair<ll,ll> ii;
typedef vector<ll> vi;
typedef long double ld;
typedef tree<ll, null_type, less<ll>, rb_tree_tag, tree_order_statistics_node_update> pbds;
typedef set<ll>::iterator sit;
typedef map<ll,ll>::iterator mit;
int decode (int n, int q, int h)
{
h--;
if(q&(1<<(h/2)))
{
return (h&1)^1;
}
else
{
return (h&1);
}
}
Compilation message
encoder.cpp: In function 'int encode(int, int, int)':
encoder.cpp:37:1: warning: control reaches end of non-void function [-Wreturn-type]
}
^
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Partially correct |
1849 ms |
27480 KB |
Output is partially correct - maxh = 20 |
2 |
Partially correct |
1819 ms |
27480 KB |
Output is partially correct - maxh = 20 |