結果

問題 No.2684 折々の色
ユーザー kotatsugame
提出日時 2024-03-20 21:23:08
言語 C++14
(gcc 13.3.0 + boost 1.87.0)
結果
AC  
実行時間 560 ms / 2,000 ms
コード長 853 bytes
コンパイル時間 604 ms
コンパイル使用メモリ 72,704 KB
実行使用メモリ 27,776 KB
最終ジャッジ日時 2024-09-30 07:09:07
合計ジャッジ時間 16,066 ms
ジャッジサーバーID
(参考情報)
judge3 / judge5
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 2
other AC * 56
権限があれば一括ダウンロードができます

ソースコード

diff #

#include<iostream>
#include<array>
#include<set>
#include<cassert>
using namespace std;
using T=array<int,10>;
int N,M;
int X[10];
multiset<T>V[101];
T C[2<<17];
int t[2<<17];
int main()
{
	ios::sync_with_stdio(false);
	cin.tie(nullptr);
	cin>>N>>M;
	for(int i=0;i<M;i++)cin>>X[i];
	for(int i=0;i<N;i++)
	{
		for(int j=0;j<M;j++)cin>>C[i][j];
		cin>>t[i];
		V[t[i]].insert(C[i]);
	}
	for(int i=0;i<N;i++)
	{
		V[t[i]].erase(V[t[i]].find(C[i]));
		for(int tj=1;tj<=100;tj++)
		{
			bool ok=true;
			T nxt;
			for(int j=0;j<10;j++)
			{
				nxt[j]=10000*X[j];
				nxt[j]-=100*t[i]*C[i][j];
				nxt[j]+=tj*t[i]*C[i][j];
				int v=100*tj;
				if(nxt[j]%v!=0)
				{
					ok=false;
					break;
				}
				nxt[j]/=v;
			}
			if(ok&&V[tj].find(nxt)!=V[tj].end())
			{
				cout<<"Yes"<<endl;
				return 0;
			}
		}
		V[t[i]].insert(C[i]);
	}
	cout<<"No"<<endl;
}
0