Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit b8d5235

Browse files
committed
Today ps
1 parent 4225b57 commit b8d5235

File tree

2 files changed

+53
-0
lines changed

2 files changed

+53
-0
lines changed

‎Baekjoon/Cpp/11000.cpp‎

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
#include <bits/stdc++.h>
2+
3+
using namespace std;
4+
using pii = pair<int, int>;
5+
6+
inline bool compare(pii &a, pii &b)
7+
{
8+
return a.first < b.first;
9+
}
10+
11+
int main()
12+
{
13+
ios::sync_with_stdio(false);
14+
cin.tie(nullptr);
15+
cout.tie(nullptr);
16+
priority_queue<int, vector<int>, greater<int>> pq;
17+
int n, i, a, b;
18+
cin >> n;
19+
pii times[n];
20+
for (i = 0; i < n; i++)
21+
{
22+
cin >> a >> b;
23+
times[i] = make_pair(a, b);
24+
}
25+
sort(times, times + n, compare);
26+
pq.push(times[0].second);
27+
for (i = 1; i < n; i++)
28+
{
29+
pq.push(times[i].second);
30+
if (pq.top() <= times[i].first)
31+
{
32+
pq.pop();
33+
}
34+
}
35+
cout << pq.size();
36+
return 0;
37+
}

‎Baekjoon/Cpp/14916.cpp‎

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
#include <iostream>
2+
3+
using namespace std;
4+
5+
int main()
6+
{
7+
int n, res = 0;
8+
cin >> n;
9+
while (n % 5 != 0 && n >= 2)
10+
{
11+
n -= 2;
12+
res += 1;
13+
}
14+
cout << (n == 1 ? -1 : res + n / 5);
15+
return 0;
16+
}

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /