Submission #653019

#TimeUsernameProblemLanguageResultExecution timeMemory
653019Koful123Sob (COCI19_sob)C++17
10 / 110
40 ms5828 KiB
#include <bits/stdc++.h> using namespace std; #define endl "\n" #define int long long #define pb push_back #define ff first #define ss second #define mod 1000000007 #define all(x) (x).begin(), (x).end() #define rall(x) (x).rbegin(), (x).rend() const int N = 1e6 + 6; int ans[N]; void solve(){ int n,m; cin >> n >> m; int lg = __lg(n); for(int i=m;i<m+n;i++){ int cur = 0; for(int j=0;j<=lg;j++){ cur ^= (i & (1ll<<j)); } for(int j=lg;j>=0;j--){ if(cur < n && !ans[cur]){ ans[cur] = i; break; } cur ^= (cur & (1ll<<j)); } } for(int i=0;i<n;i++){ cout << i << ' ' << ans[i] << endl; } } signed main(){ ios::sync_with_stdio(0); cin.tie(0); int t = 1; // cin >> t; while(t--) solve(); 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...