-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[docs] ChaNyeok1225 효율적인 해킹 제출 코드 및 채점 결과 2025-02-02T222841
- Loading branch information
1 parent
8c25a71
commit 7f6c1d7
Showing
2 changed files
with
70 additions
and
0 deletions.
There are no files selected for viewing
12 changes: 12 additions & 0 deletions
12
Private Solve/백준/1325. 효율적인 해킹/ChaNyeok1225/2025-02-02T222841/README.md
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
# [Silver I] 효율적인 해킹 - 1325 | ||
|
||
[문제 링크](https://www.acmicpc.net/problem/1325) | ||
|
||
### 성능 요약 | ||
|
||
메모리: 15732 KB, 시간: 128 ms | ||
|
||
### 제출 일자 | ||
|
||
2025년 2월 2일 22:21:09 | ||
|
58 changes: 58 additions & 0 deletions
58
Private Solve/백준/1325. 효율적인 해킹/ChaNyeok1225/2025-02-02T222841/효율적인 해킹.cc
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,58 @@ | ||
#include <iostream> | ||
#include <queue> | ||
#include <vector> | ||
#include <bitset> | ||
#include <algorithm> | ||
using namespace std; | ||
|
||
int N, M; | ||
vector<int> conn[10001]; | ||
bitset<10001> vis[10001]; | ||
|
||
int main() { | ||
ios::sync_with_stdio(false); | ||
cin.tie(0); cout.tie(0); | ||
|
||
cin >> N >> M; | ||
|
||
int a, b; | ||
for (int i = 0; i < M; i++) { | ||
cin >> a >> b; | ||
conn[b].push_back(a); | ||
} | ||
|
||
queue<int> q; | ||
int maxCount = 0; | ||
|
||
for (int i = 1; i <= N; i++) { | ||
q.push(i); | ||
vis[i].set(i); | ||
|
||
while (!q.empty()) { | ||
int cur = q.front(); | ||
q.pop(); | ||
|
||
for (int next : conn[cur]) { | ||
if (vis[i][next]) continue; | ||
if (next < i) | ||
vis[i] |= vis[next]; | ||
else { | ||
q.push(next); | ||
vis[i].set(next); | ||
} | ||
} | ||
} | ||
maxCount = max(maxCount, (int)vis[i].count()); | ||
} | ||
vector<int> v; | ||
for (int i = 1; i <= N; i++) { | ||
int cnt = vis[i].count(); | ||
if (cnt == maxCount) | ||
v.push_back(i); | ||
} | ||
|
||
for (int res : v) { | ||
cout << res << " "; | ||
} | ||
|
||
} |