제출 #1358320

#제출 시각아이디문제언어결과실행 시간메모리
1358320blopSob (COCI19_sob)C++20
39 / 110
1097 ms14764 KiB
#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;
using namespace std;

template<class T>
using ordered_set = tree<T, null_type, less<T>, 
					rb_tree_tag, tree_order_statistics_node_update>;
template<class T, class U>
using ordered_map = tree<T, U, less<T>, rb_tree_tag,
					tree_order_statistics_node_update>;
#define ll long long
#define ld long double
#define MOD 998244353
#define MAXN 250000
#define SIZE 100
#define pb push_back

ll power(ll a, ll b){
	if (b == 0) return 1;
	ll res = power(a, b / 2);
//	if (b % 2 == 1) return res * res % MOD * a % MOD;
//	return res * res % MOD;
	
	if (b % 2 == 1) return res * res * a;
	return res * res;
}

signed main(){
	ios_base::sync_with_stdio(0);
	cin.tie(0);
	cout.tie(0);
	
	int n, m;
	cin >> n >> m;
	vector<int> a(n);
	vector<int> bPrint(n);
	set<int> b;
	for (int i = 0; i < n; i++){
		a[i] = i;
//		b[i] = m + i;
		b.insert(m + i);
	}
	for (int i = n - 1; i >= 0; i--){
		auto it = b.begin();
		while(it != b.end()){
			if ((a[i] & (*it)) == a[i]){
				bPrint[i] = (*it);
				b.erase(it);
				break;
			}
			it = next(it);
		}
	}
	for (int i = 0; i < n; i++){
		cout << a[i] << " " << bPrint[i] << "\n";
	}
	
	return 0;
}
#결과 실행 시간메모리채점기 출력
결과를 불러오는 중입니다…
#결과 실행 시간메모리채점기 출력
결과를 불러오는 중입니다…
#결과 실행 시간메모리채점기 출력
결과를 불러오는 중입니다…
#결과 실행 시간메모리채점기 출력
결과를 불러오는 중입니다…