Submission #7969208
Source Code Expand
#include <bits/stdc++.h> using namespace std; int main() { int N, K; cin >> N >> K; map<long long, long long> mp; int acnt = 0; for( int i = 0; i < N; i++ ) { int A; cin >> A; int a = __gcd( A, K ); mp[a]++; } long long ans = 0; for( auto it1 = mp.begin(); it1 != mp.end(); it1++ ) { for( auto it2 = mp.begin(); it2 != mp.end(); it2++ ) { if( it1 > it2 || it1->first * it2->first % K ) continue; if( it1->first == it2->first ) ans += it1->second * ( it1->second - 1 ) / 2; else ans += it1->second * it2->second; } } cout << ans << endl; }
Submission Info
Submission Time | |
---|---|
Task | C - ロト2 |
User | forest3 |
Language | C++14 (GCC 5.4.1) |
Score | 0 |
Code Size | 610 Byte |
Status | CE |
Compile Error
./Main.cpp: In function ‘int main()’: ./Main.cpp:20:12: error: no match for ‘operator>’ (operand types are ‘std::_Rb_tree_iterator<std::pair<const long long int, long long int> >’ and ‘std::_Rb_tree_iterator<std::pair<const long long int, long long int> >’) if( it1 > it2 || it1->first * it2->first % K ) continue; ^ In file included from /usr/include/c++/5/bits/stl_algobase.h:64:0, from /usr/include/c++/5/bits/char_traits.h:39, from /usr/include/c++/5/ios:40, from /usr/include/c++/5/istream:38, from /usr/include/c++/5/sstream:38, from /usr/include/c++/5/complex:45, from /usr/include/c++/5/ccomplex:38, from /usr/include/x86_64-linux-gnu/c++/5/bits/stdc++.h:52, from ./Main.cpp:1: /usr/include/c++/5/bits/stl_pair.h:233:5: note: candidate: template<class _T1, class _T2> constexpr bool std::operator>(const std::pair<_T1, _T2>&, const std::pair<_T1, _T2>&) oper...