Submission #71477638


Source Code Expand

#include <bits/stdc++.h>
using namespace std;
//#pragma GCC optimize(2)
/*i32 : -2e9~2e9
i64: -9e18~9e18
ui64: 0~1.8e19*/
typedef unsigned long long ull;
typedef unsigned long long ui64;
typedef long long i64;
typedef long long ll;
#define umap unordered_map
#define forrr(A) for (int i = 1; i <= A; i++)
#define range(s,e) for (int j=s;j!=e;(s<e?j++:j--))
#define endl '\n'
#define debug(A) cout << #A << "==" << A << '\n';
#define pb push_back
#define point pair<int, int>
#define all(A) A.begin(), A.end()
#define eps(A) fixed << setprecision(A)
#define nextp(A) next_permutation(A.begin(), A.end())
//#define int long long
const int MAXN = 1e5 + 5, MOD = 1e9 + 7;
int n, m, t, ar[MAXN], ans, cnt, k;
void dxy(int &x, int &y, point p) { x = p.first, y = p.second; }
void solve() { 
    cin >> n;
    vector<int> a(n);
    for(auto &x : a) cin >> x;
    vector<int> pre(n+1, 0);
    for(int i = 1; i <= n; i++) {
        pre[i] = pre[i-1] + a[i-1];
    }
    for(int i = 1; i <= n; i++) {
        for(int j = 1; j <= i; j++) {
            int sum = pre[i] - pre[j-1], f = 1;
            //debug(sum)
            for(int k = j; k <= i; k++) {
                if(sum % a[k-1] == 0) {
                    f = 0;
                    break;
                }
            }
            ans += f;
        }
    }
    cout << ans << endl;
    return;
}

signed main() {
    ios::sync_with_stdio(false), cin.tie(0), cout.tie(0);
    int times = 1;// cin >> times;
    while (times--) solve();
    return 0;
}

Submission Info

Submission Time
Task B - No-Divisible Range
User unaptx4869
Language C++23 (GCC 15.2.0)
Score 200
Code Size 1557 Byte
Status AC
Exec Time 1 ms
Memory 3608 KiB

Judge Result

Set Name Sample All
Score / Max Score 0 / 0 200 / 200
Status
AC × 2
AC × 25
Set Name Test Cases
Sample example_00.txt, example_01.txt
All example_00.txt, example_01.txt, hand_00.txt, hand_01.txt, hand_02.txt, hand_03.txt, hand_04.txt, hand_05.txt, hand_06.txt, hand_07.txt, random_00.txt, random_01.txt, random_02.txt, random_03.txt, random_04.txt, random_05.txt, random_06.txt, random_07.txt, random_08.txt, random_09.txt, random_10.txt, random_11.txt, random_12.txt, random_13.txt, random_14.txt
Case Name Status Exec Time Memory
example_00.txt AC 1 ms 3600 KiB
example_01.txt AC 1 ms 3512 KiB
hand_00.txt AC 1 ms 3368 KiB
hand_01.txt AC 1 ms 3428 KiB
hand_02.txt AC 1 ms 3396 KiB
hand_03.txt AC 1 ms 3488 KiB
hand_04.txt AC 1 ms 3608 KiB
hand_05.txt AC 1 ms 3512 KiB
hand_06.txt AC 1 ms 3436 KiB
hand_07.txt AC 1 ms 3440 KiB
random_00.txt AC 1 ms 3512 KiB
random_01.txt AC 1 ms 3512 KiB
random_02.txt AC 1 ms 3448 KiB
random_03.txt AC 1 ms 3540 KiB
random_04.txt AC 1 ms 3376 KiB
random_05.txt AC 1 ms 3532 KiB
random_06.txt AC 1 ms 3396 KiB
random_07.txt AC 1 ms 3428 KiB
random_08.txt AC 1 ms 3436 KiB
random_09.txt AC 1 ms 3608 KiB
random_10.txt AC 1 ms 3600 KiB
random_11.txt AC 1 ms 3600 KiB
random_12.txt AC 1 ms 3440 KiB
random_13.txt AC 1 ms 3488 KiB
random_14.txt AC 1 ms 3436 KiB