Submission #864544

#TimeUsernameProblemLanguageResultExecution timeMemory
864544quandlmAdvertisement 2 (JOI23_ho_t2)C++14
100 / 100
132 ms18772 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() #define int long long using namespace std; const int N = 1e6 + 10; const ll inf = 1e18 + 7; int n; pi a[N]; 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] = {y-x,y+x}; } 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:23:2: warning: ISO C++ forbids declaration of 'main' with no type [-Wreturn-type]
   23 |  main () {
      |  ^~~~
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...