#include "Anna.h"
#include <bits/stdc++.h>
#pragma GCC optimize ("O2,unroll-loops")
//#pragma GCC optimize("no-stack-protector,fast-math")
//#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
using namespace std;
typedef long long ll;
typedef long double ld;
typedef pair<int, int> pii;
typedef pair<pii, int> piii;
typedef pair<ll, ll> pll;
#define debug(x) cerr<<#x<<'='<<(x)<<endl;
#define debugp(x) cerr<<#x<<"= {"<<(x.first)<<", "<<(x.second)<<"}"<<endl;
#define debug2(x, y) cerr<<"{"<<#x<<", "<<#y<<"} = {"<<(x)<<", "<<(y)<<"}"<<endl;
#define debugv(v) {cerr<<#v<<" : ";for (auto x:v) cerr<<x<<' ';cerr<<endl;}
#define all(x) x.begin(), x.end()
#define pb push_back
#define kill(x) return cout<<x<<'\n', 0;
const int inf=1000000010;
const ll INF=1000000000000001000LL;
const int mod=1000000007;
const int MAXN=100010, LOG=20;
bool A[MAXN];
void Anna(int n, vector<char> S){
vector<int> vec;
for (int i=0; i<n; i++) vec.pb(S[i]-'X');
while (vec.size()%5) vec.pb(0);
for (int i=0; i<vec.size(); i+=5){
int x=0;
for (int j=i; j<i+5; j++) x=x*3+vec[j];
for (int j=0; j<8; j++) Send((x>>j)&1);
}
}
#include "Bruno.h"
#include <bits/stdc++.h>
#pragma GCC optimize ("O2,unroll-loops")
//#pragma GCC optimize("no-stack-protector,fast-math")
//#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
using namespace std;
typedef long long ll;
typedef long double ld;
typedef pair<int, int> pii;
typedef pair<pii, int> piii;
typedef pair<ll, ll> pll;
#define debug(x) cerr<<#x<<'='<<(x)<<endl;
#define debugp(x) cerr<<#x<<"= {"<<(x.first)<<", "<<(x.second)<<"}"<<endl;
#define debug2(x, y) cerr<<"{"<<#x<<", "<<#y<<"} = {"<<(x)<<", "<<(y)<<"}"<<endl;
#define debugv(v) {cerr<<#v<<" : ";for (auto x:v) cerr<<x<<' ';cerr<<endl;}
#define all(x) x.begin(), x.end()
#define pb push_back
#define kill(x) return cout<<x<<'\n', 0;
const int inf=1000000010;
const ll INF=1000000000000001000LL;
const int mod=1000000007;
const int MAXN=100010, LOG=20;
int n, m, k, u, v, x, y, t, a, b, ans;
char S[MAXN];
int stk[MAXN], sz;
bool mark[MAXN];
inline void Rem(int x){
// debug(x)
// if (mark[x]) debug("fuck")
Remove(x);
mark[x]=1;
}
void Bruno(int n, int m, vector<int> A){
vector<int> vec;
for (int i=0; i<m; i+=8){
int x=0;
for (int j=0; j<8; j++) x+=(A[i+j]<<j);
vector<int> shit;
for (int j=0; j<5; j++) shit.pb(x%3), x/=3;
for (int j=4; ~j; j--) vec.pb(shit[j]);
}
for (int i=0; i<n; i++) S[i]='X'+vec[i];
int last=-1;
for (int i=0; i<n; i++) if (S[i]=='Z') last=i;
if (last==-1){
for (int i=0; i<n; i++) Rem(i);
return ;
}
for (int i=0; i<last; i++){
if (S[i]=='X'){
if (!sz || S[stk[sz]]=='Y') stk[++sz]=i;
else Rem(i);
}
else if (S[i]=='Y'){
if (sz && S[stk[sz]]=='X') stk[++sz]=i;
else Rem(i);
}
else{
if (sz && S[stk[sz]]=='Y'){
Rem(stk[sz]);
sz--;
}
Rem(i);
}
}
while (sz){
Rem(stk[sz]);
sz--;
}
for (int i=0; i<n; i++) if (!mark[i]) Remove(i);
}
Compilation message
Anna.cpp: In function 'void Anna(int, std::vector<char>)':
Anna.cpp:32:17: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
32 | for (int i=0; i<vec.size(); i+=5){
| ~^~~~~~~~~~~
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
496 KB |
Output is correct |
2 |
Correct |
1 ms |
488 KB |
Output is correct |
3 |
Correct |
1 ms |
584 KB |
Output is correct |
4 |
Correct |
1 ms |
484 KB |
Output is correct |
5 |
Correct |
1 ms |
580 KB |
Output is correct |
6 |
Correct |
1 ms |
576 KB |
Output is correct |
7 |
Correct |
1 ms |
496 KB |
Output is correct |
8 |
Correct |
2 ms |
496 KB |
Output is correct |
9 |
Correct |
1 ms |
488 KB |
Output is correct |
10 |
Correct |
2 ms |
488 KB |
Output is correct |
11 |
Correct |
1 ms |
488 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Partially correct |
82 ms |
9980 KB |
Partially correct |
2 |
Partially correct |
80 ms |
10064 KB |
Partially correct |
3 |
Partially correct |
97 ms |
9972 KB |
Partially correct |
4 |
Partially correct |
78 ms |
9976 KB |
Partially correct |
5 |
Partially correct |
84 ms |
9956 KB |
Partially correct |
6 |
Partially correct |
82 ms |
10012 KB |
Partially correct |
7 |
Partially correct |
82 ms |
10068 KB |
Partially correct |
8 |
Partially correct |
81 ms |
10096 KB |
Partially correct |
9 |
Partially correct |
87 ms |
10000 KB |
Partially correct |
10 |
Partially correct |
79 ms |
9832 KB |
Partially correct |
11 |
Partially correct |
78 ms |
9980 KB |
Partially correct |
12 |
Partially correct |
91 ms |
9952 KB |
Partially correct |
13 |
Partially correct |
97 ms |
10384 KB |
Partially correct |
14 |
Partially correct |
90 ms |
9896 KB |
Partially correct |
15 |
Partially correct |
91 ms |
9988 KB |
Partially correct |
16 |
Partially correct |
82 ms |
10344 KB |
Partially correct |
17 |
Partially correct |
87 ms |
9916 KB |
Partially correct |
18 |
Partially correct |
88 ms |
9924 KB |
Partially correct |
19 |
Partially correct |
97 ms |
10008 KB |
Partially correct |
20 |
Partially correct |
87 ms |
10108 KB |
Partially correct |
21 |
Partially correct |
98 ms |
10120 KB |
Partially correct |
22 |
Partially correct |
104 ms |
9976 KB |
Partially correct |
23 |
Partially correct |
99 ms |
10128 KB |
Partially correct |
24 |
Partially correct |
86 ms |
10096 KB |
Partially correct |
25 |
Partially correct |
90 ms |
9876 KB |
Partially correct |
26 |
Partially correct |
90 ms |
9880 KB |
Partially correct |
27 |
Partially correct |
93 ms |
9868 KB |
Partially correct |
28 |
Partially correct |
88 ms |
9908 KB |
Partially correct |
29 |
Partially correct |
102 ms |
9876 KB |
Partially correct |
30 |
Partially correct |
108 ms |
9872 KB |
Partially correct |
31 |
Partially correct |
87 ms |
9984 KB |
Partially correct |
32 |
Partially correct |
80 ms |
9984 KB |
Partially correct |
33 |
Partially correct |
80 ms |
10120 KB |
Partially correct |