# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
1085456 | I_am_Polish_Girl | Advertisement 2 (JOI23_ho_t2) | C++14 | 2083 ms | 4812 KiB |
This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#pragma target("arch=icelake-server")
#include <iostream>
#include <vector>
#include <algorithm>
#include <map>
#include <set>
#include <unordered_map>
#include <unordered_set>
#include <stack>
#include <queue>
#include <cmath>
#include <random>
#include <chrono>
#include <iomanip>
#include <bitset>
using namespace std;
#define int long long
typedef long long ll;
typedef long double ld;
int log_ = 21;
int inf = 4000000007000000007;
long long mod = 998244353;
int p = 499;
int NADIYA = 39;
signed main()
{
ios_base::sync_with_stdio(false);
cin.tie(nullptr);
cout.tie(nullptr);
int n;
cin >> n;
vector <pair <int, int>> vp(n);
for (int i = 0; i < n; i++)
cin >> vp[i].first >> vp[i].second;
vector <bool> t(n, false);
int ans = 0;
int c = 0;
while (c < n)
{
ans++;
int mx = -1;
int p = -1;
for (int i = 0; i < n; i++)
{
if (t[i] == false)
{
if (mx < vp[i].second)
{
mx = vp[i].second;
p = vp[i].first;
}
}
}
for (int i = 0; i < n; i++)
{
if (t[i] == false)
{
if (abs(vp[i].first - p) <= (mx - vp[i].second))
{
t[i] = true;
c++;
}
}
}
}
cout << ans;
}
/*5
1 2 1
2 3 1
2 4 1
1 5 4
*/
Compilation message (stderr)
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |