Skip to content

Instantly share code, notes, and snippets.

@1995hnagamin
Created November 8, 2015 19:57
Show Gist options
  • Save 1995hnagamin/dfa5e459184aa6ba920b to your computer and use it in GitHub Desktop.
Save 1995hnagamin/dfa5e459184aa6ba920b to your computer and use it in GitHub Desktop.
#include<bits/stdc++.h>
using namespace std;
typedef long long int lli;
const int INF = INT_MAX/3;
struct segment_tree {
int n;
vector<int> dat;
int empty;
segment_tree(int n_, int empty_) :
n(8), dat(100, 100), empty(empty_) {}
};
int floors[(int)3e5 + 8];
int main() {
cout << fixed << setprecision(10);
lli N, M;
cin >> N >> M;
vector<lli> S(N),T(N);
for (int i = 0; i < M; ++i) {
cin >> S[i] >> T[i];
S[i]--;
floors[S[i]]++; floors[T[i]]--;
}
for (int i = 1; i < (int)3e5 + 1; ++i) floors[i] += floors[i - 1];
segment_tree seg(N, INF);
return 0;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment