이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include <bits/stdc++.h>
#define ii pair <int, int>
#define F first
#define S second
using namespace std;
const int mod = 1e9 + 7;
const int N = 5e5 + 5;
int n;
ii sr[N];
void solve(){
    cin >> n;
    for (int i = 1, x, e; i <= n; ++ i){
        cin >> x >> e;
        sr[i].F = e - x;
        sr[i].S = e + x;
    }
    sort(sr + 1, sr + n + 1);
    int Max = -2e9;
    int ans = 0;
    for (int i = n; i >= 1; -- i){
        if (Max > sr[i].S){
            ++ ans;
            Max = sr[i].S;
        }
    }
    cout << ans;
}
int main(){
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
    int t; cin >> t;
    while (t --) solve();
    return 0;
}
| # | 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... |