#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 180;
}
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);
else s.pb(0),s.pb(0),s.pb(0);
}
for (i = 0; i < 180; 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)/3;
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 |
520 KB |
Output is correct |
2 |
Correct |
80 ms |
3328 KB |
Output is correct |
3 |
Correct |
78 ms |
3360 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
520 KB |
Output is correct |
2 |
Correct |
80 ms |
3328 KB |
Output is correct |
3 |
Correct |
78 ms |
3360 KB |
Output is correct |
4 |
Correct |
91 ms |
3368 KB |
Output is correct |
5 |
Correct |
82 ms |
3516 KB |
Output is correct |
6 |
Correct |
79 ms |
3464 KB |
Output is correct |
7 |
Correct |
87 ms |
3480 KB |
Output is correct |
8 |
Correct |
83 ms |
3436 KB |
Output is correct |
9 |
Correct |
83 ms |
3428 KB |
Output is correct |
10 |
Correct |
92 ms |
3380 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
520 KB |
Output is correct |
2 |
Correct |
80 ms |
3328 KB |
Output is correct |
3 |
Correct |
78 ms |
3360 KB |
Output is correct |
4 |
Correct |
91 ms |
3368 KB |
Output is correct |
5 |
Correct |
82 ms |
3516 KB |
Output is correct |
6 |
Correct |
79 ms |
3464 KB |
Output is correct |
7 |
Correct |
87 ms |
3480 KB |
Output is correct |
8 |
Correct |
83 ms |
3436 KB |
Output is correct |
9 |
Correct |
83 ms |
3428 KB |
Output is correct |
10 |
Correct |
92 ms |
3380 KB |
Output is correct |
11 |
Correct |
89 ms |
3660 KB |
Output is correct |
12 |
Correct |
99 ms |
3452 KB |
Output is correct |
13 |
Correct |
98 ms |
3448 KB |
Output is correct |
14 |
Correct |
86 ms |
3336 KB |
Output is correct |
15 |
Correct |
83 ms |
3404 KB |
Output is correct |
16 |
Correct |
78 ms |
3420 KB |
Output is correct |
17 |
Correct |
88 ms |
3528 KB |
Output is correct |
18 |
Correct |
92 ms |
3428 KB |
Output is correct |
19 |
Correct |
79 ms |
3520 KB |
Output is correct |
20 |
Correct |
84 ms |
3480 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
520 KB |
Output is correct |
2 |
Correct |
80 ms |
3328 KB |
Output is correct |
3 |
Correct |
78 ms |
3360 KB |
Output is correct |
4 |
Correct |
91 ms |
3368 KB |
Output is correct |
5 |
Correct |
82 ms |
3516 KB |
Output is correct |
6 |
Correct |
79 ms |
3464 KB |
Output is correct |
7 |
Correct |
87 ms |
3480 KB |
Output is correct |
8 |
Correct |
83 ms |
3436 KB |
Output is correct |
9 |
Correct |
83 ms |
3428 KB |
Output is correct |
10 |
Correct |
92 ms |
3380 KB |
Output is correct |
11 |
Correct |
89 ms |
3660 KB |
Output is correct |
12 |
Correct |
99 ms |
3452 KB |
Output is correct |
13 |
Correct |
98 ms |
3448 KB |
Output is correct |
14 |
Correct |
86 ms |
3336 KB |
Output is correct |
15 |
Correct |
83 ms |
3404 KB |
Output is correct |
16 |
Correct |
78 ms |
3420 KB |
Output is correct |
17 |
Correct |
88 ms |
3528 KB |
Output is correct |
18 |
Correct |
92 ms |
3428 KB |
Output is correct |
19 |
Correct |
79 ms |
3520 KB |
Output is correct |
20 |
Correct |
84 ms |
3480 KB |
Output is correct |
21 |
Correct |
89 ms |
3360 KB |
Output is correct |
22 |
Correct |
83 ms |
3436 KB |
Output is correct |
23 |
Correct |
80 ms |
3436 KB |
Output is correct |
24 |
Correct |
81 ms |
3532 KB |
Output is correct |
25 |
Correct |
100 ms |
3480 KB |
Output is correct |
26 |
Correct |
83 ms |
3368 KB |
Output is correct |
27 |
Correct |
74 ms |
3400 KB |
Output is correct |
28 |
Correct |
83 ms |
3328 KB |
Output is correct |
29 |
Correct |
99 ms |
3464 KB |
Output is correct |
30 |
Correct |
80 ms |
3396 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
520 KB |
Output is correct |
2 |
Correct |
80 ms |
3328 KB |
Output is correct |
3 |
Correct |
78 ms |
3360 KB |
Output is correct |
4 |
Correct |
91 ms |
3368 KB |
Output is correct |
5 |
Correct |
82 ms |
3516 KB |
Output is correct |
6 |
Correct |
79 ms |
3464 KB |
Output is correct |
7 |
Correct |
87 ms |
3480 KB |
Output is correct |
8 |
Correct |
83 ms |
3436 KB |
Output is correct |
9 |
Correct |
83 ms |
3428 KB |
Output is correct |
10 |
Correct |
92 ms |
3380 KB |
Output is correct |
11 |
Correct |
89 ms |
3660 KB |
Output is correct |
12 |
Correct |
99 ms |
3452 KB |
Output is correct |
13 |
Correct |
98 ms |
3448 KB |
Output is correct |
14 |
Correct |
86 ms |
3336 KB |
Output is correct |
15 |
Correct |
83 ms |
3404 KB |
Output is correct |
16 |
Correct |
78 ms |
3420 KB |
Output is correct |
17 |
Correct |
88 ms |
3528 KB |
Output is correct |
18 |
Correct |
92 ms |
3428 KB |
Output is correct |
19 |
Correct |
79 ms |
3520 KB |
Output is correct |
20 |
Correct |
84 ms |
3480 KB |
Output is correct |
21 |
Correct |
89 ms |
3360 KB |
Output is correct |
22 |
Correct |
83 ms |
3436 KB |
Output is correct |
23 |
Correct |
80 ms |
3436 KB |
Output is correct |
24 |
Correct |
81 ms |
3532 KB |
Output is correct |
25 |
Correct |
100 ms |
3480 KB |
Output is correct |
26 |
Correct |
83 ms |
3368 KB |
Output is correct |
27 |
Correct |
74 ms |
3400 KB |
Output is correct |
28 |
Correct |
83 ms |
3328 KB |
Output is correct |
29 |
Correct |
99 ms |
3464 KB |
Output is correct |
30 |
Correct |
80 ms |
3396 KB |
Output is correct |
31 |
Correct |
81 ms |
3420 KB |
Output is correct |
32 |
Correct |
97 ms |
3436 KB |
Output is correct |
33 |
Correct |
93 ms |
3440 KB |
Output is correct |
34 |
Correct |
80 ms |
3400 KB |
Output is correct |
35 |
Correct |
82 ms |
3396 KB |
Output is correct |
36 |
Correct |
80 ms |
3352 KB |
Output is correct |
37 |
Correct |
82 ms |
3472 KB |
Output is correct |
38 |
Correct |
80 ms |
3504 KB |
Output is correct |
39 |
Correct |
80 ms |
3464 KB |
Output is correct |
40 |
Correct |
89 ms |
3436 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Partially correct |
83 ms |
3500 KB |
Output is partially correct |
2 |
Partially correct |
87 ms |
3484 KB |
Output is partially correct |
3 |
Partially correct |
82 ms |
3552 KB |
Output is partially correct |
4 |
Partially correct |
90 ms |
3484 KB |
Output is partially correct |
5 |
Partially correct |
82 ms |
3352 KB |
Output is partially correct |
6 |
Partially correct |
89 ms |
3492 KB |
Output is partially correct |
7 |
Partially correct |
91 ms |
3460 KB |
Output is partially correct |
8 |
Partially correct |
88 ms |
3360 KB |
Output is partially correct |
9 |
Partially correct |
80 ms |
3508 KB |
Output is partially correct |
10 |
Partially correct |
81 ms |
3480 KB |
Output is partially correct |
11 |
Partially correct |
86 ms |
3440 KB |
Output is partially correct |
12 |
Partially correct |
93 ms |
3484 KB |
Output is partially correct |
13 |
Partially correct |
79 ms |
3544 KB |
Output is partially correct |
14 |
Partially correct |
74 ms |
3360 KB |
Output is partially correct |
15 |
Partially correct |
92 ms |
3568 KB |
Output is partially correct |
16 |
Partially correct |
101 ms |
3452 KB |
Output is partially correct |
17 |
Partially correct |
80 ms |
3336 KB |
Output is partially correct |
18 |
Partially correct |
80 ms |
3492 KB |
Output is partially correct |
19 |
Partially correct |
91 ms |
3476 KB |
Output is partially correct |
20 |
Partially correct |
94 ms |
3392 KB |
Output is partially correct |