//Challenge: Accepted
#include "Anna.h"
#include <iostream>
#include <algorithm>
#include <utility>
#include <vector>
#include <stack>
#include <queue>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace std;
//using namespace __gnu_pbds;
#define ll long long
#define maxn 100005
#define pii pair<int, int>
#define ff first
#define ss second
namespace{
ll fib[65];
}
void Anna(int N, vector<char> S) {
fib[0] = fib[1] = 1;
for (int i = 2;i < 64;i++) fib[i] = fib[i - 1] + fib[i - 2];
vector<int> bit (N, 0);
bool found = 0;
for (int i = 0;i < N;i++) {
if (S[i] == 'X' && !found) {
found = 1;
bit[i] = 1;
}
if (found && S[i] == 'Z' && (i == N - 1 || S[i + 1] != 'Z')) {
bit[i] = 1;
}
}
/*
for (int i = 0;i < N;i+=63){
ll send = 0;
for (int j = 0;j < 63;j++) send += fib[j+1] * (i + j < N ? bit[i+j] : 0);
for (int j = 0;j < 44;j++) {
Send((send & (1LL<<j)) ? 1 : 0);
}
}
*/
for (int i = 0;i < N;i++) Send(bit[i]);
}
/*
g++ -std=gnu++17 -O2 -fsigned-char -o grader grader.cpp Anna.cpp Bruno.cpp
*/
//Challenge: Accepted
#include "Bruno.h"
#include <iostream>
#include <algorithm>
#include <utility>
#include <vector>
#include <stack>
#include <queue>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace std;
//using namespace __gnu_pbds;
void debug(){cout << endl;}
template<class T, class ... U> void debug(T a, U ... b){cout << a << " ", debug(b ...);};
template<class T> void pary(T l, T r) {
while (l != r) cout << *l << " ", l++;
cout << endl;
}
#define ll long long
#define maxn 100005
#define pii pair<int, int>
#define ff first
#define ss second
namespace {
ll fib[65];
} // namespace
void Bruno(int N, int L, vector<int> A) {
fib[0] = fib[1] = 1;
for (int i = 2;i < 64;i++) fib[i] = fib[i - 1] + fib[i - 2];
vector<int> v = A;
/*
for (int i = 0;i < L;i += 44) {
ll num = 0;
for (int j = 0;j < 44;j++) num += (i + j < L ? ((ll)A[i+j])<<j : 0);
vector<int> tmp;
for (int j = 63;j > 0;j--) {
if (num >= fib[j]) {
num -= fib[j];
tmp.push_back(1);
} else{
tmp.push_back(0);
}
}
reverse(tmp.begin(), tmp.end());
v.insert(v.end(), tmp.begin(), tmp.end());
}
*/
bool found = 0;
int first = 0;
for (int i = 0;i < N;i++) {
if (v[i]) {
for (int j = i - 1;j >= 0;j--) {
if (v[j]) break;
Remove(j);
}
if (!found) found = 1, first = i;
else Remove(i);
}
}
for (int j = N - 1;j >= 0;j--) {
if (v[j]) break;
Remove(j);
}
if (found) Remove(first);
}
/*
5
X Y Z Y Z
*/
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
484 KB |
Output is correct |
2 |
Correct |
1 ms |
492 KB |
Output is correct |
3 |
Correct |
1 ms |
492 KB |
Output is correct |
4 |
Correct |
1 ms |
488 KB |
Output is correct |
5 |
Correct |
1 ms |
496 KB |
Output is correct |
6 |
Correct |
1 ms |
488 KB |
Output is correct |
7 |
Correct |
0 ms |
484 KB |
Output is correct |
8 |
Correct |
1 ms |
496 KB |
Output is correct |
9 |
Correct |
0 ms |
496 KB |
Output is correct |
10 |
Correct |
1 ms |
500 KB |
Output is correct |
11 |
Correct |
1 ms |
492 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Partially correct |
62 ms |
8148 KB |
Partially correct |
2 |
Partially correct |
63 ms |
8160 KB |
Partially correct |
3 |
Partially correct |
65 ms |
8688 KB |
Partially correct |
4 |
Partially correct |
73 ms |
8472 KB |
Partially correct |
5 |
Partially correct |
67 ms |
8488 KB |
Partially correct |
6 |
Partially correct |
69 ms |
8488 KB |
Partially correct |
7 |
Partially correct |
67 ms |
8448 KB |
Partially correct |
8 |
Partially correct |
64 ms |
8624 KB |
Partially correct |
9 |
Partially correct |
66 ms |
8492 KB |
Partially correct |
10 |
Partially correct |
63 ms |
8544 KB |
Partially correct |
11 |
Partially correct |
65 ms |
8476 KB |
Partially correct |
12 |
Partially correct |
63 ms |
8484 KB |
Partially correct |
13 |
Partially correct |
71 ms |
8644 KB |
Partially correct |
14 |
Partially correct |
83 ms |
8604 KB |
Partially correct |
15 |
Partially correct |
67 ms |
8628 KB |
Partially correct |
16 |
Partially correct |
67 ms |
8492 KB |
Partially correct |
17 |
Partially correct |
71 ms |
8684 KB |
Partially correct |
18 |
Partially correct |
73 ms |
8592 KB |
Partially correct |
19 |
Partially correct |
78 ms |
8560 KB |
Partially correct |
20 |
Partially correct |
62 ms |
8588 KB |
Partially correct |
21 |
Partially correct |
61 ms |
8472 KB |
Partially correct |
22 |
Partially correct |
72 ms |
8500 KB |
Partially correct |
23 |
Partially correct |
61 ms |
8604 KB |
Partially correct |
24 |
Partially correct |
66 ms |
8472 KB |
Partially correct |
25 |
Partially correct |
108 ms |
8572 KB |
Partially correct |
26 |
Partially correct |
88 ms |
8624 KB |
Partially correct |
27 |
Partially correct |
86 ms |
8600 KB |
Partially correct |
28 |
Partially correct |
102 ms |
8468 KB |
Partially correct |
29 |
Partially correct |
74 ms |
8552 KB |
Partially correct |
30 |
Partially correct |
73 ms |
8468 KB |
Partially correct |
31 |
Partially correct |
72 ms |
8556 KB |
Partially correct |
32 |
Partially correct |
73 ms |
8660 KB |
Partially correct |
33 |
Partially correct |
66 ms |
8548 KB |
Partially correct |