Submission #5886798


Source Code Expand

#include <map>
#include <set>
#include <list>
#include <cmath>
#include <queue>
#include <stack>
#include <cstdio>
#include <string>
#include <vector>
#include <complex>
#include <cstdlib>
#include <cstring>
#include <numeric>
#include <sstream>
#include <iostream>
#include <algorithm>
#include <functional>
 
#define _USE_MATH_DEFINES
#define mp       make_pair
#define pb       push_back
#define fst      first
#define snd      second
#define all(x)   (x).begin(),(x).end()
#define rep(i,n) for(int i=0;i<(n);i++)

using namespace std;

typedef    long long          ll;
typedef    unsigned long long ull;
typedef    vector<bool>       vb;
typedef    vector<int>        vi;
typedef    vector<vb>         vvb;
typedef    vector<vi>         vvi;
typedef    pair<int,int>      pii;

const int INF=1<<29;
const double EPS=1e-9;

const int dx[]={1,0,-1,0},dy[]={0,-1,0,1};


int main()
{
    int N; cin >> N;
    vi x(N), r(N);
    rep(i,N) cin >> x[i] >> r[i];

    vi dp(N,1);
    rep(i,N) rep(j,i) {
        if(x[i]+r[i] > x[j]+r[j] && x[i]-r[i] < x[j]-r[j])
            dp[i] = max(dp[j]+1,dp[i]);
    }

    int ans = 0;
    rep(i,N)
        ans = max(dp[i], ans);

    cout << ans << endl;
    return 0;
}

Submission Info

Submission Time
Task K - ターゲット
User loupbita
Language C++14 (GCC 5.4.1)
Score 0
Code Size 1271 Byte
Status TLE
Exec Time 2103 ms
Memory 1408 KB

Judge Result

Set Name All
Score / Max Score 0 / 5
Status
AC × 2
TLE × 8
Set Name Test Cases
All 00, 01, 02, 03, 04, 05, 06, 07, 90, 91
Case Name Status Exec Time Memory
00 TLE 2103 ms 1408 KB
01 TLE 2103 ms 1408 KB
02 TLE 2103 ms 1408 KB
03 TLE 2103 ms 1408 KB
04 TLE 2103 ms 1408 KB
05 TLE 2103 ms 1408 KB
06 TLE 2103 ms 1408 KB
07 TLE 2103 ms 1408 KB
90 AC 1 ms 256 KB
91 AC 1 ms 256 KB