Submission #464484

# Submission time Handle Problem Language Result Execution time Memory
464484 2021-08-13T09:40:54 Z Jasiekstrz Sob (COCI19_sob) C++17
110 / 110
252 ms 15164 KB
#include<bits/stdc++.h>
#define fi first
#define se second
using namespace std;
void solve(vector<int> &t1,vector<int> &t2,int b)
{
	if(t1.size()==1)
	{
		cout<<t1[0]<<" "<<t2[0]<<"\n";
		return;
	}
	int n=t1.size();
	vector<int> tmp1,tmp2;
	if(n%2==1 && (t2[0]&(1<<b))!=0)
	{
		tmp2.push_back(t2[0]);
		for(int i=0;i<n;i+=2)
			tmp1.push_back(t1[i]);
		for(int i=1;i<n;i+=2)
			tmp2.push_back(t2[i]);
		solve(tmp1,tmp2,b+1);
		tmp1.clear();tmp2.clear();
		for(int i=1;i<n;i+=2)
			tmp1.push_back(t1[i]);
		for(int i=2;i<n;i+=2)
			tmp2.push_back(t2[i]);
		solve(tmp1,tmp2,b+1);
		return;
	}
	bool bit=(t2[0]&(1<<b));
	for(int i=0;i<n;i+=2)
		tmp1.push_back(t1[i]);
	for(int i=bit;i<n;i+=2)
		tmp2.push_back(t2[i]);
	solve(tmp1,tmp2,b+1);
	tmp1.clear();tmp2.clear();
	for(int i=1;i<n;i+=2)
		tmp1.push_back(t1[i]);
	for(int i=!bit;i<n;i+=2)
		tmp2.push_back(t2[i]);
	solve(tmp1,tmp2,b+1);
	return;
}
int main()
{
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	cout.tie(NULL);
	int n,m;
	cin>>n>>m;
	vector<int> t1(n),t2(n);
	for(int i=0;i<n;i++)
	{
		t1[i]=i;
		t2[i]=m+i;
	}
	solve(t1,t2,0);
	return 0;
}

# Verdict Execution time Memory Grader output
1 Correct 1 ms 204 KB Output is correct
2 Correct 0 ms 204 KB Output is correct
3 Correct 0 ms 204 KB Output is correct
4 Correct 124 ms 7884 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 2 ms 332 KB Output is correct
2 Correct 1 ms 204 KB Output is correct
3 Correct 1 ms 204 KB Output is correct
4 Correct 1 ms 204 KB Output is correct
5 Correct 1 ms 204 KB Output is correct
6 Correct 122 ms 7884 KB Output is correct
7 Correct 58 ms 3940 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 204 KB Output is correct
2 Correct 1 ms 204 KB Output is correct
3 Correct 1 ms 204 KB Output is correct
4 Correct 1 ms 204 KB Output is correct
5 Correct 1 ms 204 KB Output is correct
6 Correct 1 ms 204 KB Output is correct
7 Correct 1 ms 204 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 204 KB Output is correct
2 Correct 0 ms 204 KB Output is correct
3 Correct 0 ms 204 KB Output is correct
4 Correct 124 ms 7884 KB Output is correct
5 Correct 2 ms 332 KB Output is correct
6 Correct 1 ms 204 KB Output is correct
7 Correct 1 ms 204 KB Output is correct
8 Correct 1 ms 204 KB Output is correct
9 Correct 1 ms 204 KB Output is correct
10 Correct 122 ms 7884 KB Output is correct
11 Correct 58 ms 3940 KB Output is correct
12 Correct 1 ms 204 KB Output is correct
13 Correct 1 ms 204 KB Output is correct
14 Correct 1 ms 204 KB Output is correct
15 Correct 1 ms 204 KB Output is correct
16 Correct 1 ms 204 KB Output is correct
17 Correct 1 ms 204 KB Output is correct
18 Correct 1 ms 204 KB Output is correct
19 Correct 25 ms 1884 KB Output is correct
20 Correct 97 ms 6088 KB Output is correct
21 Correct 4 ms 460 KB Output is correct
22 Correct 2 ms 332 KB Output is correct
23 Correct 142 ms 9392 KB Output is correct
24 Correct 247 ms 15164 KB Output is correct
25 Correct 252 ms 14944 KB Output is correct