답안 #1055775

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
1055775 2024-08-13T05:13:48 Z 변재우(#11070) Pizza Party (CCO24_day1problem2) C++17
3 / 12
222 ms 37532 KB
#include <bits/stdc++.h>
#define int long long
using namespace std;

const int Nmax=1000010;
int N, A[Nmax], B[Nmax], cnt[Nmax];

signed main() {
    ios_base::sync_with_stdio(0); cin.tie(0);
    cin>>N;
    for(int i=1; i<=N; i++) cin>>A[i], cnt[A[i]]++;
    for(int i=1; i<=N; i++) cin>>B[i], cnt[B[i]]--;
    for(int i=1; i<=N; i++) if(cnt[i]) {
        cout<<-1; return 0;
    }
    bool flag=true;
    for(int i=1; i<=N; i++) if(A[i]!=B[N-i+1]) flag=false;
    if(flag) {
        cout<<"1\n";
        for(int i=1; i<=N; i++) {
            cout<<"1";
            if(i<N) cout<<" ";
        }
        cout<<"\n";
        for(int i=1; i<=N; i++) {
            cout<<1;
            if(i<N) cout<<" ";
        }
    }
    else {
        cout<<"2\n";
        for(int i=1; i<=N; i++) {
            cout<<A[i];
            if(i<N) cout<<" ";
        }
        cout<<"\n";
        for(int i=1; i<=N; i++) {
            cout<<B[i];
            if(i<N) cout<<" ";
        }
    }
    return 0;
}
# 결과 실행 시간 메모리 Grader output
1 Correct 128 ms 19944 KB good job!
2 Correct 128 ms 23944 KB good job!
3 Correct 127 ms 23920 KB good job!
4 Correct 129 ms 23824 KB good job!
5 Correct 151 ms 23748 KB good job!
6 Correct 127 ms 23732 KB good job!
7 Correct 134 ms 23888 KB good job!
8 Correct 128 ms 20176 KB good job!
9 Correct 129 ms 20308 KB good job!
10 Correct 127 ms 20060 KB good job!
11 Correct 132 ms 20048 KB good job!
12 Correct 128 ms 20048 KB good job!
13 Correct 0 ms 344 KB good job!
14 Correct 0 ms 348 KB good job!
15 Correct 0 ms 348 KB good job!
16 Correct 67 ms 15964 KB good job!
17 Correct 55 ms 15952 KB good job!
18 Correct 55 ms 15956 KB good job!
19 Correct 55 ms 15920 KB good job!
20 Correct 54 ms 15892 KB good job!
21 Correct 55 ms 15956 KB good job!
22 Correct 129 ms 20056 KB good job!
23 Correct 0 ms 348 KB good job!
# 결과 실행 시간 메모리 Grader output
1 Incorrect 1 ms 604 KB Integer element c_i[1] equals to 3140, violates the range [1, 2]
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 222 ms 37532 KB Integer element c_i[1] equals to 134990, violates the range [1, 2]
2 Halted 0 ms 0 KB -