/ SeriousOJ /

Record Detail

Compile Error

In file included from /usr/include/c++/13/ext/pb_ds/detail/type_utils.hpp:47,
                 from /usr/include/c++/13/ext/pb_ds/tag_and_trait.hpp:46,
                 from /usr/include/c++/13/ext/pb_ds/assoc_container.hpp:46,
                 from foo.cc:6:
/usr/include/c++/13/tr1/type_traits:121:3: error: redefinition of 'struct std::tr1::__is_integral_helper<long long int>'
  121 |   _DEFINE_SPEC(0, __is_integral_helper, long long, true)
      |   ^
/usr/include/c++/13/tr1/type_traits:117:3: note: previous definition of 'struct std::tr1::__is_integral_helper<long long int>'
  117 |   _DEFINE_SPEC(0, __is_integral_helper, int, true)
      |   ^
/usr/include/c++/13/tr1/type_traits:122:3: error: redefinition of 'struct std::tr1::__is_integral_helper<long long unsigned int>'
  122 |   _DEFINE_SPEC(0, __is_integral_helper, unsigned long long, true)
      |   ^
/usr/include/c++/13/tr1/type_traits:118:3: note: previous definition of 'struct std::tr1::__is_integral_helper<long long unsigned int>'
  118 |   _DEFINE_SPEC(0, __is_integral_helper, unsigned int, true)
      |   ^
/usr/include/c++/13/tr1/type_traits:549:3: error: redefinition of 'struct std::tr1::__is_signed_helper<long long int>'
  549 |   _DEFINE_SPEC(0, __is_signed_helper, long long, true)
      |   ^
/usr/include/c++/13/tr1/type_traits:547:3: note: previous definition of 'struct std::tr1::__is_signed_helper<long long int>'
  547 |   _DEFINE_SPEC(0, __is_signed_helper, int, true)
      |   ^
/usr/include/c++/13/tr1/type_traits:564:3: error: redefinition of 'struct std::tr1::__is_unsigned_helper<long long unsigned int>'
  564 |   _DEFINE_SPEC(0, __is_unsigned_helper, unsigned long long, true)
      |   ^
/usr/include/c++/13/tr1/type_traits:562:3: note: previous definition of 'struct std::tr1::__is_unsigned_helper<long long unsigned int>'
  562 |   _DEFINE_SPEC(0, __is_unsigned_helper, unsigned int, true)
      |   ^
In file included from /usr/include/c++/13/tr1/functional:43,
                 from /usr/include/c++/13/ext/pb_ds/detail/standard_policies.hpp:51,
                 from /usr/include/c++/13/ext/pb_ds/assoc_container.hpp:47:
/usr/include/c++/13/tr1/functional_hash.h:80:3: error: redefinition of 'std::size_t std::tr1::hash<_Tp>::operator()(_Tp) const [with _Tp = long long int; std::size_t = long unsigned int]'
   80 |   _TR1_hashtable_define_trivial_hash(long long);
      |   ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/usr/include/c++/13/tr1/functional_hash.h:78:3: note: 'std::size_t std::tr1::hash<_Tp>::operator()(_Tp) const [with _Tp = long long int; std::size_t = long unsigned int]' previously declared here
   78 |   _TR1_hashtable_define_trivial_hash(int);
      |   ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/usr/include/c++/13/tr1/functional_hash.h:84:3: error: redefinition of 'std::size_t std::tr1::hash<_Tp>::operator()(_Tp) const [with _Tp = long long unsigned int; std::size_t = long unsigned int]'
   84 |   _TR1_hashtable_define_trivial_hash(unsigned long long);
      |   ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/usr/include/c++/13/tr1/functional_hash.h:82:3: note: 'std::size_t std::tr1::hash<_Tp>::operator()(_Tp) const [with _Tp = long long unsigned int; std::size_t = long unsigned int]' previously declared here
   82 |   _TR1_hashtable_define_trivial_hash(unsigned int);
      |   ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Code

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


#include<ext/pb_ds/assoc_container.hpp>
#include<ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;

template<typename T> using o_set = tree<T, null_type, std::less<T>, 
rb_tree_tag, tree_order_statistics_node_update>;

int area(int a, int b, int c, int d, int e, int f) {
    int val = a * d + c * f + e * b - b * c - d * e - a * f;
    return abs(val);
}

void solve() {
    int n;
    cin >> n;

    vector<int> x(n), y(n);
    for (int i = 0; i < n; i++) cin >> x[i] >> y[i];

    int xx, yy;
    cin >> xx >> yy;

    int a = 0;

    for (int i = 0; i + 1 < n; i++) {
        a += x[i] * y[i + 1];
    }
    a += x[n - 1] * y[0];

    for (int i = 0; i + 1 < n; i++) {
        a -= y[i] * x[i + 1];
    }

    a -= x[0] * y[n - 1];
    int b = 0;


    for (int i = 0; i + 1 < n; i++) {
        b += area(x[i], y[i], x[i + 1], y[i + 1], xx, yy);
    }

    b += area(x[0], y[0], x[n - 1], y[n - 1], xx, yy);

    if(a == b) cout << "YES\n";
    else cout << "NO\n";

}

signed main() {
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);

    int t = 1; 
    //cin>>t;
    for(int tc = 1; tc <= t; tc++) {
        // cout<<"Case "<<tc<<":";
        solve();
    }
}

Information

Submit By
Type
Submission
Problem
P1145 Nobita's Love for Shizuka
Contest
LU IUJPC : Sylhet Division 2024
Language
C++17 (G++ 13.2.0)
Submit At
2024-12-09 09:13:53
Judged At
2024-12-09 09:13:53
Judged By
Score
0
Total Time
0ms
Peak Memory
0 Bytes