QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#179827#5676. Counting Pythagorean TriplesCloudsCompile Error//C++14930b2023-09-15 10:32:152023-09-15 10:32:16

Judging History

你现在查看的是最新测评结果

  • [2023-09-15 10:32:16]
  • 评测
  • [2023-09-15 10:32:15]
  • 提交

answer

#include<bits/stdc++.h>
#define endl '\n'
#define int long long
using namespace std;
int n;
unordered_set<pair<int, int>>s;

int gcd(int a,int b)
{
    return b?gcd(b,a%b):a;
}

signed main()
{
    int n;
    cin>>n;
    int ans1=0,ans2=0;
    for(int i=1;i<=n;i++)
    {
        for(int j=1;j<=n;j++)
        {
            if(i*i+j*j==n*n)
            {
                if(gcd(i,j)==1&&gcd(i,n)==1&&gcd(j,n)==1)
                    ans1++;
                else
                    ans2++;
            }
        }
    }
    cout<<ans1<<" "<<ans2<<" ";
    ans1=ans2=0;
    for(int i=1;i<=1e7;i++)
    {
        int x=i*i-n*n;
        if(x>0&&sqrt(x)*sqrt(x)==x)
        {
            int j=sqrt(x);
            if(gcd(i,j)==1&&gcd(i,n)==1&&gcd(j,n)==1)
                ans1++;
            else
                ans2++;
        }
    }
    cout<<ans1<<" "<<ans2<<endl;
    return 0;
}

Details

answer.code:6:30: error: use of deleted function ‘std::unordered_set<_Value, _Hash, _Pred, _Alloc>::unordered_set() [with _Value = std::pair<long long int, long long int>; _Hash = std::hash<std::pair<long long int, long long int> >; _Pred = std::equal_to<std::pair<long long int, long long int> >; _Alloc = std::allocator<std::pair<long long int, long long int> >]’
    6 | unordered_set<pair<int, int>>s;
      |                              ^
In file included from /usr/include/c++/11/unordered_set:47,
                 from /usr/include/x86_64-linux-gnu/c++/11/bits/stdc++.h:118,
                 from answer.code:1:
/usr/include/c++/11/bits/unordered_set.h:135:7: note: ‘std::unordered_set<_Value, _Hash, _Pred, _Alloc>::unordered_set() [with _Value = std::pair<long long int, long long int>; _Hash = std::hash<std::pair<long long int, long long int> >; _Pred = std::equal_to<std::pair<long long int, long long int> >; _Alloc = std::allocator<std::pair<long long int, long long int> >]’ is implicitly deleted because the default definition would be ill-formed:
  135 |       unordered_set() = default;
      |       ^~~~~~~~~~~~~
/usr/include/c++/11/bits/unordered_set.h:135:7: error: use of deleted function ‘std::_Hashtable<_Key, _Value, _Alloc, _ExtractKey, _Equal, _Hash, _RangeHash, _Unused, _RehashPolicy, _Traits>::_Hashtable() [with _Key = std::pair<long long int, long long int>; _Value = std::pair<long long int, long long int>; _Alloc = std::allocator<std::pair<long long int, long long int> >; _ExtractKey = std::__detail::_Identity; _Equal = std::equal_to<std::pair<long long int, long long int> >; _Hash = std::hash<std::pair<long long int, long long int> >; _RangeHash = std::__detail::_Mod_range_hashing; _Unused = std::__detail::_Default_ranged_hash; _RehashPolicy = std::__detail::_Prime_rehash_policy; _Traits = std::__detail::_Hashtable_traits<true, true, true>]’
In file included from /usr/include/c++/11/unordered_map:46,
                 from /usr/include/x86_64-linux-gnu/c++/11/bits/stdc++.h:117,
                 from answer.code:1:
/usr/include/c++/11/bits/hashtable.h:528:7: note: ‘std::_Hashtable<_Key, _Value, _Alloc, _ExtractKey, _Equal, _Hash, _RangeHash, _Unused, _RehashPolicy, _Traits>::_Hashtable() [with _Key = std::pair<long long int, long long int>; _Value = std::pair<long long int, long long int>; _Alloc = std::allocator<std::pair<long long int, long long int> >; _ExtractKey = std::__detail::_Identity; _Equal = std::equal_to<std::pair<long long int, long long int> >; _Hash = std::hash<std::pair<long long int, long long int> >; _RangeHash = std::__detail::_Mod_range_hashing; _Unused = std::__detail::_Default_ranged_hash; _RehashPolicy = std::__detail::_Prime_rehash_policy; _Traits = std::__detail::_Hashtable_traits<true, true, true>]’ is implicitly deleted because the default definition would be ill-formed:
  528 |       _Hashtable() = default;
      |       ^~~~~~~~~~
/usr/include/c++/11/bits/hashtable.h:528:7: error: use of deleted function ‘std::__detail::_Hashtable_base<_Key, _Value, _ExtractKey, _Equal, _Hash, _RangeHash, _Unused, _Traits>::_Hashtable_base() [with _Key = std::pair<long long int, long long int>; _Value = std::pair<long long int, long long int>; _ExtractKey = std::__detail::_Identity; _Equal = std::equal_to<std::pair<long long int, long long int> >; _Hash = std::hash<std::pair<long long int, long long int> >; _RangeHash = std::__detail::_Mod_range_hashing; _Unused = std::__detail::_Default_ranged_hash; _Traits = std::__detail::_Hashtable_traits<true, true, true>]’
In file included from /usr/include/c++/11/bits/hashtable.h:35,
                 from /usr/include/c++/11/unordered_map:46,
                 from /usr/include/x86_64-linux-gnu/c++/11/bits/stdc++.h:117,
                 from answer.code:1:
/usr/include/c++/11/bits/hashtable_policy.h:1604:7: note: ‘std::__detail::_Hashtable_base<_Key, _Value, _ExtractKey, _Equal, _Hash, _RangeHash, _Unused, _Traits>::_Hashtable_base() [with _Key = std::pair<long long int, long long int>; _Value = std::pair<long long int, long long int>; _ExtractKey = std::__detail::_Identity; _Equal = std::equal_to<std::pair<long long int, long long int> >; _Hash = std::hash<std::pair<long long int, long long int> >; _RangeHash = std::__detail::_Mod_range_hashing; _Unused = std::__detail::_Default_ranged_hash; _Traits = std::__detail::_Hashtable_traits<true, true, true>]’ is implicitly deleted because the default definition would be ill-formed:
 1604 |       _Hashtable_base() = default;
      |       ^~~~~~~~~~~~~~~
/usr/include/c++/11/bits/hashtable_policy.h:1604:7: error: use of deleted function ‘std::__detail::_Hash_code_base<_Key, _Value, _ExtractKey, _Hash, _RangeHash, _Unused, __cache_hash_code>::_Hash_code_base() [with _Key = std::pair<long long int, long long int>; _Value = std::pair<long long int, long long int>; _ExtractKey = std::__detail::_Identity; _Hash = std::hash<std::pair<long long int, long long int> >; _RangeHash = std::__detail::_Mod_range_h...