Submission #1055784

# Submission time Handle Problem Language Result Execution time Memory
1055784 2024-08-13T05:22:14 Z 이온조(#11108) Pizza Party (CCO24_day1problem2) C++17
3 / 12
240 ms 29704 KB
#include <bits/stdc++.h>
using namespace std;

int A[1000009], B[1000009], C[1000009], D[1000009];

int main() {
	int N, c = 0; scanf("%d", &N);
	for(int i=N; i>=1; i--) {
		scanf("%d", &A[i]);
		if(A[i] == 1) ++c;
	}
	for(int i=1; i<=N; i++) {
		scanf("%d", &B[i]);
		if(B[i] == 1) --c;
	}
	if(c) return !printf("-1");
	bool f = 1;
	for(int i=1; i<=N; i++) if(A[i] != B[i]) f = 0;
	if(f) {
		puts("1");
		for(int i=1; i<=N; i++) C[i] = D[i] = 1;
	}
	else {
		puts("2");
		for(int i=1; i<=N; i++) C[i] = A[N-i+1];
		for(int i=1; i<=N; i++) D[i] = B[i];
	}
	for(int i=1; i<=N; i++) printf("%d%c", C[i], i == N ? '\n' : ' ');
	for(int i=1; i<=N; i++) printf("%d%c", D[i], i == N ? '\n' : ' ');
	return 0;
}

Compilation message

Main.cpp: In function 'int main()':
Main.cpp:7:21: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
    7 |  int N, c = 0; scanf("%d", &N);
      |                ~~~~~^~~~~~~~~~
Main.cpp:9:8: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
    9 |   scanf("%d", &A[i]);
      |   ~~~~~^~~~~~~~~~~~~
Main.cpp:13:8: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
   13 |   scanf("%d", &B[i]);
      |   ~~~~~^~~~~~~~~~~~~
# Verdict Execution time Memory Grader output
1 Correct 181 ms 19920 KB good job!
2 Correct 190 ms 20048 KB good job!
3 Correct 195 ms 20048 KB good job!
4 Correct 179 ms 20052 KB good job!
5 Correct 181 ms 20052 KB good job!
6 Correct 180 ms 20052 KB good job!
7 Correct 179 ms 19932 KB good job!
8 Correct 188 ms 20052 KB good job!
9 Correct 182 ms 20048 KB good job!
10 Correct 178 ms 19944 KB good job!
11 Correct 186 ms 20048 KB good job!
12 Correct 181 ms 20048 KB good job!
13 Correct 0 ms 348 KB good job!
14 Correct 0 ms 348 KB good job!
15 Correct 0 ms 348 KB good job!
16 Correct 75 ms 8040 KB good job!
17 Correct 74 ms 8016 KB good job!
18 Correct 74 ms 8020 KB good job!
19 Correct 76 ms 8016 KB good job!
20 Correct 77 ms 8164 KB good job!
21 Correct 74 ms 8016 KB good job!
22 Correct 180 ms 20048 KB good job!
23 Correct 0 ms 348 KB good job!
# Verdict Execution time Memory Grader output
1 Incorrect 2 ms 348 KB Integer element c_i[1] equals to 3140, violates the range [1, 2]
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 240 ms 29704 KB Integer element c_i[1] equals to 134990, violates the range [1, 2]
2 Halted 0 ms 0 KB -