提出 #71128984


ソースコード 拡げる

#include <bits/stdc++.h>
#define ll long long
using namespace std;

const int Maxn=1e6+6;
map<int,int>mp[20];

int n,m;
int a[Maxn],l[Maxn];
ll ans;

int main(){
    cin>>n>>m;
    for(int i=1;i<=n;i++){
        cin>>a[i];
        int x=a[i];
        while(x) l[i]++,x/=10;
        mp[l[i]][a[i]%m]++;
    }

    for(int i=1;i<=n;i++){
        ll x=a[i];
        for(int j=1;j<=10;j++){
            x=(x*10)%m;
            ans+=mp[j][(m-x)%m];
        }
    }
    cout<<ans;

    return 0;
}

提出情報

提出日時
問題 D - 183183
ユーザ AceTaffy_
言語 C++23 (GCC 15.2.0)
得点 400
コード長 521 Byte
結果 AC
実行時間 1923 ms
メモリ 108296 KiB

ジャッジ結果

セット名 Sample All
得点 / 配点 0 / 0 400 / 400
結果
AC × 4
AC × 25
セット名 テストケース
Sample 00_sample_00.txt, 00_sample_01.txt, 00_sample_02.txt, 00_sample_03.txt
All 00_sample_00.txt, 00_sample_01.txt, 00_sample_02.txt, 00_sample_03.txt, 01_random_00.txt, 01_random_01.txt, 01_random_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
ケース名 結果 実行時間 メモリ
00_sample_00.txt AC 1 ms 3592 KiB
00_sample_01.txt AC 1 ms 3548 KiB
00_sample_02.txt AC 1 ms 3552 KiB
00_sample_03.txt AC 1 ms 3380 KiB
01_random_00.txt AC 1 ms 3436 KiB
01_random_01.txt AC 1 ms 3552 KiB
01_random_02.txt AC 1 ms 3592 KiB
01_random_03.txt AC 1 ms 3400 KiB
01_random_04.txt AC 63 ms 5308 KiB
01_random_05.txt AC 210 ms 26496 KiB
01_random_06.txt AC 67 ms 4588 KiB
01_random_07.txt AC 637 ms 51532 KiB
01_random_08.txt AC 55 ms 4832 KiB
01_random_09.txt AC 1686 ms 96844 KiB
01_random_10.txt AC 66 ms 5256 KiB
01_random_11.txt AC 1923 ms 108296 KiB
01_random_12.txt AC 67 ms 5216 KiB
01_random_13.txt AC 58 ms 11724 KiB
01_random_14.txt AC 58 ms 4512 KiB
01_random_15.txt AC 812 ms 51116 KiB
01_random_16.txt AC 35 ms 4516 KiB
01_random_17.txt AC 51 ms 11136 KiB
01_random_18.txt AC 66 ms 5220 KiB
01_random_19.txt AC 60 ms 5064 KiB
01_random_20.txt AC 13 ms 3892 KiB