結果

問題 No.2178 Payable Magic Items
ユーザー たたき@競プロたたき@競プロ
提出日時 2023-07-12 18:38:32
言語 C++23
(gcc 12.3.0 + boost 1.83.0)
結果
WA  
実行時間 -
コード長 715 bytes
コンパイル時間 2,792 ms
コンパイル使用メモリ 246,068 KB
実行使用メモリ 5,800 KB
最終ジャッジ日時 2023-10-12 08:58:45
合計ジャッジ時間 7,291 ms
ジャッジサーバーID
(参考情報)
judge13 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 WA -
testcase_01 AC 1 ms
4,348 KB
testcase_02 AC 1 ms
4,352 KB
testcase_03 RE -
testcase_04 AC 1 ms
4,348 KB
testcase_05 RE -
testcase_06 RE -
testcase_07 WA -
testcase_08 RE -
testcase_09 RE -
testcase_10 RE -
testcase_11 RE -
testcase_12 RE -
testcase_13 RE -
testcase_14 RE -
testcase_15 RE -
testcase_16 RE -
testcase_17 RE -
testcase_18 RE -
testcase_19 RE -
testcase_20 RE -
testcase_21 RE -
testcase_22 RE -
testcase_23 RE -
testcase_24 RE -
testcase_25 RE -
testcase_26 RE -
権限があれば一括ダウンロードができます

ソースコード

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;
		rep(j,k){
			int a;cin>>a;
			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