Submission #864541

#TimeUsernameProblemLanguageResultExecution timeMemory
864541quandlmAdvertisement 2 (JOI23_ho_t2)C++14
0 / 100
1 ms2396 KiB
#include <bits/stdc++.h>
#define file(name)  if (fopen (name".inp", "r")) { freopen (name".inp", "r", stdin); freopen (name".out", "w", stdout); }
#define ll long long
#define FOR(i, a, b) for (int i = (a); i <= (b); ++i)
#define REP(i, a, b) for (int i = (a); i >= (b); --i)
#define pi pair<int,int>
#define ple tuple<int,int,int>
#define fi first
#define se second
#define ii make_pair
#define isz(a) ((int)a.size())
#define ALL(a) a.begin(), a.end()

using namespace std;

const int N = 1e6 + 10;
const ll inf = 1e18 + 7;

int n;
pi a[N];
int lazy[N*4],node[N*4];

int main () {
    file("JOI23_HO_T2");
    ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);

    cin >> n;
    FOR(i,1,n) {
        int x,y; cin >> x >> y;
        a[i] = {x - y, x + y};
    }
    sort(a+1, a+n+1);
    int mx = 0, res = 0;
    for (int i=n;i>=1;--i) {
         if (mx < a[i].se) {
             ++res;
             mx = max(mx, a[i].se);
         }
    }
    cout << res << '\n';
}

Compilation message (stderr)

Main.cpp: In function 'int main()':
Main.cpp:2:60: warning: ignoring return value of 'FILE* freopen(const char*, const char*, FILE*)' declared with attribute 'warn_unused_result' [-Wunused-result]
    2 | #define file(name)  if (fopen (name".inp", "r")) { freopen (name".inp", "r", stdin); freopen (name".out", "w", stdout); }
      |                                                    ~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~
Main.cpp:24:5: note: in expansion of macro 'file'
   24 |     file("JOI23_HO_T2");
      |     ^~~~
Main.cpp:2:94: warning: ignoring return value of 'FILE* freopen(const char*, const char*, FILE*)' declared with attribute 'warn_unused_result' [-Wunused-result]
    2 | #define file(name)  if (fopen (name".inp", "r")) { freopen (name".inp", "r", stdin); freopen (name".out", "w", stdout); }
      |                                                                                      ~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~
Main.cpp:24:5: note: in expansion of macro 'file'
   24 |     file("JOI23_HO_T2");
      |     ^~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...