#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++) {
arr[i]=0;
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 |
Correct |
47 ms |
9220 KB |
Output is correct |
2 |
Correct |
45 ms |
9224 KB |
Output is correct |
3 |
Correct |
48 ms |
9192 KB |
Output is correct |
4 |
Correct |
52 ms |
9228 KB |
Output is correct |
5 |
Correct |
49 ms |
9184 KB |
Output is correct |
6 |
Correct |
52 ms |
9244 KB |
Output is correct |
7 |
Correct |
48 ms |
9132 KB |
Output is correct |
8 |
Correct |
48 ms |
9192 KB |
Output is correct |
9 |
Correct |
48 ms |
9272 KB |
Output is correct |
10 |
Correct |
47 ms |
9220 KB |
Output is correct |
11 |
Correct |
56 ms |
9224 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Partially correct |
127 ms |
12320 KB |
Partially correct |
2 |
Partially correct |
111 ms |
12192 KB |
Partially correct |
3 |
Partially correct |
112 ms |
12268 KB |
Partially correct |
4 |
Partially correct |
135 ms |
12308 KB |
Partially correct |
5 |
Partially correct |
112 ms |
12220 KB |
Partially correct |
6 |
Partially correct |
105 ms |
12240 KB |
Partially correct |
7 |
Partially correct |
107 ms |
12324 KB |
Partially correct |
8 |
Partially correct |
114 ms |
12336 KB |
Partially correct |
9 |
Partially correct |
119 ms |
12264 KB |
Partially correct |
10 |
Partially correct |
107 ms |
12332 KB |
Partially correct |
11 |
Partially correct |
119 ms |
12336 KB |
Partially correct |
12 |
Partially correct |
107 ms |
12264 KB |
Partially correct |
13 |
Partially correct |
105 ms |
11128 KB |
Partially correct |
14 |
Partially correct |
126 ms |
11116 KB |
Partially correct |
15 |
Partially correct |
111 ms |
13912 KB |
Partially correct |
16 |
Partially correct |
97 ms |
11160 KB |
Partially correct |
17 |
Partially correct |
105 ms |
14484 KB |
Partially correct |
18 |
Partially correct |
112 ms |
15680 KB |
Partially correct |
19 |
Partially correct |
93 ms |
14500 KB |
Partially correct |
20 |
Partially correct |
117 ms |
11264 KB |
Partially correct |
21 |
Partially correct |
130 ms |
11168 KB |
Partially correct |
22 |
Partially correct |
106 ms |
16152 KB |
Partially correct |
23 |
Partially correct |
100 ms |
11564 KB |
Partially correct |
24 |
Partially correct |
114 ms |
11448 KB |
Partially correct |
25 |
Partially correct |
114 ms |
15684 KB |
Partially correct |
26 |
Partially correct |
98 ms |
15716 KB |
Partially correct |
27 |
Partially correct |
100 ms |
15684 KB |
Partially correct |
28 |
Partially correct |
100 ms |
15704 KB |
Partially correct |
29 |
Partially correct |
98 ms |
15708 KB |
Partially correct |
30 |
Partially correct |
104 ms |
15716 KB |
Partially correct |
31 |
Partially correct |
101 ms |
15688 KB |
Partially correct |
32 |
Partially correct |
130 ms |
11644 KB |
Partially correct |
33 |
Partially correct |
133 ms |
11564 KB |
Partially correct |