#include "Anna.h"
#include <bits/stdc++.h>
using namespace std;
namespace {
int variable_example = 0;
}
void Anna(int n,vector<char> s) {
for(int i=0;i<n;i++) {
int val=s[i]-'X';
Send(val/2);
Send(val%2);
}
}
#include "Bruno.h"
#include <bits/stdc++.h>
using namespace std;
namespace {
int dp[262144];
int pr[262144];
int arr[18];
int n;
int ans(int bit) {
if (bit==0) {
return 0;
}
if (dp[bit]!=-1) {
return dp[bit];
}
int ret=0;
for(int i=0;i<n;i++) {
if (bit&(1<<i)) {
if (arr[i]!=1) {
if (ans(bit-(1<<i))>=ret) {
pr[bit]=i;
}
ret=max(ret,ans(bit-(1<<i)));
continue;
}
bool flag1=false;
bool flag2=false;
for(int j=i-1;j>=0;j--) {
if (bit&(1<<j)) {
if (arr[j]==0) {
flag1=true;
}
break;
}
}
for(int j=i+1;j<n;j++) {
if (bit&(1<<j)) {
if (arr[j]==2) {
flag2=true;
}
break;
}
}
if (flag1&flag2){
if (ans(bit-(1<<i))+1>=ret) {
pr[bit]=i;
}
ret=max(ret,ans(bit-(1<<i))+1);
}
}
}
return dp[bit]=ret;
}
} // namespace
void Bruno(int nn,int l,vector<int> v) {
n=nn;
for (int i = 0;i<l;i+=2) {
arr[i/2]=arr[i]*2+arr[i+1];
}
memset(dp,-1,sizeof(dp));
int now=(1<<n)-1;
for(int i=0;i<n;i++) {
Remove(pr[now]);
now-=(1<<pr[now]);
}
}
Compilation message
Anna.cpp:7:5: warning: '{anonymous}::variable_example' defined but not used [-Wunused-variable]
7 | int variable_example = 0;
| ^~~~~~~~~~~~~~~~
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
2 ms |
1516 KB |
Wrong Answer [4] |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
60 ms |
5016 KB |
Wrong Answer [4] |
2 |
Halted |
0 ms |
0 KB |
- |