Submission #1136748

#TimeUsernameProblemLanguageResultExecution timeMemory
1136748nuutsnoyntonAdvertisement 2 (JOI23_ho_t2)C++20
Compilation error
0 ms0 KiB
#include<bits/stdc++.h>

using namespace std;
using ll = unsigned long long;

int main() {
	ll r, x, y, i, can, lo, hi, mid, n, j, ans, t, e;
	
	cin >> n;
	
	vector < pair < ll, ll > > vp;
	
	for (i = 1; i<= n; i ++) {
		cin >> x >> y;
		vp.push_back({y, x});
	}
	sort(vp.rbegin(), vp.rend());
	ll E[n + 2], X[n +2 ];
	for (i = 1; i <= n; i ++) {
		E[i] = vp[i - 1].first;
		X[i] = vp[i - 1].second;
	}
	vector < pair < ll, ll > > v;
	for (i = 1; i <=n; i ++) {
		can=  0;
		for ( pair < ll, ll > P : v) {
			e= P.first;
			x = P.second;
			if ( abs(x-X[i]) <= e - E[i]) {
				can= 1;
			}
		}
		if ( can == 0) {
			v.push_back({E[i], X[i]});
		}
	}
	cout << v.size() << endl;
}

Compilation message (stderr)

Main.cpp: In function 'int main()':
Main.cpp:29:33: error: call of overloaded 'abs(ll)' is ambiguous
   29 |                         if ( abs(x-X[i]) <= e - E[i]) {
      |                              ~~~^~~~~~~~
In file included from /usr/include/c++/11/bits/std_abs.h:38,
                 from /usr/include/c++/11/cmath:47,
                 from /usr/include/x86_64-linux-gnu/c++/11/bits/stdc++.h:41,
                 from Main.cpp:1:
/usr/include/stdlib.h:848:12: note: candidate: 'int abs(int)'
  848 | extern int abs (int __x) __THROW __attribute__ ((__const__)) __wur;
      |            ^~~
In file included from /usr/include/c++/11/cmath:47,
                 from /usr/include/x86_64-linux-gnu/c++/11/bits/stdc++.h:41,
                 from Main.cpp:1:
/usr/include/c++/11/bits/std_abs.h:103:3: note: candidate: 'constexpr __float128 std::abs(__float128)'
  103 |   abs(__float128 __x)
      |   ^~~
/usr/include/c++/11/bits/std_abs.h:85:3: note: candidate: 'constexpr __int128 std::abs(__int128)'
   85 |   abs(__GLIBCXX_TYPE_INT_N_0 __x) { return __x >= 0 ? __x : -__x; }
      |   ^~~
/usr/include/c++/11/bits/std_abs.h:79:3: note: candidate: 'constexpr long double std::abs(long double)'
   79 |   abs(long double __x)
      |   ^~~
/usr/include/c++/11/bits/std_abs.h:75:3: note: candidate: 'constexpr float std::abs(float)'
   75 |   abs(float __x)
      |   ^~~
/usr/include/c++/11/bits/std_abs.h:71:3: note: candidate: 'constexpr double std::abs(double)'
   71 |   abs(double __x)
      |   ^~~
/usr/include/c++/11/bits/std_abs.h:61:3: note: candidate: 'long long int std::abs(long long int)'
   61 |   abs(long long __x) { return __builtin_llabs (__x); }
      |   ^~~
/usr/include/c++/11/bits/std_abs.h:56:3: note: candidate: 'long int std::abs(long int)'
   56 |   abs(long __i) { return __builtin_labs(__i); }
      |   ^~~