제출 #1258437

#제출 시각아이디문제언어결과실행 시간메모리
1258437SalihSahinSob (COCI19_sob)C++20
39 / 110
212 ms8636 KiB
#include "bits/stdc++.h" #define pb push_back #define int long long using namespace std; const int inf = 1e15; const int N = 1e6 + 5; int32_t main(){ ios_base::sync_with_stdio(0); cin.tie(0), cout.tie(0); int n, m; cin>>n>>m; vector<int> ans(n); for(int i = 0; i < n; i++){ ans[i] = i; } for(int i = 0; i < 21; i++){ int bt = (1 << i); vector<int> updans = ans; vector<int> type[2][2]; for(int j = 0; j < n; j++){ type[(j&bt) > 0][(updans[j]&bt) > 0].pb(j); } if((m&bt)){ int ind = 0; for(auto itr: type[1][1]){ swap(updans[itr], updans[type[0][0][ind]]); ind++; } for(int j = 0; j < n; j++){ updans[j] += bt; } swap(updans, ans); } else{ int ind = 0; for(auto itr: type[1][0]){ swap(updans[itr], updans[type[0][1][ind]]); ind++; } swap(updans, ans); } } for(int i = 0; i < n; i++){ cout<<i<<" "<<ans[i]<<endl; } return 0; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...