Submission #61579179


Source Code Expand

Copy
#include <bits/stdc++.h>
using namespace std;
int main() {
int n;
cin >> n;
vector<int> mochi(n);
for(int i=0; i<n; i++) cin >> mochi[i];
long long count = 0;
for(int i=0; i<n; i++){
int res = lower_bound(mochi.begin() + i, mochi.end(), mochi[i] * 2) - mochi.begin();
if(res >= n) break;
count += n - res;
}
cout << count << endl;
}
הההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההה
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
#include <bits/stdc++.h>
using namespace std;

int main() {
    int n;
    cin >> n;
    vector<int> mochi(n);
    for(int i=0; i<n; i++) cin >> mochi[i];
    long long count = 0;
    
    for(int i=0; i<n; i++){
        int res = lower_bound(mochi.begin() + i, mochi.end(), mochi[i] * 2) - mochi.begin();
        if(res >= n) break;
        count += n - res;
    }
    cout << count << endl;
}

Submission Info

Submission Time
Task C - Various Kagamimochi
User soraman
Language C++ 20 (gcc 12.2)
Score 300
Code Size 410 Byte
Status AC
Exec Time 130 ms
Memory 5072 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 3484 KB
00_sample_01.txt AC 1 ms 3472 KB
00_sample_02.txt AC 1 ms 3480 KB
01_random_03.txt AC 129 ms 5000 KB
01_random_04.txt AC 130 ms 4996 KB
01_random_05.txt AC 129 ms 4908 KB
01_random_06.txt AC 130 ms 5004 KB
01_random_07.txt AC 129 ms 5008 KB
01_random_08.txt AC 129 ms 5052 KB
01_random_09.txt AC 129 ms 4964 KB
01_random_10.txt AC 69 ms 4132 KB
01_random_11.txt AC 42 ms 3644 KB
01_random_12.txt AC 22 ms 3600 KB
01_random_13.txt AC 86 ms 5000 KB
01_random_14.txt AC 87 ms 5004 KB
01_random_15.txt AC 87 ms 5004 KB
01_random_16.txt AC 104 ms 4928 KB
01_random_17.txt AC 104 ms 4984 KB
01_random_18.txt AC 104 ms 4912 KB
01_random_19.txt AC 1 ms 3532 KB
01_random_20.txt AC 1 ms 3396 KB
01_random_21.txt AC 1 ms 3528 KB
01_random_22.txt AC 1 ms 3532 KB
02_handmade_23.txt AC 92 ms 4908 KB
02_handmade_24.txt AC 32 ms 3940 KB
02_handmade_25.txt AC 73 ms 4664 KB
02_handmade_26.txt AC 9 ms 3532 KB
02_handmade_27.txt AC 95 ms 4960 KB
02_handmade_28.txt AC 120 ms 5016 KB
02_handmade_29.txt AC 42 ms 5072 KB


2025-03-28 (Fri)
09:13:12 +00:00