제출 #1075814

#제출 시각아이디문제언어결과실행 시간메모리
1075814Faisal_Saqib죄수들의 도전 (IOI22_prison)C++17
54.50 / 100
12 ms1372 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=12; // number bit from 13 to 1 for(int result=1;result<=N;result++) { bool p=(result&(1<<check)); // checking bit 12 s[i].push_back(((check+1)*2)+p); // even * 2 == multiple of four // cout<<"For "<<i<<' '<<result<<' '<<(check*2)+p<<endl;; } continue; } if((i&2)) // 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...