結果

問題 No.2684 折々の色
ユーザー new_textfilenew_textfile
提出日時 2024-03-20 22:51:48
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 821 ms / 2,000 ms
コード長 7,119 bytes
コンパイル時間 4,287 ms
コンパイル使用メモリ 278,228 KB
実行使用メモリ 57,580 KB
最終ジャッジ日時 2024-09-30 08:59:21
合計ジャッジ時間 24,651 ms
ジャッジサーバーID
(参考情報)
judge1 / judge3
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
5,248 KB
testcase_01 AC 2 ms
5,248 KB
testcase_02 AC 2 ms
5,248 KB
testcase_03 AC 3 ms
5,248 KB
testcase_04 AC 2 ms
5,248 KB
testcase_05 AC 3 ms
5,248 KB
testcase_06 AC 2 ms
5,248 KB
testcase_07 AC 2 ms
5,248 KB
testcase_08 AC 3 ms
5,248 KB
testcase_09 AC 2 ms
5,248 KB
testcase_10 AC 3 ms
5,248 KB
testcase_11 AC 319 ms
32,912 KB
testcase_12 AC 157 ms
18,048 KB
testcase_13 AC 437 ms
46,848 KB
testcase_14 AC 185 ms
21,120 KB
testcase_15 AC 196 ms
28,156 KB
testcase_16 AC 37 ms
9,728 KB
testcase_17 AC 155 ms
20,096 KB
testcase_18 AC 358 ms
50,176 KB
testcase_19 AC 410 ms
40,576 KB
testcase_20 AC 269 ms
23,552 KB
testcase_21 AC 78 ms
17,152 KB
testcase_22 AC 410 ms
55,168 KB
testcase_23 AC 284 ms
28,416 KB
testcase_24 AC 122 ms
21,888 KB
testcase_25 AC 190 ms
25,728 KB
testcase_26 AC 377 ms
36,608 KB
testcase_27 AC 231 ms
27,520 KB
testcase_28 AC 279 ms
28,288 KB
testcase_29 AC 556 ms
36,480 KB
testcase_30 AC 510 ms
34,688 KB
testcase_31 AC 543 ms
40,364 KB
testcase_32 AC 620 ms
43,904 KB
testcase_33 AC 563 ms
36,864 KB
testcase_34 AC 588 ms
46,644 KB
testcase_35 AC 591 ms
47,988 KB
testcase_36 AC 523 ms
38,528 KB
testcase_37 AC 618 ms
49,920 KB
testcase_38 AC 751 ms
57,428 KB
testcase_39 AC 726 ms
57,580 KB
testcase_40 AC 774 ms
57,472 KB
testcase_41 AC 740 ms
57,460 KB
testcase_42 AC 733 ms
57,440 KB
testcase_43 AC 727 ms
57,464 KB
testcase_44 AC 821 ms
57,420 KB
testcase_45 AC 737 ms
57,344 KB
testcase_46 AC 745 ms
57,472 KB
testcase_47 AC 2 ms
5,248 KB
testcase_48 AC 1 ms
5,248 KB
testcase_49 AC 2 ms
5,248 KB
testcase_50 AC 1 ms
5,248 KB
testcase_51 AC 2 ms
5,248 KB
testcase_52 AC 1 ms
5,248 KB
testcase_53 AC 1 ms
5,248 KB
testcase_54 AC 2 ms
5,248 KB
testcase_55 AC 2 ms
5,248 KB
testcase_56 AC 2 ms
5,248 KB
testcase_57 AC 1 ms
5,248 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
using namespace std;
#include <atcoder/all>
// #include <atcoder/modint>
// #include <atcoder/math>
// #include <atcoder/segtree>
// #include <atcoder/lazysegtree>
// #include <atcoder/dsu>
// #include <atcoder/scc>
using namespace atcoder;

// #pragma GCC target("avx2")
// #pragma GCC optimize("O3")
// #pragma GCC optimize("unroll-loops")

typedef long long int ll;
typedef unsigned long long ull;
typedef long double ld;
typedef pair<ll,ll> pll;
typedef vector<ll> vll;
typedef vector<vll> vvll;
typedef vector<vvll> vvvll;
typedef vector<pll> vpll;
typedef vector<vpll> vvpll;
typedef vector<bool> vb;
typedef vector<vb> vvb;
typedef vector<double> vd;
typedef vector<vd> vvd;
typedef priority_queue<pll, vpll, function<bool(pll,pll)> > pqpll; 
typedef priority_queue<ll, vll, function<bool(pll,pll)> > pqll;
 
struct edge{ ll to, cost; edge(ll e_to,ll e_cost): to(e_to), cost(e_cost){} };
typedef vector<vector<edge>> Graph;
 
#define rep(i,a,n) for(ll i = a;i < n;i++)
#define rrep(i,a,n) for(ll i = n-1; i >= a;i--)
#define LINF (1LL << 60)
#define INF (1 << 30)
#define fs first
#define sc second
#define EPS (ld)1e-10
#define ALL(a) a.begin(), a.end()
#define tcheck(a) if((clock() - start)/(ld)CLOCKS_PER_SEC >= a) break
#define debug(s) cout << #s << endl
#define debugval(x) cout << #x" = " << x << endl
 
template<typename T> ll sz(vector<T> &pos){ return (ll)pos.size(); }
template<typename T> ll sz(priority_queue<T, vector<T> > &que) {return (ll)que.size(); }
template<typename T> ll sz(priority_queue<T, vector<T>, greater<T> > &que) {return (ll)que.size(); }
ll sz(string &s) {return (ll)s.size(); } 
 
template<typename T> void chmin(T &a, T b) { if(a > b) a = b; }
template<typename T> void chmax(T &a, T b) { if(a < b) a = b; }

// __int128_t gcd(__int128_t a, __int128_t b){ return ((!b) ? a : gcd(b,a%b)); } 
ll gcd(ll a,ll b){ return ((!b) ?a :gcd(b, a%b)); }
ll lcm(ll a,ll b){ return a / gcd(a,b) * b; }
ll dx[4] = {0,-1,0,1},dy[4] = {-1,0,1,0};
// ll dx[8] = {0,-1,-1,-1,0,1,1,1},dy[8] = {-1,-1,0,1,1,1,0,-1};
inline bool isinside(ll i,ll n){ return (i < n && i >= 0); }

class Fraction{
    private:
    ll num,den;
    ll frac_gcd(ll _a,ll _b){ return ((!_b) ?_a :frac_gcd(_b, _a%_b)); }
    
    public:
    Fraction():num(0),den(1){}
    Fraction(ll _num, ll _den): num(_num), den(_den){
        ll sign = 1;
        if(num < 0) sign *= -1, num *= -1;
        if(den < 0) sign *= -1, den *= -1;
        ll g = frac_gcd(num,den);
        num /= g; den /= g;
        num *= sign;
    }

    bool operator!() const{return !(num);}
    bool operator==(const Fraction &f) const{
        return (this->num == f.num && this->den == f.den);
    }
    bool operator!=(const Fraction &f) const{
        return !((*this) == f);
    }

    bool operator<(const Fraction &f) const{
        if((*this) == f) return false;
        else if(this->den == 0) return false;
        else if(f.den == 0) return true;
        else return (this->num*f.den < f.num*this->den);
    }

    bool operator>(const Fraction &f) const{
        if((*this) == f) return false;
        else if(this->den == 0) return true;
        else if(f.den == 0) return false;
        else return (this->num*f.den > f.num*this->den);
    }

    bool operator<=(const Fraction &f) const{ return ((*this) == f || (*this) < f);}
    bool operator>=(const Fraction &f) const{ return ((*this) == f || (*this) > f);}

    Fraction operator+() const{ return (*this); }
    Fraction operator-() const{ return Fraction(-this->num, this->den);}

    Fraction operator+(const Fraction &f) const{ 
        assert(f.den != 0 && this->den != 0);
        return Fraction(this->num*f.den+f.num*this->den, this->den*f.den);
    }
    Fraction operator-(const Fraction &f) const{
        assert(f.den != 0 && this->den != 0);
        return Fraction(this->num*f.den-f.num*this->den, this->den*f.den);
    }
    Fraction operator*(const Fraction &f) const{
        assert(f.den != 0 && this->den != 0);
        return Fraction(this->num*f.num, this->den*f.den);
    }
    Fraction operator/(const Fraction &f) const{
        assert(f.den != 0 && this->den != 0);
        return Fraction(this->num*f.den, this->den*f.num);
    }

    Fraction operator+(const ll &x) const{ 
        assert(this->den != 0);
        return (*this)+Fraction(x,1);
    }
    Fraction operator-(const ll &x) const{
        assert(this->den != 0);
        return (*this)-Fraction(x,1);
    }
    Fraction operator*(const ll &x) const{
        assert(this->den != 0);
        return (*this)*Fraction(x,1);
    }
    Fraction operator/(const ll &x) const{
        assert(this->den != 0 && x != 0);
        return (*this)*Fraction(1,x);
    }

    Fraction& operator+=(const Fraction &f) { return (*this) = (*this) + f; }    
    Fraction& operator-=(const Fraction &f) { return (*this) = (*this) - f; }
    Fraction& operator*=(const Fraction &f) { return (*this) = (*this) * f; }
    Fraction& operator/=(const Fraction &f) { return (*this) = (*this) / f; }

    Fraction& operator+=(const ll &x) { return (*this) = (*this) + x; }    
    Fraction& operator-=(const ll &x) { return (*this) = (*this) - x; }
    Fraction& operator*=(const ll &x) { return (*this) = (*this) * x; }
    Fraction& operator/=(const ll &x) { return (*this) = (*this) / x; }

    Fraction& operator++() { return (*this) += 1; }
    Fraction& operator--() { return (*this) -= 1; }

    Fraction& operator=(ll x) { return (*this) = Fraction(x,1);}

    friend ostream &operator<<(ostream &os, const Fraction &f){
        return os << f.num << " / " << f.den;
    }
 
    friend istream &operator>>(istream &is, Fraction &f){
        ll _n,_d;
        is >> _n >> _d;
        f = Fraction(_n,_d);
        return (is);
    }

    ll floor(){ 
        assert(this->den != 0);
        return this->num / this->den;
    }

    ll ceil(){
        assert(this->den != 0);
        return (this->num+this->den-1) / this->den;
    }

    ll getdenom(){
        return this->den;
    }
    
    ll getnumer(){
        return this->num;
    }
};

int main(){
    ll n,m;
    cin >> n >> m;

    vll x(10);
    rep(i,0,m) cin >> x[i];

    vvll c(n, vll(10));
    vll t(n);
    rep(i,0,n){
        rep(j,0,m) cin >> c[i][j];
        cin >> t[i];
    }

    map<array<int,10>, set<int>> mp;
    rep(i,0,n){
        if(t[i] == 100){
            if(c[i] == x){
                cout << "Yes" << endl;
                return 0;
            }
        }
        else{
            bool isok = true;
            array<int,10> arr;
            rep(j,0,10){
                isok &= (10000*x[j]-100*t[i]*c[i][j]) % (100-t[i]) == 0;
                if(!isok) break;
                arr[j] = (10000*x[j]-100*t[i]*c[i][j])/(100-t[i]);
            }
            if(isok){
                mp[arr].insert(i);
            }
        }
    }

    rep(i,0,n){
        array<int,10> arr;
        rep(j,0,10) arr[j] = t[i]*c[i][j];
        if(mp[arr].size() >= 2 || (mp[arr].size() == 1 && mp[arr].count(i) == 0)){
            cout << "Yes" << endl;
            return 0;
        }
    }

    cout << "No" << endl;
}
0