답안 #858556

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
858556 2023-10-08T17:54:37 Z serifefedartar Sob (COCI19_sob) C++17
110 / 110
61 ms 13572 KB
#include <bits/stdc++.h>
using namespace std;
 
#define fast ios::sync_with_stdio(0);cin.tie(0);
#define s second
#define f first
typedef long long ll;
const ll MOD = 998244353;
const ll LOGN = 18; 
const ll INF = 1e15;
const ll MAXN = 1e6 + 5;
	
int ans[MAXN]; 
int main() {
	fast
	int N, M;
	cin >> N >> M;

	vector<int> A, B;
	for (int i = 0; i < N; i++)
		A.push_back(i);
	for (int i = M + N - 1; i >= M; i--)
		B.push_back(i);

	while (A.size()) {
		vector<int> right;
		while ((A.back() & B.back()) != A.back()) {
			right.push_back(B.back());
			B.pop_back();
		}

		// right azalan şekilde gidiyor.
		right.push_back(B.back());
		B.pop_back();

		while (right.size()) {
			ans[A.back()] = right.back();
			A.pop_back();
			right.pop_back();
		}
	}

	for (int i = 0; i < N; i++)
		cout << i << " " << ans[i] << "\n";
}
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 344 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Correct 0 ms 348 KB Output is correct
4 Correct 33 ms 8324 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 344 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Correct 0 ms 348 KB Output is correct
4 Correct 1 ms 348 KB Output is correct
5 Correct 0 ms 348 KB Output is correct
6 Correct 34 ms 8396 KB Output is correct
7 Correct 17 ms 5232 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 344 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Correct 0 ms 348 KB Output is correct
4 Correct 0 ms 348 KB Output is correct
5 Correct 0 ms 348 KB Output is correct
6 Correct 0 ms 348 KB Output is correct
7 Correct 0 ms 348 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 344 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Correct 0 ms 348 KB Output is correct
4 Correct 33 ms 8324 KB Output is correct
5 Correct 1 ms 344 KB Output is correct
6 Correct 0 ms 348 KB Output is correct
7 Correct 0 ms 348 KB Output is correct
8 Correct 1 ms 348 KB Output is correct
9 Correct 0 ms 348 KB Output is correct
10 Correct 34 ms 8396 KB Output is correct
11 Correct 17 ms 5232 KB Output is correct
12 Correct 0 ms 344 KB Output is correct
13 Correct 0 ms 348 KB Output is correct
14 Correct 0 ms 348 KB Output is correct
15 Correct 0 ms 348 KB Output is correct
16 Correct 0 ms 348 KB Output is correct
17 Correct 0 ms 348 KB Output is correct
18 Correct 0 ms 348 KB Output is correct
19 Correct 7 ms 3900 KB Output is correct
20 Correct 25 ms 6952 KB Output is correct
21 Correct 1 ms 600 KB Output is correct
22 Correct 1 ms 348 KB Output is correct
23 Correct 46 ms 9392 KB Output is correct
24 Correct 59 ms 13552 KB Output is correct
25 Correct 61 ms 13572 KB Output is correct