Submission #1085658

# Submission time Handle Problem Language Result Execution time Memory
1085658 2024-09-08T14:25:30 Z 4QT0R Strange Device (APIO19_strange_device) C++17
Compilation error
0 ms 0 KB
#include <bits/stdc++.h>
using namespace std;
#define ll __int128_t

void fastscan(ll &n){
	n=0;
	for(char zn=getchar();47<zn && zn<58; zn=getchar()){
		n=10*n+zn-48;
	}
}

set<pair<ll,ll>> s;

int main(){
	ios_base::sync_with_stdio(0);
	cin.tie(0);

	ll n,A,B;
	fastscan(n);
	fastscan(A);
	fastscan(B);
	A/=gcd(A,B+1);
	ll mod=A*B;
	for (ll i = 1; i<=n; i++){
		ll l,p;
		fastscan(l);
		fastscan(p);
		if (l/mod!=p/mod){
			s.insert({l%mod,mod-1});
			s.insert({0,p%mod});
		}
		else s.insert({l%mod,p%mod});
	}
	ll mx=-1;
	ll ans=0;
	for (auto [l,p] : s){
		if (p<=mx)continue;
		ans+=p-max(mx+1,l)+1;
		mx=max(mx,p);
	}
	cout << (long long)ans << '\n';
}

Compilation message

In file included from /usr/include/x86_64-linux-gnu/c++/10/bits/stdc++.h:84,
                 from strange_device.cpp:1:
/usr/include/c++/10/numeric: In instantiation of 'constexpr std::common_type_t<_Mn, _Nn> std::gcd(_Mn, _Nn) [with _Mn = __int128; _Nn = __int128; std::common_type_t<_Mn, _Nn> = __int128]':
strange_device.cpp:22:14:   required from here
/usr/include/c++/10/numeric:133:21: error: static assertion failed: gcd arguments are integers
  133 |       static_assert(is_integral_v<_Mn>, "gcd arguments are integers");
      |                     ^~~~~~~~~~~~~~~~~~
/usr/include/c++/10/numeric:134:21: error: static assertion failed: gcd arguments are integers
  134 |       static_assert(is_integral_v<_Nn>, "gcd arguments are integers");
      |                     ^~~~~~~~~~~~~~~~~~
/usr/include/c++/10/numeric: In instantiation of 'constexpr std::common_type_t<_Mn, _Nn> std::__detail::__gcd(_Mn, _Nn) [with _Mn = __int128; _Nn = __int128; std::common_type_t<_Mn, _Nn> = __int128]':
/usr/include/c++/10/numeric:139:29:   required from 'constexpr std::common_type_t<_Mn, _Nn> std::gcd(_Mn, _Nn) [with _Mn = __int128; _Nn = __int128; std::common_type_t<_Mn, _Nn> = __int128]'
strange_device.cpp:22:14:   required from here
/usr/include/c++/10/numeric:104:49: error: use of deleted function 'void std::__detail::__abs_integral(bool)'
  104 |       return __m == 0 ? __detail::__abs_integral(__n)
      |                         ~~~~~~~~~~~~~~~~~~~~~~~~^~~~~
/usr/include/c++/10/numeric:98:8: note: declared here
   98 |   void __abs_integral(bool) = delete;
      |        ^~~~~~~~~~~~~~
/usr/include/c++/10/numeric:105:39: error: use of deleted function 'void std::__detail::__abs_integral(bool)'
  105 |  : __n == 0 ? __detail::__abs_integral(__m)
      |               ~~~~~~~~~~~~~~~~~~~~~~~~^~~~~
/usr/include/c++/10/numeric:98:8: note: declared here
   98 |   void __abs_integral(bool) = delete;
      |        ^~~~~~~~~~~~~~