답안 #653019

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
653019 2022-10-25T12:22:20 Z Koful123 Sob (COCI19_sob) C++17
10 / 110
40 ms 5828 KB
#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;
}
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 212 KB Output is correct
2 Correct 0 ms 328 KB Output is correct
3 Correct 0 ms 212 KB Output is correct
4 Correct 40 ms 5828 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Incorrect 1 ms 340 KB Integer parameter [name=y] equals to 0, violates the range [4815, 8191]
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 212 KB Output is correct
2 Incorrect 1 ms 212 KB Integer parameter [name=y] equals to 0, violates the range [647, 886]
3 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 212 KB Output is correct
2 Correct 0 ms 328 KB Output is correct
3 Correct 0 ms 212 KB Output is correct
4 Correct 40 ms 5828 KB Output is correct
5 Incorrect 1 ms 340 KB Integer parameter [name=y] equals to 0, violates the range [4815, 8191]
6 Halted 0 ms 0 KB -