結果

問題 No.2178 Payable Magic Items
ユーザー たたき@競プロたたき@競プロ
提出日時 2023-07-12 18:47:58
言語 C++23
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 67 ms / 4,000 ms
コード長 735 bytes
コンパイル時間 2,830 ms
コンパイル使用メモリ 245,500 KB
実行使用メモリ 5,448 KB
最終ジャッジ日時 2023-10-12 09:08:26
合計ジャッジ時間 5,187 ms
ジャッジサーバーID
(参考情報)
judge15 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
4,352 KB
testcase_01 AC 1 ms
4,348 KB
testcase_02 AC 2 ms
4,352 KB
testcase_03 AC 15 ms
4,784 KB
testcase_04 AC 1 ms
4,352 KB
testcase_05 AC 15 ms
4,656 KB
testcase_06 AC 16 ms
4,612 KB
testcase_07 AC 2 ms
4,348 KB
testcase_08 AC 15 ms
4,564 KB
testcase_09 AC 4 ms
4,372 KB
testcase_10 AC 2 ms
4,352 KB
testcase_11 AC 66 ms
5,416 KB
testcase_12 AC 65 ms
5,372 KB
testcase_13 AC 66 ms
5,412 KB
testcase_14 AC 66 ms
5,448 KB
testcase_15 AC 67 ms
5,400 KB
testcase_16 AC 66 ms
5,352 KB
testcase_17 AC 33 ms
4,888 KB
testcase_18 AC 2 ms
4,348 KB
testcase_19 AC 15 ms
4,352 KB
testcase_20 AC 2 ms
4,352 KB
testcase_21 AC 2 ms
4,348 KB
testcase_22 AC 2 ms
4,348 KB
testcase_23 AC 2 ms
4,348 KB
testcase_24 AC 51 ms
5,108 KB
testcase_25 AC 23 ms
4,564 KB
testcase_26 AC 19 ms
4,352 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include<bits/stdc++.h>
using namespace std;
 
using ll=long long;
using pp=pair<int,int>;
#define sr string 
#define vc vector
#define db double
#define fi first
#define se second
#define rep(i,n) for(int i=0;i<(int)n;i++)
#define pb push_back
#define all(v) v.begin(),v.end()
#define pque priority_queue
#define bpc(a) __builtin_popcount(a)
int main(){
	int n,k;cin>>n>>k;
	int b=1; rep(i,k)b*=5;
	vc<int>f(k+1,1); rep(i,k)f[i+1]=f[i]*5;
	vc<int>xs(n);
	rep(i,n){
		int x=0;
		sr ss;cin>>ss;
		rep(j,k){
			int a=ss[j]-'0';
			x+=f[j]*a;
		}
		xs[i]=x;
	}
	vc<int>s(f[k]-1,0);
	rep(i,n)s[xs[i]]++;
	rep(i,k)for(int j=f[k]-1;j>=0;j--){
		if((j/f[i])%5!=4)s[j]+=s[j+f[i]];
	}
	int ans=0;
	rep(i,n)if(s[xs[i]]>1)ans++;
	cout<<ans;
}
	
	
0