Skip to content

Commit

Permalink
Merge branch 'main' into 17-pu2rile
Browse files Browse the repository at this point in the history
  • Loading branch information
pu2rile authored Sep 24, 2024
2 parents 3754601 + 81e6a6d commit 4959397
Show file tree
Hide file tree
Showing 6 changed files with 63 additions and 1 deletion.
Binary file added honggukang0623/.DS_Store
Binary file not shown.
1 change: 1 addition & 0 deletions oesnuj/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,4 +17,5 @@
| 13์ฐจ์‹œ | 2024.07.28 | DP | [๋ถ€๋…€ํšŒ์žฅ์ด ๋ ํ…Œ์•ผ](https://www.acmicpc.net/problem/2775) | [#44](https://github.com/AlgoLeadMe/AlgoLeadMe-10/pull/44) |
| 14์ฐจ์‹œ | 2024.08.05 | ํ•ด์‹œ | [ ๋‚˜๋Š”์•ผ ํฌ์ผ“๋ชฌ ๋งˆ์Šคํ„ฐ ์ด๋‹ค์†œ ](https://www.acmicpc.net/problem/1620) | [#46](https://github.com/AlgoLeadMe/AlgoLeadMe-10/pull/46) |
| 15์ฐจ์‹œ | 2024.08.10 | ๊ทธ๋ฆฌ๋”” | [ ์ฃผ์‹ ](https://www.acmicpc.net/problem/11501) | [#47](https://github.com/AlgoLeadMe/AlgoLeadMe-10/pull/47) |
| 16์ฐจ์‹œ | 2024.09.13 | ๊ตฌํ˜„ | [ ๋‹ฌ๋ ฅ ](https://www.acmicpc.net/problem/20207) | [#50](https://github.com/AlgoLeadMe/AlgoLeadMe-10/pull/50) |
---
42 changes: 42 additions & 0 deletions oesnuj/๊ตฌํ˜„/20207.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
#include <iostream>
#include <vector>
using namespace std;

struct EventPeriod
{
int start, end;
};

int main()
{
int N;
cin >> N;
vector <EventPeriod> v(N);
int days[365] = {0};

for(int i = 0; i < N; i++)
{
cin >> v[i].start >> v[i].end; //์ผ์ • ์‹œ์ž‘์ผ, ์ข…๋ฃŒ์ผ ์ž…๋ ฅ๋ฐ›๊ธฐ

for (int k = v[i].start - 1; k < v[i].end; k++) {
days[k]++; //์ผ์ •์— ํฌํ•จ๋˜๋Š” ๋‚ ์˜ ๋ฐฐ์—ด ๊ฐ’ +1;
}
}

int result = 0;
int height = 0, width = 0;
for (int i = 0; i < 365; i++) {
if (days[i] != 0) {
width++;
height = max(height, days[i]);
}

if (days[i + 1] == 0) {
result += height * width;
width = 0;
height = 0;
}
}
cout << result;
return 0;
}
Binary file modified pu2rile/.DS_Store
Binary file not shown.
2 changes: 1 addition & 1 deletion pu2rile/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,4 +18,4 @@
| 14์ฐจ์‹œ | 2024.08.05 | ํŠธ๋ฆฌ | [์ด์ง„ ํƒ์ƒ‰ ํŠธ๋ฆฌ](https://www.acmicpc.net/problem/5639) | [#45](https://github.com/AlgoLeadMe/AlgoLeadMe-10/pull/45)
| 15์ฐจ์‹œ | 2024.08.15 | ํŠธ๋ฆฌ | [๋‚˜๋ฌด ํƒˆ์ถœ](https://www.acmicpc.net/problem/15900) | [#48](https://github.com/AlgoLeadMe/AlgoLeadMe-10/pull/48)
| 16์ฐจ์‹œ | 2024.09.15 | ๊ทธ๋ฆฌ๋”” ์•Œ๊ณ ๋ฆฌ์ฆ˜ | [์‹ ์ž… ์‚ฌ์›](https://www.acmicpc.net/problem/15900) | [#51](https://github.com/AlgoLeadMe/AlgoLeadMe-10/pull/51)
| 17์ฐจ์‹œ | 2024.09.24 | ๋ฌธ์ž์—ด | [์ฝฐํŠธ๋กœ์น˜์ฆˆํ”ผ์ž](https://www.acmicpc.net/problem/27964) | [#54](https://github.com/AlgoLeadMe/AlgoLeadMe-10/pull/54)
| 17์ฐจ์‹œ | 2024.09.24 | ๋ฌธ์ž์—ด | [์ฝฐํŠธ๋กœ์น˜์ฆˆํ”ผ์ž](https://www.acmicpc.net/problem/27964) | [#54](https://github.com/AlgoLeadMe/AlgoLeadMe-10/pull/54)
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
T = int(input())

for _ in range(T):
N = int(input())
score = [list(map(int, input().split())) for _ in range(N)]

# ์„œ๋ฅ˜ ์‹ฌ์‚ฌ ์„ฑ์  ๊ธฐ์ค€์œผ๋กœ ์˜ค๋ฆ„์ฐจ์ˆœ ์ •๋ ฌ
rank_1 = sorted(score)
top = 0 # ์„œ๋ฅ˜ ์„ฑ์ ์ด ๊ฐ€์žฅ ์ข‹์€ ์‚ฌ๋žŒ์„ ๊ธฐ์ค€์œผ๋กœ ์„ค์ • (์ฒซ ๋ฒˆ์งธ ์‚ฌ๋žŒ)
result = 1 # ์ฒซ ๋ฒˆ์งธ ์ง€์›์ž๋Š” ํ•ญ์ƒ ํ•ฉ๊ฒฉํ•˜๋ฏ€๋กœ ๊ฒฐ๊ณผ๋ฅผ 1๋กœ ์‹œ์ž‘

# 2๋ฒˆ์งธ ์ง€์›์ž๋ถ€ํ„ฐ ์„œ๋ฅ˜ ์„ฑ์  ์ˆœ์œผ๋กœ ๋ฉด์ ‘ ์„ฑ์  ๋น„๊ต
for i in range(1, len(rank_1)):
# ํ˜„์žฌ ์ง€์›์ž์˜ ๋ฉด์ ‘ ์„ฑ์ ์ด ๊ธฐ์ค€์ (top)์˜ ์ง€์›์ž๋ณด๋‹ค ์ข‹์œผ๋ฉด (์ˆซ์ž๊ฐ€ ๋‚ฎ์œผ๋ฉด)
if rank_1[i][1] < rank_1[top][1]:
top = i # ๊ธฐ์ค€์ (top)์„ ํ˜„์žฌ ์ง€์›์ž๋กœ ๊ฐฑ์‹ 
result += 1

print(result)

0 comments on commit 4959397

Please sign in to comment.