Submission #496033

#TimeUsernameProblemLanguageResultExecution timeMemory
496033asandikciSob (COCI19_sob)C++17
29 / 110
70 ms10012 KiB
#include"iostream" #include"vector" // #include"queue" // #include"deque" // #include"set" // #include"map" #include"algorithm" // #include"iomanip" #include"cstring" #include"cmath" #include"bitset" #define int long long using namespace std; const int maxn=2*1e6+5; void solve(){ int n,k; cin >> n >> k; int til = ceil(log2(n)); //+1 maybe // cout << til << "\n"; int num; bitset<32> bt; bool isactive[maxn]; vector<pair<int,int>> vec; for(int i=k;i<k+n;i++){ bt = i; num=0; for(int j=0;j<til;j++){ if(bt[j]==1){ num+=(1<<j); if(isactive[num]==0){ isactive[num]=1; break; } } } if(num==n){num=0;til--;} vec.push_back({num,i}); // cout << num << "\n"; } sort(vec.begin(),vec.end()); for(auto it : vec){ cout << it.first << " " << it.second << "\n"; } } signed main(){ // ios::sync_with_stdio(false); cin.tie(0); // freopen("","r",stdin);freopen("","w",stdout); int t=1; // cin >> t; for(int i=1;i<=t;i++){ // cout << "Case " << i << ":\n"; solve(); } }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...