Submission #58953760


Source Code Expand

// I AM A MUSLIM

#include "bits/stdc++.h"

#pragma GCC optimize("O3,unroll-loops")
#pragma GCC target("avx2,bmi,bmi2,lzcnt,popcnt")

#define fast_io std::ios::sync_with_stdio(0);std::cin.tie(0)
#define lli long long int
#define flush fflush(stdout)
#define BL printf("\n")
#define yn(a, b) printf("%s\n", a >= b ? "Yes":"No")
#define safe_mod(a, M) ((a%M+M)%M)
// #define int lli

using pii = std::pair<int,int>;

const int MOD = 1000000007;
const int mxN = 100100;

signed main() {
    int testCases=1;
    // scanf("%d",&testCases);
    
    for (int TC = 1; TC <= testCases; TC++) {
        int n;
        scanf("%d",&n);
        int a[n]; for (int i = 0; i < n; i++) scanf("%d",&a[i]);
        int b[n-1]; for (int i = 0; i < n-1; i++) scanf("%d",&b[i]);
        
        std::sort(a,a+n);
        std::sort(b,b+n-1);
        int miss = -1;
        
        for (int i = n-1; i >= 1; i--) {
            if (a[i] > b[i-1]) {
                miss = i;
                break;
            }
        }
        
        if (miss == -1) {
            printf("%d\n", a[0]);
            continue;
        }
        
        int ans = a[miss];
        for (int i = miss-1; i >= 0; i--) {
            if (a[i] > b[i]) {
                ans = -1;
            }
        }
        
        printf("%d\n", ans);
        
    }
    
    return 0;
}

/*

*/

Submission Info

Submission Time
Task C - Prepare Another Box
User MArhamAA1422
Language C++ 20 (Clang 16.0.6)
Score 350
Code Size 1407 Byte
Status AC
Exec Time 66 ms
Memory 5460 KiB

Compile Error

./Main.cpp:5:13: warning: unknown pragma ignored [-Wunknown-pragmas]
#pragma GCC optimize("O3,unroll-loops")
            ^
./Main.cpp:6:13: warning: unknown pragma ignored [-Wunknown-pragmas]
#pragma GCC target("avx2,bmi,bmi2,lzcnt,popcnt")
            ^
./Main.cpp:18:11: warning: unused variable 'MOD' [-Wunused-const-variable]
const int MOD = 1000000007;
          ^
./Main.cpp:19:11: warning: unused variable 'mxN' [-Wunused-const-variable]
const int mxN = 100100;
          ^
4 warnings generated.

Judge Result

Set Name Sample All
Score / Max Score 0 / 0 350 / 350
Status
AC × 3
AC × 30
Set Name Test Cases
Sample 00_sample_00.txt, 00_sample_01.txt, 00_sample_02.txt
All 00_sample_00.txt, 00_sample_01.txt, 00_sample_02.txt, 01_random_00.txt, 01_random_01.txt, 01_random_02.txt, 01_random_03.txt, 02_random2_00.txt, 02_random2_01.txt, 02_random2_02.txt, 02_random2_03.txt, 02_random2_04.txt, 02_random2_05.txt, 02_random2_06.txt, 02_random2_07.txt, 02_random2_08.txt, 02_random2_09.txt, 02_random2_10.txt, 02_random2_11.txt, 02_random2_12.txt, 02_random2_13.txt, 02_random2_14.txt, 02_random2_15.txt, 03_random3_00.txt, 03_random3_01.txt, 03_random3_02.txt, 04_handmade_00.txt, 04_handmade_01.txt, 04_handmade_02.txt, 04_handmade_03.txt
Case Name Status Exec Time Memory
00_sample_00.txt AC 1 ms 3652 KiB
00_sample_01.txt AC 1 ms 3616 KiB
00_sample_02.txt AC 1 ms 3780 KiB
01_random_00.txt AC 22 ms 4260 KiB
01_random_01.txt AC 25 ms 4388 KiB
01_random_02.txt AC 66 ms 5144 KiB
01_random_03.txt AC 65 ms 5204 KiB
02_random2_00.txt AC 66 ms 5252 KiB
02_random2_01.txt AC 66 ms 5144 KiB
02_random2_02.txt AC 66 ms 5244 KiB
02_random2_03.txt AC 65 ms 5200 KiB
02_random2_04.txt AC 66 ms 5340 KiB
02_random2_05.txt AC 65 ms 5340 KiB
02_random2_06.txt AC 65 ms 5344 KiB
02_random2_07.txt AC 66 ms 5380 KiB
02_random2_08.txt AC 66 ms 5336 KiB
02_random2_09.txt AC 66 ms 5168 KiB
02_random2_10.txt AC 65 ms 5172 KiB
02_random2_11.txt AC 65 ms 5452 KiB
02_random2_12.txt AC 66 ms 5392 KiB
02_random2_13.txt AC 65 ms 5340 KiB
02_random2_14.txt AC 66 ms 5380 KiB
02_random2_15.txt AC 66 ms 5340 KiB
03_random3_00.txt AC 66 ms 5460 KiB
03_random3_01.txt AC 65 ms 5172 KiB
03_random3_02.txt AC 65 ms 5208 KiB
04_handmade_00.txt AC 1 ms 3608 KiB
04_handmade_01.txt AC 1 ms 3784 KiB
04_handmade_02.txt AC 1 ms 3736 KiB
04_handmade_03.txt AC 33 ms 5380 KiB