結果
問題 |
No.1557 Binary Variable
|
ユーザー |
|
提出日時 | 2021-06-25 21:52:08 |
言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 1,636 bytes |
コンパイル時間 | 2,282 ms |
コンパイル使用メモリ | 202,692 KB |
最終ジャッジ日時 | 2025-01-22 12:11:19 |
ジャッジサーバーID (参考情報) |
judge4 / judge1 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 3 WA * 31 |
ソースコード
#include <bits/stdc++.h> using namespace std; using ll = long long int; using iPair = pair<int,int>; using lPair = pair<ll, ll>; using ivector = vector<int>; using lvector = vector<ll>; using istack = stack<int>; using iqueue = queue<int>; using ivv = vector<vector<int>>; using lvv = vector<vector<ll>>; const int INF = 0x3f3f3f3f; const ll LINF = 0x3f3f3f3f3f3f3f3f; vector<iPair> dir = {{1,0}, {-1,0}, {0,1}, {0,-1}}; #define dump(x) cout << #x << " = " << (x) << endl #define ALL(x) begin(x),end(x) #define rep(i,s,e) for(ll i=(s), i_stop=(e); i<i_stop; ++i) #define repRev(i,s,e) for(ll i=(e)-1, i_stop=(s); i>=i_stop; --i) #define range(i,s,n) for(ll i=(s), i_stop=(s)+(n); i<i_stop; ++i) #define rangeRev(i,s,n) for(ll i=(s), i_stop=(s)-(n); i>i_stop; --i) #define foreach(x,container) for(auto &&x:container) template<typename S, typename T> bool chmax(T& a, S b) {b = (T)b; if(a<b) {a=b;return true;} return false;} template<typename S, typename T> bool chmin(T& a, S b) {b = (T)b; if(a>b) {a=b;return true;} return false;} template<typename T> void printArr(vector<T> &arr){ for(auto &x:arr) {cout << x << " ";} cout << endl; } // =====================================================> void solve() { ll n,m; cin>>n>>m; vector<lPair> vec; range(i,1,m) {ll x,y; cin>>x>>y; vec.emplace_back(x, y);} sort(vec.begin(), vec.end()); ll t = 0; ll ans = 0; for(ll i = 0; i < m; ++i) { if(vec[i].first > t) { t = vec[i].second; ++ans; } } cout << n-ans << endl; } int main(){ ios::sync_with_stdio(false); cin.tie(0); solve(); return 0; }