#define DEBUG 0
#include <bits/stdc++.h>
using namespace std;
#if DEBUG
// basic debugging macros
int __i__,__j__;
#define printLine(l) for(__i__=0;__i__<l;__i__++){cout<<"-";}cout<<endl
#define printLine2(l,c) for(__i__=0;__i__<l;__i__++){cout<<c;}cout<<endl
#define printVar(n) cout<<#n<<": "<<n<<endl
#define printArr(a,l) cout<<#a<<": ";for(__i__=0;__i__<l;__i__++){cout<<a[__i__]<<" ";}cout<<endl
#define print2dArr(a,r,c) cout<<#a<<":\n";for(__i__=0;__i__<r;__i__++){for(__j__=0;__j__<c;__j__++){cout<<a[__i__][__j__]<<" ";}cout<<endl;}
#define print2dArr2(a,r,c,l) cout<<#a<<":\n";for(__i__=0;__i__<r;__i__++){for(__j__=0;__j__<c;__j__++){cout<<setw(l)<<setfill(' ')<<a[__i__][__j__]<<" ";}cout<<endl;}
// advanced debugging class
// debug 1,2,'A',"test";
class _Debug {
public:
template<typename T>
_Debug& operator,(T val) {
cout << val << endl;
return *this;
}
};
#define debug _Debug(),
#else
#define printLine(l)
#define printLine2(l,c)
#define printVar(n)
#define printArr(a,l)
#define print2dArr(a,r,c)
#define print2dArr2(a,r,c,l)
#define debug
#endif
// define
#define MAX_VAL 999999999
#define MAX_VAL_2 999999999999999999LL
#define EPS 1e-6
#define mp make_pair
#define pb push_back
// typedef
typedef unsigned int UI;
typedef long long int LLI;
typedef unsigned long long int ULLI;
typedef unsigned short int US;
typedef pair<int,int> pii;
typedef pair<LLI,LLI> plli;
typedef vector<int> vi;
typedef vector<LLI> vlli;
typedef vector<pii> vpii;
typedef vector<plli> vplli;
// ---------- END OF TEMPLATE ----------
#include "Anna.h"
int Declare() {
return 240;
}
pair<vector<int>,vector<int> > Anna(long long int A) {
int i;
vi s,t;
for (i = 0; i < 60; i++) {
if (A & (1LL << i)) s.pb(1),s.pb(1),s.pb(1),s.pb(1);
else s.pb(0),s.pb(0),s.pb(0),s.pb(0);
}
for (i = 0; i < 240; i++) t.pb(i & 1);
return mp(s,t);
}
#define DEBUG 0
#include <bits/stdc++.h>
using namespace std;
#if DEBUG
// basic debugging macros
int __i__,__j__;
#define printLine(l) for(__i__=0;__i__<l;__i__++){cout<<"-";}cout<<endl
#define printLine2(l,c) for(__i__=0;__i__<l;__i__++){cout<<c;}cout<<endl
#define printVar(n) cout<<#n<<": "<<n<<endl
#define printArr(a,l) cout<<#a<<": ";for(__i__=0;__i__<l;__i__++){cout<<a[__i__]<<" ";}cout<<endl
#define print2dArr(a,r,c) cout<<#a<<":\n";for(__i__=0;__i__<r;__i__++){for(__j__=0;__j__<c;__j__++){cout<<a[__i__][__j__]<<" ";}cout<<endl;}
#define print2dArr2(a,r,c,l) cout<<#a<<":\n";for(__i__=0;__i__<r;__i__++){for(__j__=0;__j__<c;__j__++){cout<<setw(l)<<setfill(' ')<<a[__i__][__j__]<<" ";}cout<<endl;}
// advanced debugging class
// debug 1,2,'A',"test";
class _Debug {
public:
template<typename T>
_Debug& operator,(T val) {
cout << val << endl;
return *this;
}
};
#define debug _Debug(),
#else
#define printLine(l)
#define printLine2(l,c)
#define printVar(n)
#define printArr(a,l)
#define print2dArr(a,r,c)
#define print2dArr2(a,r,c,l)
#define debug
#endif
// define
#define MAX_VAL 999999999
#define MAX_VAL_2 999999999999999999LL
#define EPS 1e-6
#define mp make_pair
#define pb push_back
// typedef
typedef unsigned int UI;
typedef long long int LLI;
typedef unsigned long long int ULLI;
typedef unsigned short int US;
typedef pair<int,int> pii;
typedef pair<LLI,LLI> plli;
typedef vector<int> vi;
typedef vector<LLI> vlli;
typedef vector<pii> vpii;
typedef vector<plli> vplli;
// ---------- END OF TEMPLATE ----------
#include "Bruno.h"
long long int Bruno(vector<int> u) {
vi v;
for (int x: u) {
v.pb(x);
if ((v.size() >= 4) && (v[v.size()-4] != v[v.size()-3]) && (v[v.size()-3] != v[v.size()-2]) \
&& (v[v.size()-2] != v.back())) v.pop_back(),v.pop_back();
}
vpii v2,v3;
for (int x: v) {
if (v2.empty()) v2.pb(mp(x,1));
else if (v2.back().first == x) v2.back().second++;
else v2.pb(mp(x,1));
}
for (pii p: v2) {
if (p.second != 1) v3.pb(p);
}
int i = 0;
vpii v4;
while (i < v3.size()) {
int j = i,s = 0;
while ((j < v3.size()) && (v3[i].first == v3[j].first)) s += v3[j].second,j++;
v4.pb(mp(s-(j-i),v3[i].first));
i = j;
}
vi bits;
for (auto [x,b]: v4) {
x = (x+2)/4;
while (x--) bits.pb(b);
}
assert(bits.size() == 60);
LLI A = 0;
for (i = 0; i < bits.size(); i++) {
if (bits[i]) A |= (1LL << i);
}
return A;
}
Compilation message
Bruno.cpp: In function 'long long int Bruno(std::vector<int>)':
Bruno.cpp:77:14: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<std::pair<int, int> >::size_type' {aka 'long unsigned int'} [-Wsign-compare]
77 | while (i < v3.size()) {
| ~~^~~~~~~~~~~
Bruno.cpp:79:19: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<std::pair<int, int> >::size_type' {aka 'long unsigned int'} [-Wsign-compare]
79 | while ((j < v3.size()) && (v3[i].first == v3[j].first)) s += v3[j].second,j++;
| ~~^~~~~~~~~~~
Bruno.cpp:90:19: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
90 | for (i = 0; i < bits.size(); i++) {
| ~~^~~~~~~~~~~~~
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
516 KB |
Output is correct |
2 |
Correct |
101 ms |
4368 KB |
Output is correct |
3 |
Correct |
99 ms |
4432 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
516 KB |
Output is correct |
2 |
Correct |
101 ms |
4368 KB |
Output is correct |
3 |
Correct |
99 ms |
4432 KB |
Output is correct |
4 |
Correct |
103 ms |
4352 KB |
Output is correct |
5 |
Correct |
102 ms |
4320 KB |
Output is correct |
6 |
Correct |
102 ms |
4384 KB |
Output is correct |
7 |
Correct |
102 ms |
4352 KB |
Output is correct |
8 |
Correct |
105 ms |
4384 KB |
Output is correct |
9 |
Correct |
102 ms |
4332 KB |
Output is correct |
10 |
Correct |
97 ms |
4392 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
516 KB |
Output is correct |
2 |
Correct |
101 ms |
4368 KB |
Output is correct |
3 |
Correct |
99 ms |
4432 KB |
Output is correct |
4 |
Correct |
103 ms |
4352 KB |
Output is correct |
5 |
Correct |
102 ms |
4320 KB |
Output is correct |
6 |
Correct |
102 ms |
4384 KB |
Output is correct |
7 |
Correct |
102 ms |
4352 KB |
Output is correct |
8 |
Correct |
105 ms |
4384 KB |
Output is correct |
9 |
Correct |
102 ms |
4332 KB |
Output is correct |
10 |
Correct |
97 ms |
4392 KB |
Output is correct |
11 |
Correct |
105 ms |
4504 KB |
Output is correct |
12 |
Correct |
105 ms |
4372 KB |
Output is correct |
13 |
Correct |
104 ms |
4452 KB |
Output is correct |
14 |
Correct |
104 ms |
4572 KB |
Output is correct |
15 |
Correct |
102 ms |
4400 KB |
Output is correct |
16 |
Correct |
100 ms |
4456 KB |
Output is correct |
17 |
Correct |
100 ms |
4292 KB |
Output is correct |
18 |
Correct |
100 ms |
4388 KB |
Output is correct |
19 |
Correct |
104 ms |
4404 KB |
Output is correct |
20 |
Correct |
101 ms |
4488 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
516 KB |
Output is correct |
2 |
Correct |
101 ms |
4368 KB |
Output is correct |
3 |
Correct |
99 ms |
4432 KB |
Output is correct |
4 |
Correct |
103 ms |
4352 KB |
Output is correct |
5 |
Correct |
102 ms |
4320 KB |
Output is correct |
6 |
Correct |
102 ms |
4384 KB |
Output is correct |
7 |
Correct |
102 ms |
4352 KB |
Output is correct |
8 |
Correct |
105 ms |
4384 KB |
Output is correct |
9 |
Correct |
102 ms |
4332 KB |
Output is correct |
10 |
Correct |
97 ms |
4392 KB |
Output is correct |
11 |
Correct |
105 ms |
4504 KB |
Output is correct |
12 |
Correct |
105 ms |
4372 KB |
Output is correct |
13 |
Correct |
104 ms |
4452 KB |
Output is correct |
14 |
Correct |
104 ms |
4572 KB |
Output is correct |
15 |
Correct |
102 ms |
4400 KB |
Output is correct |
16 |
Correct |
100 ms |
4456 KB |
Output is correct |
17 |
Correct |
100 ms |
4292 KB |
Output is correct |
18 |
Correct |
100 ms |
4388 KB |
Output is correct |
19 |
Correct |
104 ms |
4404 KB |
Output is correct |
20 |
Correct |
101 ms |
4488 KB |
Output is correct |
21 |
Correct |
105 ms |
4340 KB |
Output is correct |
22 |
Correct |
104 ms |
4480 KB |
Output is correct |
23 |
Correct |
105 ms |
4392 KB |
Output is correct |
24 |
Correct |
104 ms |
4364 KB |
Output is correct |
25 |
Correct |
103 ms |
4404 KB |
Output is correct |
26 |
Correct |
100 ms |
4328 KB |
Output is correct |
27 |
Correct |
98 ms |
4336 KB |
Output is correct |
28 |
Correct |
102 ms |
4352 KB |
Output is correct |
29 |
Correct |
112 ms |
4324 KB |
Output is correct |
30 |
Correct |
107 ms |
4288 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
516 KB |
Output is correct |
2 |
Correct |
101 ms |
4368 KB |
Output is correct |
3 |
Correct |
99 ms |
4432 KB |
Output is correct |
4 |
Correct |
103 ms |
4352 KB |
Output is correct |
5 |
Correct |
102 ms |
4320 KB |
Output is correct |
6 |
Correct |
102 ms |
4384 KB |
Output is correct |
7 |
Correct |
102 ms |
4352 KB |
Output is correct |
8 |
Correct |
105 ms |
4384 KB |
Output is correct |
9 |
Correct |
102 ms |
4332 KB |
Output is correct |
10 |
Correct |
97 ms |
4392 KB |
Output is correct |
11 |
Correct |
105 ms |
4504 KB |
Output is correct |
12 |
Correct |
105 ms |
4372 KB |
Output is correct |
13 |
Correct |
104 ms |
4452 KB |
Output is correct |
14 |
Correct |
104 ms |
4572 KB |
Output is correct |
15 |
Correct |
102 ms |
4400 KB |
Output is correct |
16 |
Correct |
100 ms |
4456 KB |
Output is correct |
17 |
Correct |
100 ms |
4292 KB |
Output is correct |
18 |
Correct |
100 ms |
4388 KB |
Output is correct |
19 |
Correct |
104 ms |
4404 KB |
Output is correct |
20 |
Correct |
101 ms |
4488 KB |
Output is correct |
21 |
Correct |
105 ms |
4340 KB |
Output is correct |
22 |
Correct |
104 ms |
4480 KB |
Output is correct |
23 |
Correct |
105 ms |
4392 KB |
Output is correct |
24 |
Correct |
104 ms |
4364 KB |
Output is correct |
25 |
Correct |
103 ms |
4404 KB |
Output is correct |
26 |
Correct |
100 ms |
4328 KB |
Output is correct |
27 |
Correct |
98 ms |
4336 KB |
Output is correct |
28 |
Correct |
102 ms |
4352 KB |
Output is correct |
29 |
Correct |
112 ms |
4324 KB |
Output is correct |
30 |
Correct |
107 ms |
4288 KB |
Output is correct |
31 |
Correct |
108 ms |
4276 KB |
Output is correct |
32 |
Correct |
106 ms |
4448 KB |
Output is correct |
33 |
Correct |
104 ms |
4388 KB |
Output is correct |
34 |
Correct |
102 ms |
4296 KB |
Output is correct |
35 |
Correct |
107 ms |
4348 KB |
Output is correct |
36 |
Correct |
101 ms |
4308 KB |
Output is correct |
37 |
Correct |
96 ms |
4384 KB |
Output is correct |
38 |
Correct |
100 ms |
4268 KB |
Output is correct |
39 |
Correct |
103 ms |
4264 KB |
Output is correct |
40 |
Correct |
104 ms |
4424 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Partially correct |
105 ms |
4348 KB |
Output is partially correct |
2 |
Partially correct |
104 ms |
4412 KB |
Output is partially correct |
3 |
Partially correct |
106 ms |
4368 KB |
Output is partially correct |
4 |
Partially correct |
107 ms |
4440 KB |
Output is partially correct |
5 |
Partially correct |
105 ms |
4312 KB |
Output is partially correct |
6 |
Partially correct |
106 ms |
4304 KB |
Output is partially correct |
7 |
Partially correct |
106 ms |
4372 KB |
Output is partially correct |
8 |
Partially correct |
110 ms |
4364 KB |
Output is partially correct |
9 |
Partially correct |
117 ms |
4332 KB |
Output is partially correct |
10 |
Partially correct |
108 ms |
4436 KB |
Output is partially correct |
11 |
Partially correct |
106 ms |
4396 KB |
Output is partially correct |
12 |
Partially correct |
105 ms |
4480 KB |
Output is partially correct |
13 |
Partially correct |
102 ms |
4456 KB |
Output is partially correct |
14 |
Partially correct |
105 ms |
4436 KB |
Output is partially correct |
15 |
Partially correct |
108 ms |
4412 KB |
Output is partially correct |
16 |
Partially correct |
108 ms |
4284 KB |
Output is partially correct |
17 |
Partially correct |
105 ms |
4376 KB |
Output is partially correct |
18 |
Partially correct |
111 ms |
4332 KB |
Output is partially correct |
19 |
Partially correct |
112 ms |
4328 KB |
Output is partially correct |
20 |
Partially correct |
107 ms |
4352 KB |
Output is partially correct |