Submission #1195975

#TimeUsernameProblemLanguageResultExecution timeMemory
1195975quangminh412Advertisement 2 (JOI23_ho_t2)C11
Compilation error
0 ms0 KiB
#include <bits/stdc++.h>
using namespace std;

/*
  Ben Watson
  Handle codeforces : quangminh98

  Mua Code nhu mua Florentino !!
*/

#define ll long long

const string name = "test";

void solve();
signed main()
{
    if (fopen((name + ".inp").c_str(), "r"))
    {
        freopen((name + ".inp").c_str(), "r", stdin);
        freopen((name + ".out").c_str(), "w", stdout);
    }
    ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);

    solve();

    return 0;
}

// main program
bool cmp(pair<int, int> a, pair<int, int> b)
{
    if (a.first == b.first)
        return a.second > b.second;
    return a.first < b.first;
}

void solve()
{
    int n; cin >> n;
    vector<pair<int, int>> coor(n);
    for (pair<int, int>& it : coor)
    {
        int x, e; cin >> x >> e;
        it.first = x - e;
        it.second = x + e;
    }

    sort(coor.begin(), coor.end(), cmp);
    int mx = -1, res = 0;
    for (pair<int, int> it : coor)
        if (it.second > mx)
        {
            mx = it.second;
            res++;
        }

    cout << res << '\n';
}

Compilation message (stderr)

Main.c:1:10: fatal error: bits/stdc++.h: No such file or directory
    1 | #include <bits/stdc++.h>
      |          ^~~~~~~~~~~~~~~
compilation terminated.