#include <bits/stdc++.h>
#include "Anna.h"
using namespace std;
namespace Nigga{
typedef long long ll;
typedef unsigned long long ull;
#define MASK(i) (1LL << (i))
#define GETBIT(mask, i) (((mask) >> (i)) & 1)
#define ALL(v) (v).begin(), (v).end()
ll max(ll a, ll b){return (a > b) ? a : b;}
ll min(ll a, ll b){return (a < b) ? a : b;}
ll LASTBIT(ll mask){return (mask) & (-mask);}
int pop_cnt(ll mask){return __builtin_popcountll(mask);}
int ctz(ll mask){return __builtin_ctzll(mask);}
int logOf(ll mask){return __lg(mask);}
mt19937_64 rng(chrono::high_resolution_clock::now().time_since_epoch().count());
ll rngesus(ll l, ll r){return l + (ull) rng() % (r - l + 1);}
template <class T1, class T2>
bool maximize(T1 &a, T2 b){
if (a < b) {a = b; return true;}
return false;
}
template <class T1, class T2>
bool minimize(T1 &a, T2 b){
if (a > b) {a = b; return true;}
return false;
}
template <class T>
void printArr(T& container, string separator = " ", string finish = "\n"){
for(auto item: container) cout << item << separator;
cout << finish;
}
template <class T>
void remove_dup(vector<T> &a){
sort(ALL(a));
a.resize(unique(ALL(a)) - a.begin());
}
}
void Anna(int N, vector<char> S){
while(S.size() % 5) S.push_back('X');
for(int i = 0; i<S.size(); i+= 5){
int current_number = 0;
for(int j = i + 4; j>= i; --j){
current_number = current_number * 3 + (S[j] - 'X');
}
for(int j = 0; j<8; ++j){
Send(current_number % 2);
current_number /= 2;
}
}
}
// int main(void){
// return 0;
// }
#include <bits/stdc++.h>
#include "Bruno.h"
using namespace std;
namespace Ligma{
typedef long long ll;
typedef unsigned long long ull;
#define MASK(i) (1LL << (i))
#define GETBIT(mask, i) (((mask) >> (i)) & 1)
#define ALL(v) (v).begin(), (v).end()
ll max(ll a, ll b){return (a > b) ? a : b;}
ll min(ll a, ll b){return (a < b) ? a : b;}
ll LASTBIT(ll mask){return (mask) & (-mask);}
int pop_cnt(ll mask){return __builtin_popcountll(mask);}
int ctz(ll mask){return __builtin_ctzll(mask);}
int logOf(ll mask){return __lg(mask);}
mt19937_64 rng(chrono::high_resolution_clock::now().time_since_epoch().count());
ll rngesus(ll l, ll r){return l + (ull) rng() % (r - l + 1);}
template <class T1, class T2>
bool maximize(T1 &a, T2 b){
if (a < b) {a = b; return true;}
return false;
}
template <class T1, class T2>
bool minimize(T1 &a, T2 b){
if (a > b) {a = b; return true;}
return false;
}
template <class T>
void printArr(T& container, string separator = " ", string finish = "\n"){
for(auto item: container) cout << item << separator;
cout << finish;
}
template <class T>
void remove_dup(vector<T> &a){
sort(ALL(a));
a.resize(unique(ALL(a)) - a.begin());
}
void Remove(int d){
cout << d << "\n";
}
}
void Bruno(int N, int L, vector<int> A){
int n;
vector<int> a;
n = N;
for(int i = 0; i<L; i += 8){
int current_num = 0;
for(int j = i + 7; j>=i; --j){
current_num = current_num * 2 + A[j];
}
for(int j = 0; j < 5; ++j) {
a.push_back(current_num % 3);
current_num /= 3;
}
}
while(a.size() > N) a.pop_back();
int idx= -1;
for(int i = 0; i<n; ++i){
if (a[i] == 0) {
idx = i;
break;
}
Remove(i);
}
if (idx == -1) return;
int l = idx + 1;
for(int i = idx + 1; i<n; ++i) if (a[i] == 2){
for(int j = i-1; j>=l; --j) Remove(j);
Remove(i);
l = i + 1;
}
for(;l<n; ++l) Remove(l);
Remove(idx);
}
// int main(void){
// Bruno(6, 16, {0, 1, 1, 0, 0, 1, 1, 0, 0, 1, 0, 0, 0, 0, 0, 0});
// return 0;
// }
Compilation message
Anna.cpp: In function 'void Anna(int, std::vector<char>)':
Anna.cpp:54:21: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
54 | for(int i = 0; i<S.size(); i+= 5){
| ~^~~~~~~~~
Bruno.cpp: In function 'void Bruno(int, int, std::vector<int>)':
Bruno.cpp:70:20: warning: comparison of integer expressions of different signedness: 'std::vector<int>::size_type' {aka 'long unsigned int'} and 'int' [-Wsign-compare]
70 | while(a.size() > N) a.pop_back();
| ~~~~~~~~~^~~
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
776 KB |
Output is correct |
2 |
Correct |
0 ms |
796 KB |
Output is correct |
3 |
Correct |
0 ms |
796 KB |
Output is correct |
4 |
Correct |
0 ms |
780 KB |
Output is correct |
5 |
Correct |
0 ms |
800 KB |
Output is correct |
6 |
Correct |
1 ms |
780 KB |
Output is correct |
7 |
Correct |
0 ms |
800 KB |
Output is correct |
8 |
Correct |
1 ms |
776 KB |
Output is correct |
9 |
Correct |
1 ms |
780 KB |
Output is correct |
10 |
Correct |
0 ms |
780 KB |
Output is correct |
11 |
Correct |
0 ms |
796 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Partially correct |
50 ms |
9140 KB |
Partially correct |
2 |
Partially correct |
47 ms |
9740 KB |
Partially correct |
3 |
Partially correct |
50 ms |
9388 KB |
Partially correct |
4 |
Partially correct |
49 ms |
9484 KB |
Partially correct |
5 |
Partially correct |
48 ms |
9468 KB |
Partially correct |
6 |
Partially correct |
51 ms |
9736 KB |
Partially correct |
7 |
Partially correct |
48 ms |
9492 KB |
Partially correct |
8 |
Partially correct |
48 ms |
9464 KB |
Partially correct |
9 |
Partially correct |
56 ms |
9384 KB |
Partially correct |
10 |
Partially correct |
50 ms |
9680 KB |
Partially correct |
11 |
Partially correct |
47 ms |
9384 KB |
Partially correct |
12 |
Partially correct |
55 ms |
9200 KB |
Partially correct |
13 |
Partially correct |
56 ms |
9664 KB |
Partially correct |
14 |
Partially correct |
61 ms |
9404 KB |
Partially correct |
15 |
Partially correct |
53 ms |
9312 KB |
Partially correct |
16 |
Partially correct |
56 ms |
9512 KB |
Partially correct |
17 |
Partially correct |
61 ms |
9384 KB |
Partially correct |
18 |
Partially correct |
55 ms |
9388 KB |
Partially correct |
19 |
Partially correct |
61 ms |
9636 KB |
Partially correct |
20 |
Partially correct |
49 ms |
9644 KB |
Partially correct |
21 |
Partially correct |
50 ms |
9420 KB |
Partially correct |
22 |
Partially correct |
56 ms |
9240 KB |
Partially correct |
23 |
Partially correct |
49 ms |
9612 KB |
Partially correct |
24 |
Partially correct |
48 ms |
9668 KB |
Partially correct |
25 |
Partially correct |
64 ms |
9428 KB |
Partially correct |
26 |
Partially correct |
56 ms |
9440 KB |
Partially correct |
27 |
Partially correct |
62 ms |
9288 KB |
Partially correct |
28 |
Partially correct |
77 ms |
9328 KB |
Partially correct |
29 |
Partially correct |
71 ms |
9636 KB |
Partially correct |
30 |
Partially correct |
61 ms |
9440 KB |
Partially correct |
31 |
Partially correct |
60 ms |
9344 KB |
Partially correct |
32 |
Partially correct |
51 ms |
9724 KB |
Partially correct |
33 |
Partially correct |
54 ms |
9728 KB |
Partially correct |