Submission #61554302


Source Code Expand

Copy
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;
template <typename T> using ordered_set = tree<T, null_type, less_equal<T>, rb_tree_tag, tree_order_statistics_node_update>;
// *s.find_by_order(index), s.order_of_key(value)
// erase -> erase -> s.erase(s.upper_bound(value));
signed main()
{
ios_base::sync_with_stdio(0); cin.tie(0);
ll n; cin >> n;
ordered_set<ll> s;
ll ans = 0;
while (n--) {
ll a; cin >> a;
ans += s.order_of_key(a/2+1);
s.insert(a);
 
הההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההה
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;

#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;
template <typename T> using ordered_set = tree<T, null_type, less_equal<T>, rb_tree_tag, tree_order_statistics_node_update>;
// *s.find_by_order(index), s.order_of_key(value)
// erase -> erase -> s.erase(s.upper_bound(value));

signed main()
{
    ios_base::sync_with_stdio(0); cin.tie(0);
    ll n; cin >> n;
    ordered_set<ll> s;
    ll ans = 0;
    while (n--) {
        ll a; cin >> a;
        ans += s.order_of_key(a/2+1);
        s.insert(a);
    }
    
    cout << ans;
}

Submission Info

Submission Time
Task C - Various Kagamimochi
User Ahad_41
Language C++ 20 (gcc 12.2)
Score 300
Code Size 678 Byte
Status AC
Exec Time 443 ms
Memory 34836 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 3480 KB
00_sample_01.txt AC 1 ms 3420 KB
00_sample_02.txt AC 1 ms 3488 KB
01_random_03.txt AC 386 ms 34776 KB
01_random_04.txt AC 439 ms 34736 KB
01_random_05.txt AC 443 ms 34732 KB
01_random_06.txt AC 384 ms 34712 KB
01_random_07.txt AC 400 ms 34700 KB
01_random_08.txt AC 378 ms 34836 KB
01_random_09.txt AC 374 ms 34672 KB
01_random_10.txt AC 141 ms 20008 KB
01_random_11.txt AC 81 ms 13388 KB
01_random_12.txt AC 36 ms 8380 KB
01_random_13.txt AC 326 ms 34776 KB
01_random_14.txt AC 383 ms 34736 KB
01_random_15.txt AC 381 ms 34744 KB
01_random_16.txt AC 413 ms 34692 KB
01_random_17.txt AC 302 ms 34600 KB
01_random_18.txt AC 408 ms 34692 KB
01_random_19.txt AC 1 ms 3448 KB
01_random_20.txt AC 1 ms 3520 KB
01_random_21.txt AC 1 ms 3468 KB
01_random_22.txt AC 1 ms 3520 KB
02_handmade_23.txt AC 341 ms 34712 KB
02_handmade_24.txt AC 91 ms 14420 KB
02_handmade_25.txt AC 261 ms 29384 KB
02_handmade_26.txt AC 20 ms 6628 KB
02_handmade_27.txt AC 308 ms 34732 KB
02_handmade_28.txt AC 325 ms 34728 KB
02_handmade_29.txt AC 312 ms 34708 KB


2025-03-29 (Sat)
20:34:20 +00:00