Skip to content

Commit 295596a

Browse files
committed
Quartz sync: Aug 6, 2025, 8:24 PM
1 parent f37e0ab commit 295596a

File tree

5 files changed

+190
-6
lines changed

5 files changed

+190
-6
lines changed

content/Computer Science/1 Foundations & Theory/Algorithms/ps/boj/18111/18111.md

Lines changed: 28 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,30 @@
11
---
2-
tags: ["ps/boj/silver/2", "ps/boj/silver", "cs/algorithms/bruteforcing/ps","cs/algorithms/implementation/ps"]
2+
tags:
3+
[
4+
"ps/boj/silver/2",
5+
"ps/boj/silver",
6+
"cs/algorithms/bruteforcing/ps",
7+
"cs/algorithms/implementation/ps",
8+
]
39
---
410

511
# Problem
12+
613
- [https://www.acmicpc.net/problem/18111](https://www.acmicpc.net/problem/18111)
714

815
# Logic
16+
917
- bruteforce
10-
- $m * n * 256 < 1억 $ = bruteforce
18+
- $m _ n _ 256 < 1억 $ = bruteforce
1119
- 모든 높이에 대해서 최소 도출
1220
- optimize
1321
- 평균을 기준으로 이동
1422
- 구현이 많아서 비추천
1523

1624
# My Code
1725

26+
## cpp
27+
1828
```cpp title="boj/18111.cpp"
1929

2030
#include <vector>
@@ -61,4 +71,20 @@ void solution()
6171
}
6272

6373

74+
```
75+
76+
## python
77+
78+
```python title="boj/18111.py"
79+
80+
81+
sys.setrecursionlimit(10**9)
82+
input = sys.stdin.readline
83+
output = sys.stdout.write
84+
85+
86+
def solve():
87+
return
88+
89+
6490
```
Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
---
2+
tags:
3+
[
4+
"ps/boj/bronze/1",
5+
"ps/boj/bronze",
6+
"cs/algorithms/implementation/ps",
7+
"cs/algorithms/sorting/ps",
8+
"cs/algorithms/simulation/ps",
9+
]
10+
---
11+
12+
# Problem
13+
14+
- [https://www.acmicpc.net/problem/23968](https://www.acmicpc.net/problem/23968)
15+
16+
# Logic
17+
18+
# My Code
19+
20+
## cpp
21+
22+
```cpp title="boj/23968.cpp"
23+
24+
#include <vector>
25+
void solution()
26+
{
27+
}
28+
29+
30+
```
31+
32+
## python
33+
34+
```python title="boj/23968.py"
35+
36+
def solve():
37+
return
38+
39+
```
Lines changed: 74 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,74 @@
1+
---
2+
tags: ["ps/boj/silver/2", "ps/boj/silver", "cs/algorithms/implementation/ps","cs/algorithms/bruteforcing/ps","cs/algorithms/two-pointer/ps"]
3+
---
4+
5+
# Problem
6+
- [https://www.acmicpc.net/problem/30804](https://www.acmicpc.net/problem/30804)
7+
8+
# Logic
9+
10+
# My Code
11+
12+
## cpp
13+
14+
```cpp title="boj/30804.cpp"
15+
16+
#include <unordered_map>
17+
#include <vector>
18+
void solution()
19+
{
20+
int n, max_dist = C_MIN, l_pos = 0, l_num, r_num;
21+
unordered_map<int, int> two;
22+
23+
cin >> n;
24+
for (int r_pos = 0; r_pos < n; ++r_pos) {
25+
int temp;
26+
cin >> temp;
27+
28+
if (two.count(temp)) {
29+
two[temp] = r_pos;
30+
} else {
31+
if (two.size() < 2) {
32+
if (!l_num)
33+
l_num = temp;
34+
else
35+
r_num = temp;
36+
37+
} else {
38+
if (two[r_num] > two[l_num]) {
39+
l_pos = two[l_num] + 1;
40+
two.erase(l_num);
41+
l_num = r_num;
42+
r_num = temp;
43+
} else {
44+
l_pos = two[r_num] + 1;
45+
two.erase(r_num);
46+
r_num = temp;
47+
}
48+
}
49+
50+
two[temp] = r_pos;
51+
}
52+
max_dist = max(max_dist, (r_pos - l_pos) + 1);
53+
}
54+
cout << max_dist;
55+
}
56+
57+
58+
```
59+
60+
## python
61+
62+
```python title="boj/30804.py"
63+
64+
65+
sys.setrecursionlimit(10**9)
66+
input = sys.stdin.readline
67+
output = sys.stdout.write
68+
69+
70+
def solve():
71+
return
72+
73+
74+
```
Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
---
2+
tags: ["ps/boj/bronze/4", "ps/boj/bronze", "cs/algorithms/mathematics/ps","cs/algorithms/string/ps","cs/algorithms/arithmetic/ps"]
3+
---
4+
5+
# Problem
6+
- [https://www.acmicpc.net/problem/31403](https://www.acmicpc.net/problem/31403)
7+
8+
# Logic
9+
10+
# My Code
11+
12+
## cpp
13+
14+
```cpp title="boj/31403.cpp"
15+
16+
#include <vector>
17+
void solution()
18+
{
19+
int a, b, c;
20+
cin >> a >> b >> c;
21+
22+
cout << a + b - c << endl;
23+
cout << ((stoi(to_string(a).append(to_string(b))))-c) << endl;
24+
log(stoi(to_string(a).append(to_string(b))) - c);
25+
log("b", stoi(to_string(a).append(to_string(b))) - c);
26+
}
27+
28+
29+
```
30+
31+
## python
32+
33+
```python title="boj/31403.py"
34+
35+
36+
sys.setrecursionlimit(10**9)
37+
input = sys.stdin.readline
38+
output = sys.stdout.write
39+
40+
41+
def solve():
42+
return
43+
44+
45+
```

package-lock.json

Lines changed: 4 additions & 4 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)