結果
問題 | No.1557 Binary Variable |
ユーザー | bayashiko |
提出日時 | 2021-06-25 22:38:53 |
言語 | C++17 (gcc 13.2.0 + boost 1.83.0) |
結果 |
AC
|
実行時間 | 62 ms / 2,000 ms |
コード長 | 1,600 bytes |
コンパイル時間 | 2,507 ms |
コンパイル使用メモリ | 203,684 KB |
実行使用メモリ | 5,212 KB |
最終ジャッジ日時 | 2023-09-07 14:45:54 |
合計ジャッジ時間 | 6,000 ms |
ジャッジサーバーID (参考情報) |
judge12 / judge15 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 40 ms
4,920 KB |
testcase_01 | AC | 45 ms
5,032 KB |
testcase_02 | AC | 1 ms
4,380 KB |
testcase_03 | AC | 1 ms
4,380 KB |
testcase_04 | AC | 49 ms
4,956 KB |
testcase_05 | AC | 49 ms
4,964 KB |
testcase_06 | AC | 48 ms
4,956 KB |
testcase_07 | AC | 48 ms
4,900 KB |
testcase_08 | AC | 52 ms
4,984 KB |
testcase_09 | AC | 52 ms
4,984 KB |
testcase_10 | AC | 55 ms
5,028 KB |
testcase_11 | AC | 54 ms
4,992 KB |
testcase_12 | AC | 52 ms
4,952 KB |
testcase_13 | AC | 55 ms
4,904 KB |
testcase_14 | AC | 56 ms
4,960 KB |
testcase_15 | AC | 55 ms
4,960 KB |
testcase_16 | AC | 56 ms
4,972 KB |
testcase_17 | AC | 55 ms
4,956 KB |
testcase_18 | AC | 57 ms
4,920 KB |
testcase_19 | AC | 58 ms
4,980 KB |
testcase_20 | AC | 57 ms
4,904 KB |
testcase_21 | AC | 57 ms
5,116 KB |
testcase_22 | AC | 58 ms
5,116 KB |
testcase_23 | AC | 58 ms
4,916 KB |
testcase_24 | AC | 59 ms
4,980 KB |
testcase_25 | AC | 59 ms
5,212 KB |
testcase_26 | AC | 60 ms
4,932 KB |
testcase_27 | AC | 60 ms
4,976 KB |
testcase_28 | AC | 60 ms
4,932 KB |
testcase_29 | AC | 62 ms
4,960 KB |
testcase_30 | AC | 62 ms
4,908 KB |
testcase_31 | AC | 62 ms
4,904 KB |
testcase_32 | AC | 62 ms
4,904 KB |
testcase_33 | AC | 57 ms
5,048 KB |
testcase_34 | AC | 2 ms
4,376 KB |
testcase_35 | AC | 1 ms
4,376 KB |
testcase_36 | AC | 1 ms
4,376 KB |
ソースコード
#include<bits/stdc++.h> #pragma GCC optimize("Ofast") //#pragma GCC target("avx2") #pragma GCC optimize("unroll-loops") using namespace std; //#include<boost/multiprecision/cpp_int.hpp> //#include<boost/multiprecision/cpp_dec_float.hpp> //namespace mp=boost::multiprecision; //#define mulint mp::cpp_int //#define mulfloat mp::cpp_dec_float_100 struct __INIT{__INIT(){cin.tie(0);ios::sync_with_stdio(false);cout<<fixed<<setprecision(15);}} __init; #define INF (1<<30) #define LINF (lint)(1LL<<56) #define endl "\n" #define rep(i,n) for(lint (i)=0;(i)<(n);(i)++) #define reprev(i,n) for(lint (i)=(n-1);(i)>=0;(i)--) #define flc(x) __builtin_popcountll(x) #define pint pair<int,int> #define pdouble pair<double,double> #define plint pair<lint,lint> #define fi first #define se second #define all(x) x.begin(),x.end() #define vec vector<lint> #define nep(x) next_permutation(all(x)) typedef long long lint; int dx[8]={1,1,0,-1,-1,-1,0,1}; int dy[8]={0,1,1,1,0,-1,-1,-1}; const int MAX_N=3e5+5; template<class T>bool chmax(T &a,const T &b){if(a<b){a=b;return 1;}return 0;} template<class T>bool chmin(T &a,const T &b){if(b<a){a=b;return 1;}return 0;} //vector<int> bucket[MAX_N/1000]; constexpr int MOD=1000000007; //constexpr int MOD=998244353; /*#include<atcoder/all> using namespace atcoder; typedef __int128_t llint;*/ int main(void){ int N,M; cin >> N >> M; int cnt=0,last=0; pint LR[M]; rep(i,M) cin >> LR[i].se >> LR[i].fi; sort(LR,LR+M); rep(i,M) swap(LR[i].fi,LR[i].se); rep(i,M){ if(LR[i].fi>last) cnt++,last=LR[i].se; } cout << N-cnt << endl; }