From 43b558e47c031f4976db4de7c4ea3a42fddfce26 Mon Sep 17 00:00:00 2001 From: Taichi Yamakawa Date: Wed, 6 Jan 2021 23:11:45 +0900 Subject: [PATCH 1/5] atcoder/abc064A --- atcoder/abc064/A/main.cpp | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) create mode 100644 atcoder/abc064/A/main.cpp diff --git a/atcoder/abc064/A/main.cpp b/atcoder/abc064/A/main.cpp new file mode 100644 index 00000000..26ff88ce --- /dev/null +++ b/atcoder/abc064/A/main.cpp @@ -0,0 +1,20 @@ +#include + +using namespace std; +using ll = long long; + +int main() { + ios_base::sync_with_stdio(false); + cin.tie(0); cout.tie(0); + + int r, g, b; + cin >> r >> g >> b; + int rgb = r * 100 + g * 10 + b; + if (rgb % 4 == 0) { + cout << "YES" << endl; + } else { + cout << "NO" << endl; + } + + return 0; +} \ No newline at end of file From cd0cb1fcd919ab1d463b0ef0d10a0a0394b5156a Mon Sep 17 00:00:00 2001 From: Taichi Yamakawa Date: Wed, 6 Jan 2021 23:11:52 +0900 Subject: [PATCH 2/5] atcoder/abc064B --- atcoder/abc064/B/main.cpp | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) create mode 100644 atcoder/abc064/B/main.cpp diff --git a/atcoder/abc064/B/main.cpp b/atcoder/abc064/B/main.cpp new file mode 100644 index 00000000..eba3c040 --- /dev/null +++ b/atcoder/abc064/B/main.cpp @@ -0,0 +1,30 @@ +#include + +using namespace std; +using ll = long long; + +int N; +vector A; + +int solve() { + sort(A.begin(), A.end()); + int ans = 0; + for (int i = 1; i < N; ++i) { + ans += A[i] - A[i-1]; + } + return ans; +} + +int main() { + ios_base::sync_with_stdio(false); + cin.tie(0); cout.tie(0); + + cin >> N; + A.assign(N, 0); + for (int i = 0; i < N; ++i) { + cin >> A[i]; + } + cout << solve() << endl; + + return 0; +} \ No newline at end of file From 1aa28ec09921b10dd0697da9cbe5e33687f781d3 Mon Sep 17 00:00:00 2001 From: Taichi Yamakawa Date: Wed, 6 Jan 2021 23:11:59 +0900 Subject: [PATCH 3/5] atcoder/abc064C --- atcoder/abc064/C/main.cpp | 40 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 40 insertions(+) create mode 100644 atcoder/abc064/C/main.cpp diff --git a/atcoder/abc064/C/main.cpp b/atcoder/abc064/C/main.cpp new file mode 100644 index 00000000..f783ef30 --- /dev/null +++ b/atcoder/abc064/C/main.cpp @@ -0,0 +1,40 @@ +#include + +using namespace std; +using ll = long long; + +int N; +vector A; + +vector solve() { + int K = 0; + unordered_set S; + for (auto a : A) { + if (a < 400) S.insert(0); + else if (a < 800) S.insert(1); + else if (a < 1200) S.insert(2); + else if (a < 1600) S.insert(3); + else if (a < 2000) S.insert(4); + else if (a < 2400) S.insert(5); + else if (a < 2800) S.insert(6); + else if (a < 3200) S.insert(7); + else ++K; + } + if (S.empty()) return { 1, K }; + return { (int)S.size(), (int)S.size() + K }; +} + +int main() { + ios_base::sync_with_stdio(false); + cin.tie(0); cout.tie(0); + + cin >> N; + A.assign(N, 0); + for (int i = 0; i < N; ++i) { + cin >> A[i]; + } + auto minmax = solve(); + cout << minmax[0] << " " << minmax[1] << endl; + + return 0; +} \ No newline at end of file From 900713d6229b970827d135e96840a32558c6d8aa Mon Sep 17 00:00:00 2001 From: Taichi Yamakawa Date: Wed, 6 Jan 2021 23:12:05 +0900 Subject: [PATCH 4/5] atcoder/abc064D --- atcoder/abc064/D/main.cpp | 37 +++++++++++++++++++++++++++++++++++++ 1 file changed, 37 insertions(+) create mode 100644 atcoder/abc064/D/main.cpp diff --git a/atcoder/abc064/D/main.cpp b/atcoder/abc064/D/main.cpp new file mode 100644 index 00000000..048f7c6e --- /dev/null +++ b/atcoder/abc064/D/main.cpp @@ -0,0 +1,37 @@ +#include + +using namespace std; +using ll = long long; + +int N; +string S; + +string solve() { + deque Q; + int k = 0; + for (auto c : S) { + if (c == '(') { + Q.push_back(c); + k++; + } else if (c == ')') { + Q.push_back(c); + if (k > 0) --k; + else Q.push_front('('); + } + } + while (k > 0) { + Q.push_back(')'); + --k; + } + return string(Q.begin(), Q.end()); +} + +int main() { + ios_base::sync_with_stdio(false); + cin.tie(0); cout.tie(0); + + cin >> N >> S; + cout << solve() << endl; + + return 0; +} \ No newline at end of file From 18a98d0654b0e7f51a24dd03f87767f86609a4af Mon Sep 17 00:00:00 2001 From: Taichi Yamakawa Date: Wed, 6 Jan 2021 23:14:51 +0900 Subject: [PATCH 5/5] atcoder/abc064B (feedback from editorial) --- atcoder/abc064/B/main.cpp | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/atcoder/abc064/B/main.cpp b/atcoder/abc064/B/main.cpp index eba3c040..435a8821 100644 --- a/atcoder/abc064/B/main.cpp +++ b/atcoder/abc064/B/main.cpp @@ -7,12 +7,9 @@ int N; vector A; int solve() { - sort(A.begin(), A.end()); - int ans = 0; - for (int i = 1; i < N; ++i) { - ans += A[i] - A[i-1]; - } - return ans; + int mini = *min_element(A.begin(), A.end()); + int maxi = *max_element(A.begin(), A.end()); + return maxi - mini; } int main() {