結果

問題 No.2684 折々の色
ユーザー shobonvipshobonvip
提出日時 2024-03-20 22:46:12
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 1,019 ms / 2,000 ms
コード長 2,012 bytes
コンパイル時間 5,081 ms
コンパイル使用メモリ 272,332 KB
実行使用メモリ 56,060 KB
最終ジャッジ日時 2024-03-20 22:46:45
合計ジャッジ時間 33,283 ms
ジャッジサーバーID
(参考情報)
judge14 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
6,548 KB
testcase_01 AC 2 ms
6,548 KB
testcase_02 AC 2 ms
6,548 KB
testcase_03 AC 2 ms
6,548 KB
testcase_04 AC 2 ms
6,548 KB
testcase_05 AC 2 ms
6,548 KB
testcase_06 AC 2 ms
6,548 KB
testcase_07 AC 2 ms
6,548 KB
testcase_08 AC 2 ms
6,548 KB
testcase_09 AC 2 ms
6,548 KB
testcase_10 AC 2 ms
6,548 KB
testcase_11 AC 462 ms
34,560 KB
testcase_12 AC 296 ms
25,088 KB
testcase_13 AC 560 ms
39,304 KB
testcase_14 AC 250 ms
20,992 KB
testcase_15 AC 353 ms
29,440 KB
testcase_16 AC 66 ms
11,136 KB
testcase_17 AC 266 ms
22,784 KB
testcase_18 AC 522 ms
44,336 KB
testcase_19 AC 569 ms
40,064 KB
testcase_20 AC 379 ms
23,552 KB
testcase_21 AC 111 ms
15,232 KB
testcase_22 AC 579 ms
47,572 KB
testcase_23 AC 370 ms
27,904 KB
testcase_24 AC 168 ms
19,200 KB
testcase_25 AC 253 ms
22,528 KB
testcase_26 AC 509 ms
35,712 KB
testcase_27 AC 349 ms
24,064 KB
testcase_28 AC 373 ms
27,648 KB
testcase_29 AC 968 ms
53,560 KB
testcase_30 AC 882 ms
53,832 KB
testcase_31 AC 903 ms
52,964 KB
testcase_32 AC 975 ms
54,924 KB
testcase_33 AC 965 ms
53,392 KB
testcase_34 AC 922 ms
54,320 KB
testcase_35 AC 926 ms
54,684 KB
testcase_36 AC 947 ms
52,552 KB
testcase_37 AC 955 ms
53,720 KB
testcase_38 AC 1,012 ms
56,060 KB
testcase_39 AC 1,002 ms
56,060 KB
testcase_40 AC 1,019 ms
56,060 KB
testcase_41 AC 985 ms
56,060 KB
testcase_42 AC 1,001 ms
56,060 KB
testcase_43 AC 974 ms
56,060 KB
testcase_44 AC 1,008 ms
56,060 KB
testcase_45 AC 1,000 ms
56,060 KB
testcase_46 AC 995 ms
56,060 KB
testcase_47 AC 2 ms
6,548 KB
testcase_48 AC 2 ms
6,548 KB
testcase_49 AC 2 ms
6,548 KB
testcase_50 AC 2 ms
6,548 KB
testcase_51 AC 2 ms
6,548 KB
testcase_52 AC 2 ms
6,548 KB
testcase_53 AC 2 ms
6,548 KB
testcase_54 AC 2 ms
6,548 KB
testcase_55 AC 2 ms
6,548 KB
testcase_56 AC 1 ms
6,548 KB
testcase_57 AC 2 ms
6,548 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

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

//* ATCODER
#include<atcoder/all>
using namespace atcoder;
typedef modint998244353 mint;
//*/

/* BOOST MULTIPRECISION
#include<boost/multiprecision/cpp_int.hpp>
using namespace boost::multiprecision;
//*/

typedef long long ll;

#define rep(i, s, n) for (int i = (int)(s); i < (int)(n); i++)
#define rrep(i, s, n) for (int i = (int)(n)-1; i >= (int)(s); i--)

template <typename T> bool chmin(T &a, const T &b) {
	if (a <= b) return false;
	a = b;
	return true;
}

template <typename T> bool chmax(T &a, const T &b) {
	if (a >= b) return false;
	a = b;
	return true;
}

template <typename T> T max(vector<T> &a){
	assert(!a.empty());
	T ret = a[0];
	for (int i=0; i<(int)a.size(); i++) chmax(ret, a[i]);
	return ret;
}

template <typename T> T min(vector<T> &a){
	assert(!a.empty());
	T ret = a[0];
	for (int i=0; i<(int)a.size(); i++) chmin(ret, a[i]);
	return ret;
}

template <typename T> T sum(vector<T> &a){
	T ret = 0;
	for (int i=0; i<(int)a.size(); i++) ret += a[i];
	return ret;
}

int main(){
	int n, m; cin >> n >> m;
	vector<int> x(m);
	rep(i,0,m) cin >> x[i];

	vector<vector<int>> c(n, vector<int>(m));
	vector<int> t(n);
	rep(i,0,n){
		rep(j,0,m) cin >> c[i][j];
		cin >> t[i];
	}

	map<vector<int>,vector<int>> mp;
	rep(i,0,n){
		vector<int> dr(m);
		rep(j,0,m){
			dr[j] = t[i] * c[i][j];
		}
		if (mp[dr].size() >= 2) continue;
		mp[dr].push_back(i);
	}

	rep(i,0,n){
		if (t[i] == 100){
			bool mode = 1;
			rep(j,0,m){
				if (x[j] != c[i][j]) mode = 0;
			}
			if (mode){
				cout << "Yes\n";
				return 0;
			}
		}else{
			vector<int> tar(m);
			bool mode = 1;
			rep(j,0,m){
				tar[j] = 10000*x[j] - 100*t[i]*c[i][j];
				if (tar[j] % (100-t[i]) != 0){
					mode = 0;
					break;
				}
				tar[j] /= 100-t[i];		
			}
			if (!mode){
				continue;
			}
			vector<int> lst = mp[tar];
			mode = 0;
			for (int x: lst){
				if (x == i) continue;
				mode = 1;
			}
			if (mode){
				cout << "Yes\n";
				return 0;
			}
		}
	}
	cout << "No\n";
}

0