結果

問題 No.2644 Iro Iro-Iro
ユーザー kotatsugame
提出日時 2024-02-19 21:28:38
言語 C++14
(gcc 13.3.0 + boost 1.87.0)
結果
AC  
実行時間 196 ms / 2,000 ms
コード長 619 bytes
コンパイル時間 2,089 ms
コンパイル使用メモリ 112,244 KB
実行使用メモリ 31,780 KB
最終ジャッジ日時 2024-09-29 01:24:11
合計ジャッジ時間 8,683 ms
ジャッジサーバーID
(参考情報)
judge3 / judge4
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 30
権限があれば一括ダウンロードができます

ソースコード

diff #

#include<iostream>
#include<algorithm>
#include<vector>
#include<cassert>
#include<atcoder/modint>
#include<atcoder/convolution>
using namespace std;
using mint=atcoder::modint998244353;
const int W=101;
const int L=W*W*W;
int N,M;
int main()
{
	ios::sync_with_stdio(false);
	cin.tie(nullptr);
	cin>>N>>M;
	vector<mint>A(L);
	for(int i=0;i<N;i++)
	{
		int a,b,c;cin>>a>>b>>c;
		A[a*W*W+b*W+c]=1;
	}
	vector<mint>B=A;
	reverse(B.begin(),B.end());
	A=atcoder::convolution(A,B);
	int ans=N;
	for(int i=0;i<M;i++)
	{
		int x,y,z;cin>>x>>y>>z;
		x=x*W*W+y*W+z;
		ans=max(ans,2*N-(int)A[x+L-1].val());
	}
	cout<<ans<<endl;
}
0