Submission #442829

# Submission time Handle Problem Language Result Execution time Memory
442829 2021-07-09T08:14:00 Z algorithm16 Sob (COCI19_sob) C++14
110 / 110
122 ms 11184 KB
#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

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 time Memory Grader output
1 Correct 0 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 55 ms 6020 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 332 KB Output is correct
2 Correct 0 ms 204 KB Output is correct
3 Correct 0 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 56 ms 6180 KB Output is correct
7 Correct 27 ms 3064 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 312 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 0 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 55 ms 6020 KB Output is correct
5 Correct 1 ms 332 KB Output is correct
6 Correct 0 ms 204 KB Output is correct
7 Correct 0 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 56 ms 6180 KB Output is correct
11 Correct 27 ms 3064 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 312 KB Output is correct
17 Correct 1 ms 204 KB Output is correct
18 Correct 1 ms 204 KB Output is correct
19 Correct 13 ms 1552 KB Output is correct
20 Correct 42 ms 4664 KB Output is correct
21 Correct 2 ms 460 KB Output is correct
22 Correct 2 ms 332 KB Output is correct
23 Correct 60 ms 6476 KB Output is correct
24 Correct 105 ms 11184 KB Output is correct
25 Correct 122 ms 11056 KB Output is correct