Algorithm/BOJ
-
KOI 2019 1차 초등부 / 막대기 - 17608Algorithm/BOJ 2020. 7. 31. 14:36
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 #include using namespace std; int N; int arr[100001]; int main() { ios_base::sync_with_stdio(0), cin.tie(0); cin >> N; for(int i= 0 ;i> arr[i]; int ans = 0; int M = 0; for(int i = N-1; i>=0; --i) if(arr[i] > M) { ++ans; M = arr[i]; } cout
-
KOI 2019 고등부 2차 / 괄호 - 17623Algorithm/BOJ 2020. 7. 31. 14:26
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 #include using namespace std; string dp[1001]; string min(string s1, string s2) { if(s1.size() == 0) return s2; if(s1.size() == s2.size()) { for(int i = 0; i
-
KOI 2019 중등부 2차 / 개구리 점프 - 17619Algorithm/BOJ 2020. 7. 29. 00:59
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 #include #include #include using namespace std; int N, Q; struct disjointSet { vector parent, rank; disjointSet(int n) : parent(n), rank(n, 0) { for(int i= 0; i Q; disjointSet set(N); int x1, x2, y; for(..
-
등수 찾기 - 17616Algorithm/BOJ 2020. 7. 19. 20:51
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 //17616 - 등수 찾기 #include #include #include using namespace std; int N, M, X; vector uadj; vector dadj; int U, V; void init() { cin >> N >> M >> X; dadj = uadj = vector(N+1); int u, v; for(int i = 0; i> u >> v; uadj[v].push_back(u); dadj[u].push_bac..
-
볼 모으기 - 17615Algorithm/BOJ 2020. 7. 19. 19:29
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 //17615 - 볼 모으기 #include using namespace std; int N; int Redn, Blun; int ln, rn; char lc, rc; int main() { ios_base::sync_with_stdio(0); cin.tie(0); cin >> N; string s; cin >> s; for (int i = 0; i