#include "Annalib.h"
#include "bits/stdc++.h"
using namespace std;
#define fi first
#define se second
#define ll long long
#define dbg(v) cerr<<#v<<" = "<<v<<'\n'
#define vi vector<int>
#define vl vector <ll>
#define pii pair<int,int>
#define mp make_pair
#define db long double
#define pb push_back
#define all(s) s.begin(),s.end()
template < class P , class Q > ostream& operator<<(ostream& stream, pair < P , Q > v){ stream << "(" << v.fi << ',' << v.se << ")"; return stream;}
template < class T > ostream& operator<<(ostream& stream, const vector<T> v){ stream << "[ "; for (int i=0; i<(int)v.size(); i++) stream << v[i] << " "; stream << "]"; return stream;}
template < class T > T smin(T &a,T b) {if (a > b) a = b;return a;}
template < class T > T smax(T &a,T b) {if (a < b) a = b;return a;}
const int NN = 256;
int st[NN];
const int A[] = {1,2,4,4,4,4,2,4};
const int B[] = {0,1,0,1,2,0,1,3};
void Anna(int N,ll X,int K,int P[]) {
int n = N;
for (int i = 0;i < N;++i)
st[i] = 0;
for (int i = 0;i < K;++i)
st[P[i]] = 1;
for (int i = 0;i < N;i += 3) {
int bl = st[i] + st[i + 1] * 2 + st[i + 2] * 4;
int mask = 0;
for (int j = 1;j < 8;++j)
if (!(j & bl) && (X & (A[j] - 1)) == B[j]) {
if (A[mask] < A[j])
mask = j;
}
assert(A[mask] >= 2 - st[i] - st[i + 1] - st[i + 2]);
for (int j = 0;j < 3;++j)
Set(i + j,(mask >> j) & 1);
X /= A[mask];
}
}
#include "Brunolib.h"
#include "bits/stdc++.h"
using namespace std;
#define fi first
#define se second
#define ll long long
#define dbg(v) cerr<<#v<<" = "<<v<<'\n'
#define vi vector<int>
#define vl vector <ll>
#define pii pair<int,int>
#define vii vector < pii >
#define mp make_pair
#define db long double
#define pb push_back
#define all(s) s.begin(),s.end()
template < class P , class Q > ostream& operator<<(ostream& stream, pair < P , Q > v){ stream << "(" << v.fi << ',' << v.se << ")"; return stream;}
template < class T > ostream& operator<<(ostream& stream, const vector<T> v){ stream << "[ "; for (int i=0; i<(int)v.size(); i++) stream << v[i] << " "; stream << "]"; return stream;}
template < class T > T smin(T &a,T b) {if (a > b) a = b;return a;}
template < class T > T smax(T &a,T b) {if (a < b) a = b;return a;}
const int A[] = {1,2,4,4,4,4,2,4};
const int B[] = {0,1,0,1,2,0,1,3};
long long Bruno( int N, int S[] ){
int n = N;
ll ans = 0;
ll was = 1;
for (int i = 0;i < N;i += 3) {
int cnt = S[i] + S[i + 1] * 2 + S[i + 2] * 4;
ans += was * B[cnt];
was *= A[cnt];
}
return ans;
}
Compilation message
Anna.cpp: In function 'void Anna(int, long long int, int, int*)':
Anna.cpp:29:8: warning: unused variable 'n' [-Wunused-variable]
int n = N;
^
Bruno.cpp: In function 'long long int Bruno(int, int*)':
Bruno.cpp:25:6: warning: unused variable 'n' [-Wunused-variable]
int n = N;
^
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Partially correct |
70 ms |
2800 KB |
Output is partially correct - L* = 24 |
2 |
Partially correct |
60 ms |
3192 KB |
Output is partially correct - L* = 22 |
3 |
Partially correct |
57 ms |
3192 KB |
Output is partially correct - L* = 21 |
4 |
Partially correct |
66 ms |
3448 KB |
Output is partially correct - L* = 23 |
5 |
Partially correct |
72 ms |
3472 KB |
Output is partially correct - L* = 20 |
6 |
Partially correct |
52 ms |
3736 KB |
Output is partially correct - L* = 24 |
7 |
Partially correct |
78 ms |
3736 KB |
Output is partially correct - L* = 24 |
8 |
Partially correct |
55 ms |
3736 KB |
Output is partially correct - L* = 21 |
9 |
Partially correct |
48 ms |
3736 KB |
Output is partially correct - L* = 20 |
10 |
Partially correct |
51 ms |
3744 KB |
Output is partially correct - L* = 25 |
11 |
Partially correct |
48 ms |
3744 KB |
Output is partially correct - L* = 22 |
12 |
Partially correct |
50 ms |
3744 KB |
Output is partially correct - L* = 24 |
13 |
Partially correct |
70 ms |
3744 KB |
Output is partially correct - L* = 25 |
14 |
Partially correct |
62 ms |
3744 KB |
Output is partially correct - L* = 24 |
15 |
Partially correct |
56 ms |
3744 KB |
Output is partially correct - L* = 21 |
16 |
Partially correct |
48 ms |
3744 KB |
Output is partially correct - L* = 23 |
17 |
Partially correct |
61 ms |
3744 KB |
Output is partially correct - L* = 21 |
18 |
Partially correct |
54 ms |
3744 KB |
Output is partially correct - L* = 25 |
19 |
Partially correct |
77 ms |
3744 KB |
Output is partially correct - L* = 24 |
20 |
Partially correct |
48 ms |
3744 KB |
Output is partially correct - L* = 21 |
21 |
Partially correct |
56 ms |
3744 KB |
Output is partially correct - L* = 20 |
22 |
Partially correct |
52 ms |
3744 KB |
Output is partially correct - L* = 20 |
23 |
Partially correct |
57 ms |
3744 KB |
Output is partially correct - L* = 20 |
24 |
Partially correct |
54 ms |
3744 KB |
Output is partially correct - L* = 23 |
25 |
Partially correct |
49 ms |
3744 KB |
Output is partially correct - L* = 24 |
26 |
Partially correct |
52 ms |
3744 KB |
Output is partially correct - L* = 25 |
27 |
Partially correct |
49 ms |
3744 KB |
Output is partially correct - L* = 22 |
28 |
Partially correct |
54 ms |
3976 KB |
Output is partially correct - L* = 24 |
29 |
Partially correct |
48 ms |
3976 KB |
Output is partially correct - L* = 23 |
30 |
Partially correct |
50 ms |
3976 KB |
Output is partially correct - L* = 23 |
31 |
Partially correct |
55 ms |
3976 KB |
Output is partially correct - L* = 22 |
32 |
Partially correct |
53 ms |
3976 KB |
Output is partially correct - L* = 23 |
33 |
Partially correct |
51 ms |
3976 KB |
Output is partially correct - L* = 22 |
34 |
Partially correct |
47 ms |
3976 KB |
Output is partially correct - L* = 27 |
35 |
Partially correct |
60 ms |
3976 KB |
Output is partially correct - L* = 20 |
36 |
Partially correct |
57 ms |
3976 KB |
Output is partially correct - L* = 22 |
37 |
Partially correct |
63 ms |
3976 KB |
Output is partially correct - L* = 20 |
38 |
Partially correct |
48 ms |
3976 KB |
Output is partially correct - L* = 22 |
39 |
Partially correct |
68 ms |
3976 KB |
Output is partially correct - L* = 25 |
40 |
Partially correct |
53 ms |
3976 KB |
Output is partially correct - L* = 22 |