#include "prison.h"
#include <vector>
#include <bits/stdc++.h>
using namespace std;
int n;
vector<int>a;
vector<vector<int>>ans;
void solve(int l,int r,int c,int id){
ans[id][0]=c;
c^=1;
for(int i=1;i<l;i++){
ans[id][i]=c^(-2);
}
for(int i=r+1;i<=n;i++){
ans[id][i]=c^(-1);
}
ans[id][l]=c^(-2);
ans[id][r]=c^(-1);
if(l>=r-1) return;
l++,r--;
int mid=(l+r)/2;
ans.push_back(vector<int>(n+1));
for(int i=l;i<=mid;i++) ans[id][i]=ans.size()-1;
solve(l,mid,c,ans.size()-1);
if(mid>=r) return;
ans.push_back(vector<int>(n+1));
for(int i=mid+1;i<=r;i++) ans[id][i]=ans.size()-1;
solve(mid+1,r,c,ans.size()-1);
}
std::vector<std::vector<int>> devise_strategy(int N) {
n=N;
ans.assign(1,vector<int>(N+1));
solve(1,N,0,0);
// cout<<ans.size()<<'\n';
// for(auto x:ans){
// for(auto y:x) cout<<y<<' ';
// cout<<'\n';
// }
return ans;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
344 KB |
Output is correct |
2 |
Correct |
0 ms |
348 KB |
Output is correct |
3 |
Correct |
2 ms |
604 KB |
Output is correct |
4 |
Correct |
2 ms |
604 KB |
Output is correct |
5 |
Correct |
8 ms |
1628 KB |
Output is correct |
6 |
Correct |
9 ms |
1628 KB |
Output is correct |
7 |
Correct |
1 ms |
344 KB |
Output is correct |
8 |
Correct |
6 ms |
1368 KB |
Output is correct |
9 |
Correct |
7 ms |
1368 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
344 KB |
Output is correct |
2 |
Correct |
0 ms |
348 KB |
Output is correct |
3 |
Incorrect |
0 ms |
604 KB |
Wrong answer detected in grader |
4 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
348 KB |
Output is correct |
2 |
Correct |
0 ms |
348 KB |
Output is correct |
3 |
Correct |
1 ms |
348 KB |
Output is correct |
4 |
Incorrect |
9 ms |
20432 KB |
Wrong answer detected in grader |
5 |
Halted |
0 ms |
0 KB |
- |