Submission #765019

#TimeUsernameProblemLanguageResultExecution timeMemory
7650191075508020060209tcSob (COCI19_sob)C++14
110 / 110
542 ms9108 KiB
#include<bits/stdc++.h> using namespace std; //#define int long long #define X first #define Y second int n;int m; int vis[1000006]; signed main(){ cin.tie(0); ios_base::sync_with_stdio(0); vector<pair<int,int>>ans; cin>>n>>m; int lst=0; for(int i=n-1;i>=0;i--){ if(lst!=0&&vis[lst-1]==0&&((i&(lst-1+m))==i) ){ lst--; //ans.push_back({i,lst+m}); cout<<i<<" "<<lst+m<<endl; vis[lst]=1; continue; } for(int j=0;j<=n-1;j++){ if(vis[j]){continue;} if( ((i&(j+m))==i) ){ cout<<i<<" "<<j+m<<endl; lst=j; vis[j]=1; break; } } } }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...