Submission #1055814

# Submission time Handle Problem Language Result Execution time Memory
1055814 2024-08-13T05:48:27 Z 캐나다 선발고사 레전드(#11109) Pizza Party (CCO24_day1problem2) C++17
3 / 12
226 ms 21904 KB
#include <bits/stdc++.h>
using namespace std;

int n;
int a[1000001];
int b[1000001];
int ra[1000001];
int rb[1000001];
int r0[1000001];
int r1[1000001];
typedef pair<int,int> P;
vector<P> v;

int main(void) {
    scanf("%d",&n);
    bool flag=true;
    int c1=0;
    for(int i=1;i<=n;i++) {
        scanf("%d",&a[i]);
        if (a[i]==1) {
            c1++;
        }
    }
    for(int i=1;i<=n;i++) {
        scanf("%d",&b[i]);
        if (b[i]==1) {
            c1--;
        }
        if (b[i]!=a[n+1-i]) {
            flag=false;
        }
    }
    if (c1!=0) {
        printf("-1");
        return 0;
    }
    if (flag) {
        printf("1\n");
        for(int i=1;i<=n;i++) {
            printf("1");
            if (i!=n) {
                printf(" ");
            }
        }
        printf("\n");
        for(int i=1;i<=n;i++) {
            printf("1");
            if (i!=n) {
                printf(" ");
            }
        }
        return 0;
    }
    printf("2\n");
    for(int i=1;i<=n;i++) {
        printf("%d",a[i]);
        if (i!=n) {
            printf(" ");
        }
    }
    printf("\n");
    for(int i=1;i<=n;i++) {
        printf("%d",b[i]);
        if (i!=n) {
            printf(" ");
        }
    }
    return 0;
}

Compilation message

Main.cpp: In function 'int main()':
Main.cpp:15:10: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
   15 |     scanf("%d",&n);
      |     ~~~~~^~~~~~~~~
Main.cpp:19:14: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
   19 |         scanf("%d",&a[i]);
      |         ~~~~~^~~~~~~~~~~~
Main.cpp:25:14: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
   25 |         scanf("%d",&b[i]);
      |         ~~~~~^~~~~~~~~~~~
# Verdict Execution time Memory Grader output
1 Correct 198 ms 12112 KB good job!
2 Correct 185 ms 14108 KB good job!
3 Correct 185 ms 16092 KB good job!
4 Correct 189 ms 15952 KB good job!
5 Correct 184 ms 15952 KB good job!
6 Correct 178 ms 16000 KB good job!
7 Correct 188 ms 15952 KB good job!
8 Correct 182 ms 12372 KB good job!
9 Correct 179 ms 12452 KB good job!
10 Correct 177 ms 12112 KB good job!
11 Correct 201 ms 12112 KB good job!
12 Correct 195 ms 12052 KB good job!
13 Correct 0 ms 348 KB good job!
14 Correct 0 ms 348 KB good job!
15 Correct 1 ms 348 KB good job!
16 Correct 76 ms 8056 KB good job!
17 Correct 76 ms 8064 KB good job!
18 Correct 90 ms 8104 KB good job!
19 Correct 88 ms 8020 KB good job!
20 Correct 97 ms 8016 KB good job!
21 Correct 76 ms 8020 KB good job!
22 Correct 198 ms 12116 KB good job!
23 Correct 0 ms 344 KB good job!
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 344 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 226 ms 21904 KB Integer element c_i[1] equals to 134990, violates the range [1, 2]
2 Halted 0 ms 0 KB -