#include "Anna.h"
#include <bits/stdc++.h>
using namespace std;
namespace {
int variable_example = 0;
int n;
int ret[20000];
int arr[100000];
}
void Anna(int N, std::vector<char> S) {
n=N;
for(int i=0;i<100000;i++) {
if (i<n) {
arr[i]=S[i]-'X';
}
}
for(int i=0;i<20000;i++) {
int val=1;
for(int j=0;j<5;j++) {
ret[i]+=arr[i*5+j]*val;
val*=3;
}
for(int j=0;j<8;j++) {
if (ret[i]&(1<<j)) {
Send(1);
}
else {
Send(0);
}
}
}
}
#include "Bruno.h"
#include <bits/stdc++.h>
using namespace std;
namespace {
int n,len;
int l[100000];
int r[100000];
int arr[100000];
vector<int> vx;
vector<int> vz;
typedef pair<int,int> P;
vector<P> vec;
} // namespace
void Bruno(int N, int L, vector<int> A) {
n=100000;
len=L;
for(int i=0;i<20000;i++){
int x=0;
int val=1;
for(int j=0;j<8;j++) {
x+=val*A[i*8+j];
val*=2;
}
for(int j=0;j<5;j++) {
arr[i*5+j]=x%3;
x/=3;
}
}
vx.push_back(-2*n);
for(int i=0;i<n;i++){
if (arr[i]==0) {
vx.push_back(i);
}
else if (arr[i]==2) {
vz.push_back(i);
}
}
vz.push_back(3*n);
for(int i=0;i<n;i++) {
if (arr[i]==1) {
int ind=lower_bound(vx.begin(),vx.end(),i)-vx.begin();
l[i]=vx[ind-1];
ind=lower_bound(vz.begin(),vz.end(),i)-vz.begin();
r[i]=vz[ind];
vec.push_back(P(r[i]-l[i],i));
}
}
sort(vec.begin(),vec.end());
set<int> s;
for(int i=0;i<n;i++) {
s.insert(i);
}
for(int i=0;i<vec.size();i++) {
int now=vec[i].second;
printf("%d %d %d\n",now,l[now],r[now]);
if (r[now]-l[now]>n) {
break;
}
if (s.find(now)==s.end()) {
continue;
}
auto iter=s.upper_bound(l[now]);
vector<int> er;
while (iter!=s.end()&&(*iter)<now) {
Remove(*iter);
//printf("%d\n",*iter);
er.push_back(*iter);
iter++;
}
for(int j=0;j<er.size();j++){
s.erase(er[j]);
}
er.clear();
iter=s.upper_bound(now);
while (iter!=s.end()&&(*iter)<r[now]) {
//printf("%d\n",*iter);
Remove(*iter);
er.push_back(*iter);
iter++;
}
for(int j=0;j<er.size();j++){
s.erase(er[j]);
}
er.clear();
iter=s.lower_bound(now);
Remove(now);
s.erase(iter);
}
for(auto now:s) {
if (now<N)
Remove(now);
}
}
Compilation message
Anna.cpp:7:5: warning: '{anonymous}::variable_example' defined but not used [-Wunused-variable]
7 | int variable_example = 0;
| ^~~~~~~~~~~~~~~~
Bruno.cpp: In function 'void Bruno(int, int, std::vector<int>)':
Bruno.cpp:56:18: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<std::pair<int, int> >::size_type' {aka 'long unsigned int'} [-Wsign-compare]
56 | for(int i=0;i<vec.size();i++) {
| ~^~~~~~~~~~~
Bruno.cpp:73:22: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
73 | for(int j=0;j<er.size();j++){
| ~^~~~~~~~~~
Bruno.cpp:84:22: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
84 | for(int j=0;j<er.size();j++){
| ~^~~~~~~~~~
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
54 ms |
8772 KB |
Do not print anything to standard output!! |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
113 ms |
12836 KB |
Do not print anything to standard output!! |
2 |
Halted |
0 ms |
0 KB |
- |