Submission #442829

#TimeUsernameProblemLanguageResultExecution timeMemory
442829algorithm16Sob (COCI19_sob)C++14
110 / 110
122 ms11184 KiB
#include<iostream>
#include<vector>
#include<algorithm>
using namespace std;
vector <pair<int,int> > v;
int main()
{
	ios_base::sync_with_stdio(false);
	cin.tie(0);
	cout.tie(0);
	int n,m;
	cin >> n >> m;
	int ind=0;
	for(int i=n-1;i>=0;i--) {
		int ind2=ind,i2=i;
		while((i & (ind+m))!=i) ind+=1;
		for(int j=ind;j>=ind2;j--) {
			v.push_back(make_pair(i2,m+j));
			i2-=1;
		}
		ind+=1;
		i=i2+1;
	}
	for(int i=0;i<v.size();i++) {
		cout << v[i].first << " " << v[i].second << "\n";
	}
	return 0;
}

/*

           __
          /\ \
         /  \ \
        / /\ \ \
       / / /\ \ \
      / / /__\_\ \
     / / /________\
     \/___________/


*/



/*

5 13
0 1 2 3 4
5 6 7 0 1

000  101
001  110
010  111
011  000
100  001




*/

Compilation message (stderr)

sob.cpp: In function 'int main()':
sob.cpp:24:15: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<std::pair<int, int> >::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   24 |  for(int i=0;i<v.size();i++) {
      |              ~^~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...