Skip to content

Commit

Permalink
Add 16961.cpp
Browse files Browse the repository at this point in the history
  • Loading branch information
Hiyabye committed Jul 10, 2024
1 parent 7015999 commit 9c13824
Showing 1 changed file with 36 additions and 0 deletions.
36 changes: 36 additions & 0 deletions 16xxx/16961.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
#include <algorithm>
#include <iostream>
#include <vector>
using namespace std;

void solve(void) {
int n; cin >> n;

int y = 0;
vector<int> a(366, 0), b(366, 0);
while (n--) {
char c; int s, e; cin >> c >> s >> e; s--; e--;
if (c == 'T') for (int i=s; i<=e; i++) a[i]++;
else for (int i=s; i<=e; i++) b[i]++;
y = max(y, e - s + 1);
}

int p = 0, q = 0, r = 0, x = 0;
for (int i=0; i<366; i++) {
if (a[i] + b[i]) p++;
q = max(q, a[i] + b[i]);
if (a[i] && b[i] && a[i] == b[i]) {
r++;
x = max(x, a[i] + b[i]);
}
}
cout << p << "\n" << q << "\n" << r << "\n" << x << "\n" << y;
}

int main(void) {
ios::sync_with_stdio(false);
cin.tie(nullptr);

solve();
return 0;
}

0 comments on commit 9c13824

Please sign in to comment.