Created
September 30, 2018 13:14
-
-
Save Tdrj2716/b3cfb9a101142b8cc2713d81de9c38a6 to your computer and use it in GitHub Desktop.
imos法のサンプルコード。ABC014-C(https://beta.atcoder.jp/contests/abc014/tasks/abc014_3) の解答。
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <cstdio> | |
#include <algorithm> | |
using namespace std; | |
#define REP(i, N) for(int (i) = 0; (i) < (N); (i)++) | |
#define N 1000001 | |
#define MAX 1 << 20 | |
int main(){ | |
int n, ai, bi, s[N+1]; | |
scanf("%d", &n); | |
fill_n(s, N, 0); | |
REP(i, n){ | |
scanf("%d %d", &ai, &bi); | |
s[ai]++; s[bi+1]--; | |
} | |
REP(i, N-1) | |
s[i+1] += s[i]; | |
int ans = 0; | |
REP(i, N) | |
if(ans < s[i]) ans = s[i]; | |
printf("%d\n", ans); | |
return 0; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment