Submission #931518

#TimeUsernameProblemLanguageResultExecution timeMemory
931518PringAdvertisement 2 (JOI23_ho_t2)C++14
100 / 100
122 ms18064 KiB
#include <bits/stdc++.h> using namespace std; #ifdef MIKU #define debug(x...) cout << "[" << #x << "] : ", dout(x) void dout() { cout << endl; } template <typename T, typename ...U> void dout(T t, U ...u) { cout << t << (sizeof...(u) ? ", " : ""); dout(u...); } #else #define debug(...) 39 #endif #define int long long #define fs first #define sc second #define mp make_pair #define FOR(i, j, k) for (int i = j, Z = k; i < Z; i++) typedef pair<int, int> pii; const int MXN = 500005; int n; pii p[MXN]; bitset<MXN> l, r; void PRE_L() { l[0] = true; int now = LLONG_MIN; FOR(i, 1, n + 1) { now = max(now, p[i - 1].fs + p[i - 1].sc); l[i] = (p[i].fs + p[i].sc > now); } } void PRE_R() { r[n - 1] = true; int now = LLONG_MAX; for (int i = n - 2; i >= 0; i--) { now = min(now, p[i + 1].fs - p[i + 1].sc); r[i] = (p[i].fs - p[i].sc < now); } } void miku() { cin >> n; FOR(i, 0, n) cin >> p[i].fs >> p[i].sc; sort(p, p + n); debug(); n = unique(p, p + n) - p; PRE_L(); PRE_R(); int ans = 0; FOR(i, 0, n) if (l[i] && r[i]) ans++; cout << ans << '\n'; } int32_t main() { cin.tie(0) -> sync_with_stdio(false); cin.exceptions(iostream::failbit); miku(); return 0; }

Compilation message (stderr)

Main.cpp: In function 'void miku()':
Main.cpp:10:20: warning: statement has no effect [-Wunused-value]
   10 | #define debug(...) 39
      |                    ^~
Main.cpp:47:5: note: in expansion of macro 'debug'
   47 |     debug();
      |     ^~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...