結果

問題 No.1995 CHIKA Road
ユーザー mnmmnm
提出日時 2022-07-01 23:18:05
言語 C++14
(gcc 13.2.0 + boost 1.83.0)
結果
WA  
実行時間 -
コード長 1,129 bytes
コンパイル時間 810 ms
コンパイル使用メモリ 83,904 KB
実行使用メモリ 30,932 KB
最終ジャッジ日時 2023-08-17 11:01:24
合計ジャッジ時間 6,096 ms
ジャッジサーバーID
(参考情報)
judge12 / judge14
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1 ms
8,880 KB
testcase_01 AC 1 ms
4,376 KB
testcase_02 AC 1 ms
4,376 KB
testcase_03 WA -
testcase_04 WA -
testcase_05 WA -
testcase_06 WA -
testcase_07 WA -
testcase_08 WA -
testcase_09 WA -
testcase_10 AC 755 ms
7,852 KB
testcase_11 TLE -
testcase_12 -- -
testcase_13 -- -
testcase_14 -- -
testcase_15 -- -
testcase_16 -- -
testcase_17 -- -
testcase_18 -- -
testcase_19 -- -
testcase_20 -- -
testcase_21 -- -
testcase_22 -- -
testcase_23 -- -
testcase_24 -- -
testcase_25 -- -
testcase_26 -- -
testcase_27 -- -
testcase_28 -- -
testcase_29 -- -
testcase_30 -- -
testcase_31 -- -
testcase_32 -- -
testcase_33 -- -
testcase_34 -- -
testcase_35 -- -
testcase_36 -- -
testcase_37 -- -
testcase_38 -- -
testcase_39 -- -
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
#include <cmath>
#include <tuple>
#include <bitset>

#define rep(i,n) for(i=0; i<n; ++i)
#define inc_rep(i,a,n) for(i=a; i<n; ++i)
#define dec_rep(i,n,a) for(i=n; i>=a; --i)
#define in(a) cin >> a
#define out(a,b) cout << a << b
#define print_vec(v) for(auto it=v.begin();it!=v.end();++it)cout<<*it <<" ";cout<<endl
#define print_vec2d(v) for(int i=0;i<v.size();++i){for(int j=0;j<v[i].size();++j)cout<<v[i][j]<<" ";cout<<endl;}cout<<endl
using namespace std;
using lint = long long;

lint ind(lint indx, vector<pair<lint,lint> > v){
    lint left=v[indx].first, right=v[indx].second, i;
    inc_rep(i,indx+1,v.size()){
        if(left<=v[i].first&&v[i].second<=right) return ind(i,v);
    }
    return indx;
}

int main(void){
    lint i, j, k, cnt=0, x, y;
    lint p, q, n, m;
    in(n); in(m);
    vector<pair<lint,lint> > v;
    rep(i,m){
        in(p); in(q);
        v.push_back(make_pair(p,q));
    }
    sort(v.begin(),v.end());
    cnt=(n-1)*2; x=0;
    rep(i,m){
        i=ind(i,v);
        x++;
    }
    out(cnt-x,endl);


    return 0;
}
0