QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#811534#8805. Pizza Partyucup-team0040 127ms22596kbC++231.3kb2024-12-12 20:28:562024-12-12 20:28:56

Judging History

This is the latest submission verdict.

  • [2024-12-12 20:28:56]
  • Judged
  • Verdict: 0
  • Time: 127ms
  • Memory: 22596kb
  • [2024-12-12 20:28:56]
  • Submitted

answer

#include <bits/stdc++.h>

using i64 = long long;
using u64 = unsigned long long;
using u32 = unsigned;
using u128 = unsigned __int128;

int main() {
    std::ios::sync_with_stdio(false);
    std::cin.tie(nullptr);
    
    int N;
    std::cin >> N;
    
    std::vector<int> a(N), b(N), cnta(N), cntb(N);
    for (int i = 0; i < N; i++) {
        std::cin >> a[i];
        a[i]--;
        cnta[a[i]]++;
    }
    for (int i = 0; i < N; i++) {
        std::cin >> b[i];
        b[i]--;
        cntb[b[i]]++;
    }
    
    if (cnta != cntb) {
        std::cout << -1 << "\n";
        return 0;
    }
    
    if (*std::max_element(a.begin(), a.end()) <= 1) {
        auto ar = a;
        std::reverse(ar.begin(), ar.end());
        if (ar == b) {
            std::cout << 1 << "\n";
            for (int i = 0; i < N; i++) {
                std::cout << 1 << " \n"[i == N - 1];
            }
            for (int i = 0; i < N; i++) {
                std::cout << 1 << " \n"[i == N - 1];
            }
        } else {
            for (int i = 0; i < N; i++) {
                std::cout << a[i] + 1 << " \n"[i == N - 1];
            }
            for (int i = 0; i < N; i++) {
                std::cout << b[i] + 1 << " \n"[i == N - 1];
            }
        }
        return 0;
    }
    
    return 0;
}

Details

Tip: Click on the bar to expand more detailed information

Subtask #1:

score: 0
Wrong Answer

Test #1:

score: 0
Wrong Answer
time: 108ms
memory: 22596kb

input:

1000000
1 1 1 2 1 1 1 1 1 2 1 1 1 2 1 2 1 1 1 2 2 1 2 1 2 2 2 2 2 1 2 2 1 1 1 2 1 1 2 1 2 2 2 2 2 2 2 1 2 1 2 2 1 1 2 1 2 2 2 1 1 2 2 1 1 1 1 2 1 2 2 1 2 2 2 1 2 1 1 2 1 1 1 2 1 2 2 1 1 1 2 2 2 2 1 2 1 1 1 2 2 2 1 1 1 1 1 2 2 2 1 1 1 2 2 2 2 1 2 2 2 1 2 1 1 1 1 1 2 2 2 2 1 1 1 1 2 2 2 2 1 2 1 1 2 1 ...

output:

1 1 1 2 1 1 1 1 1 2 1 1 1 2 1 2 1 1 1 2 2 1 2 1 2 2 2 2 2 1 2 2 1 1 1 2 1 1 2 1 2 2 2 2 2 2 2 1 2 1 2 2 1 1 2 1 2 2 2 1 1 2 2 1 1 1 1 2 1 2 2 1 2 2 2 1 2 1 1 2 1 1 1 2 1 2 2 1 1 1 2 2 2 2 1 2 1 1 1 2 2 2 1 1 1 1 1 2 2 2 1 1 1 2 2 2 2 1 2 2 2 1 2 1 1 1 1 1 2 2 2 2 1 1 1 1 2 2 2 2 1 2 1 1 2 1 2 1 2 1 ...

result:

wrong output format Expected EOLN

Subtask #2:

score: 0
Wrong Answer

Test #24:

score: 0
Wrong Answer
time: 1ms
memory: 3688kb

input:

5000
3140 3541 3540 3884 2792 3966 1359 549 2273 2669 2100 4448 4722 3937 23 3964 4910 3490 61 2723 2554 4177 3025 4909 2127 939 2536 835 2801 459 3374 972 4687 2102 2919 4367 4905 3414 869 2272 507 4210 2906 2584 1639 2020 3287 3447 2500 4866 3284 2010 1826 331 1873 3895 4946 889 3059 894 4233 2541...

output:


result:

wrong output format Unexpected end of file - int32 expected

Subtask #3:

score: 0
Wrong Answer

Test #39:

score: 0
Wrong Answer
time: 127ms
memory: 18640kb

input:

1000000
134990 280863 995875 82485 490673 517020 49269 636214 69331 626226 96180 743288 524606 324456 937362 164072 680663 931183 195920 618400 741187 164410 478750 590824 160168 192530 154228 661164 17160 343556 653139 229351 350929 719054 634472 433811 352199 163260 833268 56711 963125 346135 9350...

output:


result:

wrong output format Unexpected end of file - int32 expected