Submission #442872

# Submission time Handle Problem Language Result Execution time Memory
442872 2021-07-09T10:11:22 Z IvanJ Sob (COCI19_sob) C++17
110 / 110
108 ms 16992 KB
#include<bits/stdc++.h>

using namespace std;

const int maxn = 2e6 + 5;

int n, m;
int vis[maxn];
int sol[maxn];

int main() {
	scanf("%d %d", &n, &m);
	memset(sol, -1, sizeof sol);
	int lst = m;
	for(int i = n - 1;i >= 0;i--) {
		if(sol[i] != -1) continue;
		for(int j = m;j < m + n;j++) {
			if((i & j) == i && !vis[j]) {
				sol[i] = j;
				vis[j] = 1;
				break;
			}
		} 
		for(int j = sol[i], num = 0;j >= lst;j--, num++) sol[i - num] = j, vis[j] = 1;
		lst = sol[i] + 1;
	}
	
	for(int i = 0;i < n;i++) printf("%d %d\n", i, sol[i]);
	return 0;
}

Compilation message

sob.cpp: In function 'int main()':
sob.cpp:12:7: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
   12 |  scanf("%d %d", &n, &m);
      |  ~~~~~^~~~~~~~~~~~~~~~~
# Verdict Execution time Memory Grader output
1 Correct 4 ms 8140 KB Output is correct
2 Correct 4 ms 8012 KB Output is correct
3 Correct 4 ms 8012 KB Output is correct
4 Correct 56 ms 12716 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 4 ms 8140 KB Output is correct
2 Correct 4 ms 8012 KB Output is correct
3 Correct 4 ms 8012 KB Output is correct
4 Correct 4 ms 8012 KB Output is correct
5 Correct 4 ms 8012 KB Output is correct
6 Correct 56 ms 12708 KB Output is correct
7 Correct 31 ms 10180 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 4 ms 8012 KB Output is correct
2 Correct 4 ms 8012 KB Output is correct
3 Correct 4 ms 8012 KB Output is correct
4 Correct 4 ms 8012 KB Output is correct
5 Correct 4 ms 8012 KB Output is correct
6 Correct 5 ms 8012 KB Output is correct
7 Correct 4 ms 8012 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 4 ms 8140 KB Output is correct
2 Correct 4 ms 8012 KB Output is correct
3 Correct 4 ms 8012 KB Output is correct
4 Correct 56 ms 12716 KB Output is correct
5 Correct 4 ms 8140 KB Output is correct
6 Correct 4 ms 8012 KB Output is correct
7 Correct 4 ms 8012 KB Output is correct
8 Correct 4 ms 8012 KB Output is correct
9 Correct 4 ms 8012 KB Output is correct
10 Correct 56 ms 12708 KB Output is correct
11 Correct 31 ms 10180 KB Output is correct
12 Correct 4 ms 8012 KB Output is correct
13 Correct 4 ms 8012 KB Output is correct
14 Correct 4 ms 8012 KB Output is correct
15 Correct 4 ms 8012 KB Output is correct
16 Correct 4 ms 8012 KB Output is correct
17 Correct 5 ms 8012 KB Output is correct
18 Correct 4 ms 8012 KB Output is correct
19 Correct 20 ms 8972 KB Output is correct
20 Correct 44 ms 11460 KB Output is correct
21 Correct 6 ms 8140 KB Output is correct
22 Correct 5 ms 8140 KB Output is correct
23 Correct 68 ms 12984 KB Output is correct
24 Correct 101 ms 16992 KB Output is correct
25 Correct 108 ms 16968 KB Output is correct