Submission #61559569


Source Code Expand

Copy
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
int main() {
int N;
cin >> N;
int A[N];
for (int i = 0; i < N; i++)
cin >> A[i];
ll ans = 0;
for (int i = 0; i < N; i++) {
int cnt = lower_bound(A, A + N, A[i] * 2) - A;
#ifdef LOCAL
cout << A[i] << "(" << A[i] / 2 << "): " << cnt << '\n';
#endif
ans += N - cnt;
}
 
הההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההה
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
#include <bits/stdc++.h>
using namespace std;
using ll = long long;

int main() {
    int N;
    cin >> N;
    int A[N];
    for (int i = 0; i < N; i++)
        cin >> A[i];

    ll ans = 0;
    for (int i = 0; i < N; i++) {
        int cnt = lower_bound(A, A + N, A[i] * 2) - A;

#ifdef LOCAL
        cout << A[i] << "(" << A[i] / 2 << "): " << cnt << '\n';
#endif

        ans += N - cnt;
    }

    cout << ans << '\n';
}

Submission Info

Submission Time
Task C - Various Kagamimochi
User Mikan04y
Language C++ 23 (gcc 12.2)
Score 300
Code Size 449 Byte
Status AC
Exec Time 136 ms
Memory 5600 KB

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 3644 KB
00_sample_01.txt AC 1 ms 3464 KB
00_sample_02.txt AC 1 ms 3640 KB
01_random_03.txt AC 136 ms 5448 KB
01_random_04.txt AC 136 ms 5404 KB
01_random_05.txt AC 136 ms 5384 KB
01_random_06.txt AC 135 ms 5416 KB
01_random_07.txt AC 135 ms 5444 KB
01_random_08.txt AC 135 ms 5600 KB
01_random_09.txt AC 136 ms 5440 KB
01_random_10.txt AC 72 ms 4480 KB
01_random_11.txt AC 44 ms 4188 KB
01_random_12.txt AC 22 ms 3756 KB
01_random_13.txt AC 84 ms 5456 KB
01_random_14.txt AC 85 ms 5408 KB
01_random_15.txt AC 85 ms 5384 KB
01_random_16.txt AC 109 ms 5440 KB
01_random_17.txt AC 109 ms 5444 KB
01_random_18.txt AC 109 ms 5436 KB
01_random_19.txt AC 1 ms 3652 KB
01_random_20.txt AC 1 ms 3496 KB
01_random_21.txt AC 1 ms 3448 KB
01_random_22.txt AC 1 ms 3436 KB
02_handmade_23.txt AC 95 ms 5404 KB
02_handmade_24.txt AC 34 ms 4188 KB
02_handmade_25.txt AC 76 ms 5076 KB
02_handmade_26.txt AC 10 ms 3832 KB
02_handmade_27.txt AC 101 ms 5392 KB
02_handmade_28.txt AC 130 ms 5456 KB
02_handmade_29.txt AC 51 ms 5456 KB


2025-03-11 (Tue)
03:42:47 +00:00