Submission #61607243


Source Code Expand

#include <bits/stdc++.h>
using ll = long long;

const int N = 3e5;

void solve() {
    int n;
    std::cin >> n;
    std::vector<int> a(n + 1);
    for (int i = 1; i <= n; i++) {
        std::cin >> a[i];
    }
    ll cnt = 0;
    for (int i = 1; i <= n; i++) {
        cnt += a.end() - std::lower_bound(a.begin() + 1, a.end(), a[i] * 2);
    }
    std::cout << cnt;
}

int main() {
    std::ios::sync_with_stdio(0), std::cout.tie(0), std::cin.tie(0);
    int t;
    t = 1;
    while (t--) {
        solve();
    }
    return 0;
}

Submission Info

Submission Time
Task C - Various Kagamimochi
User mellowsky
Language C++ 20 (gcc 12.2)
Score 300
Code Size 559 Byte
Status AC
Exec Time 45 ms
Memory 5260 KiB

Judge Result

Set Name Sample All
Score / Max Score 0 / 0 300 / 300
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_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, 02_handmade_23.txt, 02_handmade_24.txt, 02_handmade_25.txt, 02_handmade_26.txt, 02_handmade_27.txt, 02_handmade_28.txt, 02_handmade_29.txt
Case Name Status Exec Time Memory
00_sample_00.txt AC 1 ms 3532 KiB
00_sample_01.txt AC 1 ms 3392 KiB
00_sample_02.txt AC 1 ms 3520 KiB
01_random_03.txt AC 44 ms 5160 KiB
01_random_04.txt AC 44 ms 5156 KiB
01_random_05.txt AC 44 ms 4868 KiB
01_random_06.txt AC 44 ms 4836 KiB
01_random_07.txt AC 44 ms 4980 KiB
01_random_08.txt AC 44 ms 5260 KiB
01_random_09.txt AC 44 ms 4984 KiB
01_random_10.txt AC 23 ms 4056 KiB
01_random_11.txt AC 16 ms 3656 KiB
01_random_12.txt AC 8 ms 3528 KiB
01_random_13.txt AC 35 ms 4932 KiB
01_random_14.txt AC 35 ms 4904 KiB
01_random_15.txt AC 35 ms 4884 KiB
01_random_16.txt AC 45 ms 5208 KiB
01_random_17.txt AC 45 ms 5204 KiB
01_random_18.txt AC 44 ms 4860 KiB
01_random_19.txt AC 1 ms 3448 KiB
01_random_20.txt AC 1 ms 3496 KiB
01_random_21.txt AC 1 ms 3644 KiB
01_random_22.txt AC 1 ms 3528 KiB
02_handmade_23.txt AC 41 ms 5072 KiB
02_handmade_24.txt AC 15 ms 3888 KiB
02_handmade_25.txt AC 33 ms 4716 KiB
02_handmade_26.txt AC 5 ms 3444 KiB
02_handmade_27.txt AC 40 ms 4832 KiB
02_handmade_28.txt AC 36 ms 4860 KiB
02_handmade_29.txt AC 24 ms 4868 KiB