#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 300;
}
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),s.pb(1);
else s.pb(0),s.pb(0),s.pb(0),s.pb(0),s.pb(0);
}
for (i = 0; i < 300; 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)/5;
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 |
138 ms |
5388 KB |
Output is correct |
3 |
Correct |
123 ms |
5512 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
520 KB |
Output is correct |
2 |
Correct |
138 ms |
5388 KB |
Output is correct |
3 |
Correct |
123 ms |
5512 KB |
Output is correct |
4 |
Correct |
130 ms |
5348 KB |
Output is correct |
5 |
Correct |
143 ms |
5352 KB |
Output is correct |
6 |
Correct |
139 ms |
5496 KB |
Output is correct |
7 |
Correct |
124 ms |
5420 KB |
Output is correct |
8 |
Correct |
132 ms |
5380 KB |
Output is correct |
9 |
Correct |
132 ms |
5288 KB |
Output is correct |
10 |
Correct |
120 ms |
5440 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
520 KB |
Output is correct |
2 |
Correct |
138 ms |
5388 KB |
Output is correct |
3 |
Correct |
123 ms |
5512 KB |
Output is correct |
4 |
Correct |
130 ms |
5348 KB |
Output is correct |
5 |
Correct |
143 ms |
5352 KB |
Output is correct |
6 |
Correct |
139 ms |
5496 KB |
Output is correct |
7 |
Correct |
124 ms |
5420 KB |
Output is correct |
8 |
Correct |
132 ms |
5380 KB |
Output is correct |
9 |
Correct |
132 ms |
5288 KB |
Output is correct |
10 |
Correct |
120 ms |
5440 KB |
Output is correct |
11 |
Correct |
154 ms |
5436 KB |
Output is correct |
12 |
Correct |
131 ms |
5256 KB |
Output is correct |
13 |
Correct |
126 ms |
5320 KB |
Output is correct |
14 |
Correct |
132 ms |
5224 KB |
Output is correct |
15 |
Correct |
125 ms |
5488 KB |
Output is correct |
16 |
Correct |
141 ms |
5340 KB |
Output is correct |
17 |
Correct |
119 ms |
5324 KB |
Output is correct |
18 |
Correct |
134 ms |
5316 KB |
Output is correct |
19 |
Correct |
144 ms |
5468 KB |
Output is correct |
20 |
Correct |
123 ms |
5236 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
520 KB |
Output is correct |
2 |
Correct |
138 ms |
5388 KB |
Output is correct |
3 |
Correct |
123 ms |
5512 KB |
Output is correct |
4 |
Correct |
130 ms |
5348 KB |
Output is correct |
5 |
Correct |
143 ms |
5352 KB |
Output is correct |
6 |
Correct |
139 ms |
5496 KB |
Output is correct |
7 |
Correct |
124 ms |
5420 KB |
Output is correct |
8 |
Correct |
132 ms |
5380 KB |
Output is correct |
9 |
Correct |
132 ms |
5288 KB |
Output is correct |
10 |
Correct |
120 ms |
5440 KB |
Output is correct |
11 |
Correct |
154 ms |
5436 KB |
Output is correct |
12 |
Correct |
131 ms |
5256 KB |
Output is correct |
13 |
Correct |
126 ms |
5320 KB |
Output is correct |
14 |
Correct |
132 ms |
5224 KB |
Output is correct |
15 |
Correct |
125 ms |
5488 KB |
Output is correct |
16 |
Correct |
141 ms |
5340 KB |
Output is correct |
17 |
Correct |
119 ms |
5324 KB |
Output is correct |
18 |
Correct |
134 ms |
5316 KB |
Output is correct |
19 |
Correct |
144 ms |
5468 KB |
Output is correct |
20 |
Correct |
123 ms |
5236 KB |
Output is correct |
21 |
Correct |
152 ms |
5344 KB |
Output is correct |
22 |
Correct |
129 ms |
5340 KB |
Output is correct |
23 |
Correct |
131 ms |
5416 KB |
Output is correct |
24 |
Correct |
133 ms |
5260 KB |
Output is correct |
25 |
Correct |
125 ms |
5344 KB |
Output is correct |
26 |
Correct |
135 ms |
5348 KB |
Output is correct |
27 |
Correct |
123 ms |
5344 KB |
Output is correct |
28 |
Correct |
134 ms |
5356 KB |
Output is correct |
29 |
Correct |
147 ms |
5300 KB |
Output is correct |
30 |
Correct |
126 ms |
5356 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
520 KB |
Output is correct |
2 |
Correct |
138 ms |
5388 KB |
Output is correct |
3 |
Correct |
123 ms |
5512 KB |
Output is correct |
4 |
Correct |
130 ms |
5348 KB |
Output is correct |
5 |
Correct |
143 ms |
5352 KB |
Output is correct |
6 |
Correct |
139 ms |
5496 KB |
Output is correct |
7 |
Correct |
124 ms |
5420 KB |
Output is correct |
8 |
Correct |
132 ms |
5380 KB |
Output is correct |
9 |
Correct |
132 ms |
5288 KB |
Output is correct |
10 |
Correct |
120 ms |
5440 KB |
Output is correct |
11 |
Correct |
154 ms |
5436 KB |
Output is correct |
12 |
Correct |
131 ms |
5256 KB |
Output is correct |
13 |
Correct |
126 ms |
5320 KB |
Output is correct |
14 |
Correct |
132 ms |
5224 KB |
Output is correct |
15 |
Correct |
125 ms |
5488 KB |
Output is correct |
16 |
Correct |
141 ms |
5340 KB |
Output is correct |
17 |
Correct |
119 ms |
5324 KB |
Output is correct |
18 |
Correct |
134 ms |
5316 KB |
Output is correct |
19 |
Correct |
144 ms |
5468 KB |
Output is correct |
20 |
Correct |
123 ms |
5236 KB |
Output is correct |
21 |
Correct |
152 ms |
5344 KB |
Output is correct |
22 |
Correct |
129 ms |
5340 KB |
Output is correct |
23 |
Correct |
131 ms |
5416 KB |
Output is correct |
24 |
Correct |
133 ms |
5260 KB |
Output is correct |
25 |
Correct |
125 ms |
5344 KB |
Output is correct |
26 |
Correct |
135 ms |
5348 KB |
Output is correct |
27 |
Correct |
123 ms |
5344 KB |
Output is correct |
28 |
Correct |
134 ms |
5356 KB |
Output is correct |
29 |
Correct |
147 ms |
5300 KB |
Output is correct |
30 |
Correct |
126 ms |
5356 KB |
Output is correct |
31 |
Correct |
142 ms |
5384 KB |
Output is correct |
32 |
Correct |
132 ms |
5384 KB |
Output is correct |
33 |
Correct |
134 ms |
5488 KB |
Output is correct |
34 |
Correct |
130 ms |
5272 KB |
Output is correct |
35 |
Correct |
142 ms |
5408 KB |
Output is correct |
36 |
Correct |
127 ms |
5416 KB |
Output is correct |
37 |
Correct |
132 ms |
5432 KB |
Output is correct |
38 |
Correct |
139 ms |
5316 KB |
Output is correct |
39 |
Correct |
139 ms |
5456 KB |
Output is correct |
40 |
Correct |
129 ms |
5332 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Partially correct |
145 ms |
5476 KB |
Output is partially correct |
2 |
Partially correct |
141 ms |
5444 KB |
Output is partially correct |
3 |
Partially correct |
134 ms |
5616 KB |
Output is partially correct |
4 |
Partially correct |
138 ms |
5384 KB |
Output is partially correct |
5 |
Partially correct |
131 ms |
5368 KB |
Output is partially correct |
6 |
Partially correct |
153 ms |
5416 KB |
Output is partially correct |
7 |
Partially correct |
133 ms |
5332 KB |
Output is partially correct |
8 |
Partially correct |
132 ms |
5388 KB |
Output is partially correct |
9 |
Partially correct |
135 ms |
5388 KB |
Output is partially correct |
10 |
Partially correct |
130 ms |
5408 KB |
Output is partially correct |
11 |
Partially correct |
133 ms |
5612 KB |
Output is partially correct |
12 |
Partially correct |
141 ms |
5480 KB |
Output is partially correct |
13 |
Partially correct |
129 ms |
5360 KB |
Output is partially correct |
14 |
Partially correct |
132 ms |
5604 KB |
Output is partially correct |
15 |
Partially correct |
138 ms |
5320 KB |
Output is partially correct |
16 |
Partially correct |
127 ms |
5288 KB |
Output is partially correct |
17 |
Partially correct |
154 ms |
5300 KB |
Output is partially correct |
18 |
Partially correct |
126 ms |
5328 KB |
Output is partially correct |
19 |
Partially correct |
145 ms |
5448 KB |
Output is partially correct |
20 |
Partially correct |
149 ms |
5440 KB |
Output is partially correct |