Submission #1055734

# Submission time Handle Problem Language Result Execution time Memory
1055734 2024-08-13T04:37:58 Z 변재우(#11070) Pizza Party (CCO24_day1problem2) C++17
0 / 12
177 ms 37740 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 "; cout<<"\n";
        for(int i=1; i<=N; i++) cout<<"1 ";
    }
    else {
        cout<<"2\n";
        if(A[1]==2) for(int i=1; i<=N; i++) A[i]=3-A[i], B[i]=3-B[i];
        for(int i=1; i<=N; i++) cout<<A[i]<<" "; cout<<"\n";
        for(int i=1; i<=N; i++) cout<<B[i]<<" ";
    }
    return 0;
}

Compilation message

Main.cpp: In function 'int main()':
Main.cpp:20:9: warning: this 'for' clause does not guard... [-Wmisleading-indentation]
   20 |         for(int i=1; i<=N; i++) cout<<"1 "; cout<<"\n";
      |         ^~~
Main.cpp:20:45: note: ...this statement, but the latter is misleadingly indented as if it were guarded by the 'for'
   20 |         for(int i=1; i<=N; i++) cout<<"1 "; cout<<"\n";
      |                                             ^~~~
Main.cpp:26:9: warning: this 'for' clause does not guard... [-Wmisleading-indentation]
   26 |         for(int i=1; i<=N; i++) cout<<A[i]<<" "; cout<<"\n";
      |         ^~~
Main.cpp:26:50: note: ...this statement, but the latter is misleadingly indented as if it were guarded by the 'for'
   26 |         for(int i=1; i<=N; i++) cout<<A[i]<<" "; cout<<"\n";
      |                                                  ^~~~
# Verdict Execution time Memory Grader output
1 Incorrect 125 ms 21428 KB Expected EOLN
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 4440 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 177 ms 37740 KB Integer element c_i[1] equals to 134990, violates the range [1, 2]
2 Halted 0 ms 0 KB -