Submission #1075765

#TimeUsernameProblemLanguageResultExecution timeMemory
1075765Faisal_SaqibPrisoner Challenge (IOI22_prison)C++17
10 / 100
5 ms1016 KiB
#include <bits/stdc++.h> using namespace std; #define ll long long #define vll vector<ll> #define all(x) begin(x),end(x) std::vector<std::vector<int>> devise_strategy(int N) { vector<vector<int>> s; for(int i=0;i<=27;i++) { s.push_back({}); if(i==0) // start by checking the bit in a { s[i].push_back(0); int check=13; // number bit from 13 to 1 check--; for(int result=1;result<=N;result++) { bool p=(result&(1<<check)); s[i].push_back((check*2)+p); // even * 2 == multiple of four // cout<<"For "<<i<<' '<<result<<' '<<(check*2)+p<<endl;; } continue; } if((i&2)==0) // now check bit in b { s[i].push_back(1); int check=i/2; bool oth=(i%2); check--; for(int result=1;result<=N;result++) { bool p=(result&(1<<check)); if(oth>p) { s[i].push_back(-2); } else if(oth<p) { s[i].push_back(-1); } else { if(check==0) { s[i].push_back(-1); } else { p=(result&(1<<(check-1))); // cout<<"For "<<i<<' '<<result<<' '<<check-1<<' '<<p<<endl; s[i].push_back(((check)*2)+p); } } } } else// now check bit in a { s[i].push_back(0); int check=i/2; bool oth=(i%2); check--; for(int result=1;result<=N;result++) { bool p=(result&(1<<check)); if(oth>p) { s[i].push_back(-1); } else if(oth<p) { s[i].push_back(-2); } else { if(check==0) { s[i].push_back(-1); } else { p=(result&(1<<(check-1))); // cout<<"For "<<i<<' '<<result<<' '<<check-1<<' '<<p<<endl; s[i].push_back(((check)*2)+p); } } } } } return s; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...