提出 #61566196


ソースコード 拡げる

#include<bits/stdc++.h>
#define int long long
#define mod 1000000007
#define endl '\n'
#define pii pair<int,int>
#define Mikari_My_Wife ios::sync_with_stdio(0),cin.tie(0);
using namespace std;
void solve(){
    int n;
    cin>>n;
    vector<int>all(n);
    for(int i=0;i<n;i++)cin>>all[i];
    sort(all.begin(),all.end());
    int ans=0;
    for(int i=0;i<n;i++){
        int now=all[i]*2;
        int id=lower_bound(all.begin(),all.end(),now)-all.begin();
        ans+=n-id;
    }
    cout<<ans<<endl;

}
signed main(){
    //注意多筆測資輸入!!!
    Mikari_My_Wife
    int t=1;
    //cin>>t;
    while(t--){solve();}
}

提出情報

提出日時
問題 C - Various Kagamimochi
ユーザ zihan_ayame
言語 C++ 20 (gcc 12.2)
得点 300
コード長 661 Byte
結果 AC
実行時間 49 ms
メモリ 7136 KiB

ジャッジ結果

セット名 Sample All
得点 / 配点 0 / 0 300 / 300
結果
AC × 3
AC × 30
セット名 テストケース
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
ケース名 結果 実行時間 メモリ
00_sample_00.txt AC 1 ms 3548 KiB
00_sample_01.txt AC 1 ms 3432 KiB
00_sample_02.txt AC 1 ms 3500 KiB
01_random_03.txt AC 48 ms 7128 KiB
01_random_04.txt AC 49 ms 7004 KiB
01_random_05.txt AC 47 ms 7004 KiB
01_random_06.txt AC 47 ms 6968 KiB
01_random_07.txt AC 48 ms 7076 KiB
01_random_08.txt AC 48 ms 6956 KiB
01_random_09.txt AC 48 ms 7044 KiB
01_random_10.txt AC 25 ms 5148 KiB
01_random_11.txt AC 15 ms 4340 KiB
01_random_12.txt AC 8 ms 3620 KiB
01_random_13.txt AC 38 ms 7068 KiB
01_random_14.txt AC 39 ms 7056 KiB
01_random_15.txt AC 38 ms 6984 KiB
01_random_16.txt AC 46 ms 6960 KiB
01_random_17.txt AC 46 ms 7136 KiB
01_random_18.txt AC 46 ms 6976 KiB
01_random_19.txt AC 1 ms 3484 KiB
01_random_20.txt AC 2 ms 3560 KiB
01_random_21.txt AC 1 ms 3620 KiB
01_random_22.txt AC 1 ms 3488 KiB
02_handmade_23.txt AC 42 ms 7060 KiB
02_handmade_24.txt AC 15 ms 4356 KiB
02_handmade_25.txt AC 34 ms 6248 KiB
02_handmade_26.txt AC 5 ms 3548 KiB
02_handmade_27.txt AC 44 ms 6976 KiB
02_handmade_28.txt AC 42 ms 7080 KiB
02_handmade_29.txt AC 30 ms 6948 KiB