Submission #61554605


Source Code Expand

Copy
/*
#pragma GCC optimize("Ofast,unroll-loops")
#pragma GCC target("avx2,fma,bmi,bmi2,sse4.2,popcnt,lzcnt")
*/
#include <bits/stdc++.h>
#define taskname ""
#define all(x) x.begin(), x.end()
#define rall(x) x.rbegin(), x.rend()
#define i64 long long
#define int long long
#define isz(x) (int)x.size()
using namespace std;
void solve() {
int n;
cin >> n;
vector<int> a(n);
for (int i = 0; i < n; ++i) {
cin >> a[i];
 
הההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההה
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
/*
#pragma GCC optimize("Ofast,unroll-loops")
#pragma GCC target("avx2,fma,bmi,bmi2,sse4.2,popcnt,lzcnt")
*/

#include <bits/stdc++.h>
#define taskname ""
#define all(x) x.begin(), x.end()
#define rall(x) x.rbegin(), x.rend()
#define i64 long long
#define int long long
#define isz(x) (int)x.size()
using namespace std;

void solve() {
    int n;
    cin >> n;

    vector<int> a(n);
    for (int i = 0; i < n; ++i) {
        cin >> a[i];
    }

    auto check = [&](int len) -> bool {
        for (int i = 0, j = n - len; i < len; ++i, ++j) {
            if (a[i] * 2 > a[j]) return false;
        }
        return true;
    };

    int l = 0, r = n / 2;
    while (l < r) {
        int mid = (l + r + 1) >> 1;
        if (check(mid)) {
            l = mid;
        }
        else {
            r = mid - 1;
        }
    }
    cout << l << endl;
}

signed main() {

#ifndef CDuongg
    if (fopen(taskname".inp", "r"))
        assert(freopen(taskname".inp", "r", stdin)), assert(freopen(taskname".out", "w", stdout));
#else
    freopen("bai3.inp", "r", stdin);
    freopen("bai3.out", "w", stdout);
    auto start = chrono::high_resolution_clock::now();
#endif

    ios_base::sync_with_stdio(false);
    cin.tie(nullptr);
    int t = 1; //cin >> t;
    while(t--) solve();

#ifdef CDuongg
   auto end = chrono::high_resolution_clock::now();
   cout << "\n"; for(int i = 1; i <= 100; ++i) cout << '=';
   cout << "\nExecution time: " << chrono::duration_cast<chrono::milliseconds> (end - start).count() << "[ms]" << endl;
#endif

}

Submission Info

Submission Time
Task E - Simultaneous Kagamimochi
User bimatbatmi
Language C++ 23 (gcc 12.2)
Score 450
Code Size 1598 Byte
Status AC
Exec Time 31 ms
Memory 7188 KB

Judge Result

Set Name Sample All
Score / Max Score 0 / 0 450 / 450
Status
AC × 3
AC × 41
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, 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, 02_handmade_36.txt, 02_handmade_37.txt, 02_handmade_38.txt, 02_handmade_39.txt, 02_handmade_40.txt
Case Name Status Exec Time Memory
00_sample_00.txt AC 1 ms 3460 KB
00_sample_01.txt AC 1 ms 3540 KB
00_sample_02.txt AC 1 ms 3612 KB
01_random_03.txt AC 30 ms 6920 KB
01_random_04.txt AC 30 ms 7020 KB
01_random_05.txt AC 30 ms 7164 KB
01_random_06.txt AC 30 ms 6968 KB
01_random_07.txt AC 30 ms 7084 KB
01_random_08.txt AC 4 ms 3664 KB
01_random_09.txt AC 28 ms 7088 KB
01_random_10.txt AC 16 ms 5260 KB
01_random_11.txt AC 30 ms 7184 KB
01_random_12.txt AC 29 ms 7188 KB
01_random_13.txt AC 27 ms 7032 KB
01_random_14.txt AC 30 ms 7100 KB
01_random_15.txt AC 29 ms 6996 KB
01_random_16.txt AC 31 ms 6920 KB
01_random_17.txt AC 31 ms 6940 KB
01_random_18.txt AC 30 ms 7088 KB
01_random_19.txt AC 30 ms 7080 KB
01_random_20.txt AC 31 ms 7012 KB
01_random_21.txt AC 30 ms 6968 KB
01_random_22.txt AC 31 ms 7096 KB
01_random_23.txt AC 30 ms 6976 KB
01_random_24.txt AC 30 ms 6936 KB
01_random_25.txt AC 30 ms 7080 KB
01_random_26.txt AC 29 ms 6952 KB
01_random_27.txt AC 29 ms 7020 KB
01_random_28.txt AC 29 ms 7080 KB
01_random_29.txt AC 29 ms 7016 KB
01_random_30.txt AC 29 ms 6968 KB
01_random_31.txt AC 30 ms 6944 KB
01_random_32.txt AC 29 ms 7008 KB
01_random_33.txt AC 17 ms 5124 KB
01_random_34.txt AC 23 ms 5956 KB
01_random_35.txt AC 19 ms 5440 KB
02_handmade_36.txt AC 1 ms 3532 KB
02_handmade_37.txt AC 1 ms 3532 KB
02_handmade_38.txt AC 28 ms 7016 KB
02_handmade_39.txt AC 28 ms 7096 KB
02_handmade_40.txt AC 16 ms 7016 KB


2025-03-05 (Wed)
03:40:25 +00:00