Submission #60749295


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 new_line 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);
        lli s; scanf("%lld",&s);
        
        std::vector<lli> a(n); for (int i = 0; i < n; i++) scanf("%lld",&a[i]);
        for (int i = 0; i < n; i++) a.push_back(a[i]);
        lli pre[2*n]; pre[0] = a[0]; for (int i = 1; i < 2*n; i++) pre[i] = pre[i-1] + a[i];
        
        bool ok = 0;
        if (s % pre[n-1] == 0) ok = 1;
        
        lli tot = s/pre[n-1];
        s -= pre[n-1]*tot;
        
        std::map<lli,int> cnt;
        cnt[0] = 1;
        for (int i = 0; i < 2*n; i++) {
            if (cnt.find(pre[i]) != cnt.end()) ok = 1;
            cnt[pre[i] + s] = 1;
        }
        
        yn(ok, 1);
        
    }
    
    return 0;
}

/*

*/

Submission Info

Submission Time
Task D - Repeated Sequence
User MArhamAA1422
Language C++ 20 (Clang 16.0.6)
Score 400
Code Size 1361 Byte
Status AC
Exec Time 148 ms
Memory 34632 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 400 / 400
Status
AC × 4
AC × 54
Set Name Test Cases
Sample 00_sample_00.txt, 00_sample_01.txt, 00_sample_02.txt, 00_sample_03.txt
All 00_sample_00.txt, 00_sample_01.txt, 00_sample_02.txt, 00_sample_03.txt, 01_random_04.txt, 01_random_05.txt, 01_random_06.txt, 01_random_07.txt, 01_random_08.txt, 01_random_09.txt, 01_random_10.txt, 01_random_11.txt, 01_random_12.txt, 01_random_13.txt, 01_random_14.txt, 01_random_15.txt, 01_random_16.txt, 01_random_17.txt, 01_random_18.txt, 01_random_19.txt, 01_random_20.txt, 01_random_21.txt, 01_random_22.txt, 01_random_23.txt, 01_random_24.txt, 01_random_25.txt, 01_random_26.txt, 01_random_27.txt, 01_random_28.txt, 01_random_29.txt, 01_random_30.txt, 01_random_31.txt, 01_random_32.txt, 01_random_33.txt, 01_random_34.txt, 01_random_35.txt, 01_random_36.txt, 01_random_37.txt, 01_random_38.txt, 01_random_39.txt, 01_random_40.txt, 01_random_41.txt, 01_random_42.txt, 01_random_43.txt, 01_random_44.txt, 01_random_45.txt, 02_handmade_46.txt, 02_handmade_47.txt, 02_handmade_48.txt, 02_handmade_49.txt, 02_handmade_50.txt, 02_handmade_51.txt, 02_handmade_52.txt, 02_handmade_53.txt
Case Name Status Exec Time Memory
00_sample_00.txt AC 1 ms 3616 KiB
00_sample_01.txt AC 1 ms 3624 KiB
00_sample_02.txt AC 1 ms 3512 KiB
00_sample_03.txt AC 1 ms 3716 KiB
01_random_04.txt AC 119 ms 34632 KiB
01_random_05.txt AC 120 ms 34628 KiB
01_random_06.txt AC 120 ms 34472 KiB
01_random_07.txt AC 120 ms 34592 KiB
01_random_08.txt AC 118 ms 34612 KiB
01_random_09.txt AC 118 ms 34332 KiB
01_random_10.txt AC 118 ms 34512 KiB
01_random_11.txt AC 119 ms 34516 KiB
01_random_12.txt AC 117 ms 34484 KiB
01_random_13.txt AC 118 ms 34472 KiB
01_random_14.txt AC 120 ms 34592 KiB
01_random_15.txt AC 118 ms 34408 KiB
01_random_16.txt AC 115 ms 34612 KiB
01_random_17.txt AC 115 ms 34612 KiB
01_random_18.txt AC 115 ms 34464 KiB
01_random_19.txt AC 114 ms 34516 KiB
01_random_20.txt AC 114 ms 34516 KiB
01_random_21.txt AC 115 ms 34488 KiB
01_random_22.txt AC 115 ms 34516 KiB
01_random_23.txt AC 114 ms 34328 KiB
01_random_24.txt AC 115 ms 34540 KiB
01_random_25.txt AC 114 ms 34588 KiB
01_random_26.txt AC 115 ms 34332 KiB
01_random_27.txt AC 114 ms 34588 KiB
01_random_28.txt AC 66 ms 22016 KiB
01_random_29.txt AC 3 ms 4576 KiB
01_random_30.txt AC 7 ms 5948 KiB
01_random_31.txt AC 41 ms 15620 KiB
01_random_32.txt AC 87 ms 27392 KiB
01_random_33.txt AC 1 ms 3916 KiB
01_random_34.txt AC 42 ms 15892 KiB
01_random_35.txt AC 20 ms 9536 KiB
01_random_36.txt AC 19 ms 9384 KiB
01_random_37.txt AC 73 ms 23804 KiB
01_random_38.txt AC 38 ms 14848 KiB
01_random_39.txt AC 9 ms 6424 KiB
01_random_40.txt AC 116 ms 34472 KiB
01_random_41.txt AC 116 ms 34408 KiB
01_random_42.txt AC 116 ms 34516 KiB
01_random_43.txt AC 22 ms 10152 KiB
01_random_44.txt AC 45 ms 15868 KiB
01_random_45.txt AC 6 ms 5468 KiB
02_handmade_46.txt AC 148 ms 34560 KiB
02_handmade_47.txt AC 1 ms 3604 KiB
02_handmade_48.txt AC 107 ms 34612 KiB
02_handmade_49.txt AC 1 ms 3592 KiB
02_handmade_50.txt AC 111 ms 34412 KiB
02_handmade_51.txt AC 114 ms 34332 KiB
02_handmade_52.txt AC 108 ms 34572 KiB
02_handmade_53.txt AC 109 ms 34540 KiB