답안 #1055782

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
1055782 2024-08-13T05:21:08 Z 이온조(#11108) Pizza Party (CCO24_day1problem2) C++17
0 / 12
226 ms 29752 KB
#include <bits/stdc++.h>
using namespace std;

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

int main() {
	int N; scanf("%d", &N);
	for(int i=N; i>=1; i--) scanf("%d", &A[i]);
	for(int i=1; i<=N; i++) scanf("%d", &B[i]);
	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:14: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
    7 |  int N; scanf("%d", &N);
      |         ~~~~~^~~~~~~~~~
Main.cpp:8:31: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
    8 |  for(int i=N; i>=1; i--) scanf("%d", &A[i]);
      |                          ~~~~~^~~~~~~~~~~~~
Main.cpp:9:31: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
    9 |  for(int i=1; i<=N; i++) scanf("%d", &B[i]);
      |                          ~~~~~^~~~~~~~~~~~~
# 결과 실행 시간 메모리 Grader output
1 Correct 177 ms 19844 KB good job!
2 Correct 193 ms 23892 KB good job!
3 Correct 183 ms 23888 KB good job!
4 Correct 176 ms 23892 KB good job!
5 Correct 209 ms 23932 KB good job!
6 Correct 183 ms 23848 KB good job!
7 Correct 185 ms 23792 KB good job!
8 Correct 176 ms 20308 KB good job!
9 Correct 175 ms 20308 KB good job!
10 Correct 188 ms 20048 KB good job!
11 Correct 180 ms 19976 KB good job!
12 Correct 177 ms 20192 KB good job!
13 Correct 0 ms 348 KB good job!
14 Correct 1 ms 348 KB good job!
15 Correct 0 ms 348 KB good job!
16 Incorrect 182 ms 19852 KB stack is empty
17 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 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 -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 226 ms 29752 KB Integer element c_i[1] equals to 134990, violates the range [1, 2]
2 Halted 0 ms 0 KB -