#define _USE_MATH_DEFINES #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include using namespace std; class Fraction { private: long long n; // 分子(numerator) long long d; // 分母(denominator) // 約分 void reduce(){ if(d < 0){ n *= -1; d *= -1; } long long a = abs(n); long long b = d; while(b != 0){ long long tmp = a % b; a = b; b = tmp; } n /= a; d /= a; } public: Fraction(){ n = 0; d = 1; } Fraction(long long n0){ n = n0; d = 1; } Fraction(long long n0, long long d0){ n = n0; d = d0; reduce(); } pair getValue() const{ return make_pair(n, d); } const Fraction operator+(const Fraction& f) const{ return Fraction(n*f.d + d*f.n, d*f.d); } const Fraction operator-(const Fraction& f) const{ return Fraction(n*f.d - d*f.n, d*f.d); } const Fraction operator*(const Fraction& f) const{ return Fraction(n*f.n, d*f.d); } const Fraction operator/(const Fraction& f) const{ return Fraction(n*f.d, d*f.n); } bool operator==(const Fraction& f) const{ return n == f.n && d == f.d; } bool operator!=(const Fraction& f) const{ return n != f.n || d != f.d; } bool operator<(const Fraction& f) const{ return n * f.d < f.n * d; } }; bool solve(const vector& v) { int n = v.size(); for(int i=0; i v2 = v; v2[i] = a; v2.erase(v2.begin() + j); if(solve(v2)) return true; } } } return false; } int main() { int n; cin >> n; vector v(n); for(int i=0; i> a; v[i] = a; } if(solve(v)) cout << "YES" << endl; else cout << "NO" << endl; return 0; }