Submission #440039

#TimeUsernameProblemLanguageResultExecution timeMemory
440039minoumSob (COCI19_sob)C++17
110 / 110
519 ms47916 KiB
#include<bits/stdc++.h> using namespace std; typedef long long int ll; vector <pair<int,int>> ans; void slv(int n, int m, vector <pair<int,int>> v1, vector <pair<int,int>> v2){ if(n==0) return; if(n==1){ ans.push_back({v1.back().second,v2.back().second}); return; } vector <pair<int,int>> a1,a2,b1,b2; for(auto i: v1){ if(i.first%2==0) a1.push_back({i.first/2,i.second}); else a2.push_back({i.first/2,i.second}); } if(!(n&1) || !(m&1)){ for(auto i: v2){ if(i.first%2==0) b1.push_back({i.first/2,i.second}); else b2.push_back({i.first/2,i.second}); } } else{ b1.push_back({v2[0].first/2,v2[0].second}); for(auto i: v2){ if(i==v2[0]) continue; if(i.first%2==0) b1.push_back({i.first/2,i.second}); else b2.push_back({i.first/2,i.second}); } } slv((int)a1.size(), b1[0].first, a1, b1); slv((int)a2.size(), b2[0].first, a2, b2); return; } int main() { ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0); int n,m; cin >> n >> m; vector <pair<int,int>> v1,v2; for(int i = 0; i < n; i++) v1.push_back({i,i}); for(int i = m; i < n+m; i++) v2.push_back({i,i}); slv(n,m,v1,v2); for(auto i: ans) cout << i.first << " " << i.second << '\n'; 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...