diff options
Diffstat (limited to 'contests')
60 files changed, 353 insertions, 0 deletions
diff --git a/contests/filtrationContest/A/main b/contests/filtrationContest/A/main Binary files differnew file mode 100755 index 0000000..1061a17 --- /dev/null +++ b/contests/filtrationContest/A/main diff --git a/contests/filtrationContest/A/main.cpp b/contests/filtrationContest/A/main.cpp new file mode 100644 index 0000000..5968cb2 --- /dev/null +++ b/contests/filtrationContest/A/main.cpp @@ -0,0 +1,33 @@ +#include<bits/stdc++.h> + +using namespace std; + +int main () { + ios_base::sync_with_stdio(false); + cin.tie(NULL); + int tt; + cin >> tt; + while(tt--){ + int n; + cin >> n; + string s; + cin >> s; + bool sus = false; + for (int i = 0; i < n - 1; i++) { + if(s[i] == s[i + 1]) { + s[i] = '.'; + } + } + map<int, int> fq; + for (auto ch : s) { + fq[ch]++; + } + for (auto [key, val] : fq) { + if (val > 1 && key != '.') { + sus = true; + break; + } + } + cout << (!sus ? "YES" : "NO") << '\n'; + } +} diff --git a/contests/filtrationContest/A/main_input0.txt b/contests/filtrationContest/A/main_input0.txt new file mode 100644 index 0000000..4fdafa4 --- /dev/null +++ b/contests/filtrationContest/A/main_input0.txt @@ -0,0 +1,11 @@ +5 +3 +ABA +11 +DDBBCCCBBEZ +7 +FFGZZZY +1 +Z +2 +AB diff --git a/contests/filtrationContest/A/main_output0.txt b/contests/filtrationContest/A/main_output0.txt new file mode 100644 index 0000000..7957a10 --- /dev/null +++ b/contests/filtrationContest/A/main_output0.txt @@ -0,0 +1,5 @@ +NO +NO +YES +YES +YES diff --git a/contests/filtrationContest/B/main b/contests/filtrationContest/B/main Binary files differnew file mode 100755 index 0000000..eedcad2 --- /dev/null +++ b/contests/filtrationContest/B/main diff --git a/contests/filtrationContest/B/main.cpp b/contests/filtrationContest/B/main.cpp new file mode 100644 index 0000000..39d6257 --- /dev/null +++ b/contests/filtrationContest/B/main.cpp @@ -0,0 +1,19 @@ +#include<bits/stdc++.h> + +using namespace std; + +long long fact(long long mn) { + long long ans = 1; + for(int i = 1; i <= mn; i++) { + ans *= i; + } + return ans; +} + +int main () { + ios_base::sync_with_stdio(false); + cin.tie(NULL); + long long n, m; + cin >> n >> m; + cout << fact(min(n, m)) << '\n'; +} diff --git a/contests/filtrationContest/B/main_input0.txt b/contests/filtrationContest/B/main_input0.txt new file mode 100644 index 0000000..109c32b --- /dev/null +++ b/contests/filtrationContest/B/main_input0.txt @@ -0,0 +1 @@ +4 3 diff --git a/contests/filtrationContest/B/main_output0.txt b/contests/filtrationContest/B/main_output0.txt new file mode 100644 index 0000000..1e8b314 --- /dev/null +++ b/contests/filtrationContest/B/main_output0.txt @@ -0,0 +1 @@ +6 diff --git a/contests/filtrationContest/C/main b/contests/filtrationContest/C/main Binary files differnew file mode 100755 index 0000000..4fad05f --- /dev/null +++ b/contests/filtrationContest/C/main diff --git a/contests/filtrationContest/C/main.cpp b/contests/filtrationContest/C/main.cpp new file mode 100644 index 0000000..0d06899 --- /dev/null +++ b/contests/filtrationContest/C/main.cpp @@ -0,0 +1,23 @@ +#include<bits/stdc++.h> + +using namespace std; + +int64_t fq[22]; + +int main () { + ios_base::sync_with_stdio(false); + cin.tie(NULL); + long long n; + cin >> n; + for (int i = 1; i <= n; i++) { + int64_t x; + cin >> x; + fq[10 + x]++; + } + int64_t ans = 0; + for (int i = 1;i <= 10; i++) { + ans += fq[10 - i] * fq[10 + i]; + } + ans += fq[10] * (fq[10] - 1) / 2; + cout << ans; +} diff --git a/contests/filtrationContest/C/main_input0.txt b/contests/filtrationContest/C/main_input0.txt new file mode 100644 index 0000000..72f399e --- /dev/null +++ b/contests/filtrationContest/C/main_input0.txt @@ -0,0 +1,2 @@ +5 +-3 3 0 0 3 diff --git a/contests/filtrationContest/C/main_input1.txt b/contests/filtrationContest/C/main_input1.txt new file mode 100644 index 0000000..2edfca6 --- /dev/null +++ b/contests/filtrationContest/C/main_input1.txt @@ -0,0 +1,2 @@ +3 +0 0 0 diff --git a/contests/filtrationContest/C/main_input2.txt b/contests/filtrationContest/C/main_input2.txt new file mode 100644 index 0000000..86d0781 --- /dev/null +++ b/contests/filtrationContest/C/main_input2.txt @@ -0,0 +1,2 @@ +7 +-1 1 1 1 0 0 0
\ No newline at end of file diff --git a/contests/filtrationContest/C/main_input3.txt b/contests/filtrationContest/C/main_input3.txt new file mode 100644 index 0000000..91a9d0e --- /dev/null +++ b/contests/filtrationContest/C/main_input3.txt @@ -0,0 +1,2 @@ +6 +0 0 0 0 0 0
\ No newline at end of file diff --git a/contests/filtrationContest/C/main_input4.txt b/contests/filtrationContest/C/main_input4.txt new file mode 100644 index 0000000..9dd1093 --- /dev/null +++ b/contests/filtrationContest/C/main_input4.txt @@ -0,0 +1,2 @@ +4 +1 -1 1 -1
\ No newline at end of file diff --git a/contests/filtrationContest/C/main_input5.txt b/contests/filtrationContest/C/main_input5.txt new file mode 100644 index 0000000..166c057 --- /dev/null +++ b/contests/filtrationContest/C/main_input5.txt @@ -0,0 +1,2 @@ +1 +0
\ No newline at end of file diff --git a/contests/filtrationContest/C/main_output0.txt b/contests/filtrationContest/C/main_output0.txt new file mode 100644 index 0000000..00750ed --- /dev/null +++ b/contests/filtrationContest/C/main_output0.txt @@ -0,0 +1 @@ +3 diff --git a/contests/filtrationContest/C/main_output1.txt b/contests/filtrationContest/C/main_output1.txt new file mode 100644 index 0000000..00750ed --- /dev/null +++ b/contests/filtrationContest/C/main_output1.txt @@ -0,0 +1 @@ +3 diff --git a/contests/filtrationContest/C/main_output2.txt b/contests/filtrationContest/C/main_output2.txt new file mode 100644 index 0000000..ca7bf83 --- /dev/null +++ b/contests/filtrationContest/C/main_output2.txt @@ -0,0 +1 @@ +13
\ No newline at end of file diff --git a/contests/filtrationContest/C/main_output3.txt b/contests/filtrationContest/C/main_output3.txt new file mode 100644 index 0000000..3f10ffe --- /dev/null +++ b/contests/filtrationContest/C/main_output3.txt @@ -0,0 +1 @@ +15
\ No newline at end of file diff --git a/contests/filtrationContest/C/main_output4.txt b/contests/filtrationContest/C/main_output4.txt new file mode 100644 index 0000000..bf0d87a --- /dev/null +++ b/contests/filtrationContest/C/main_output4.txt @@ -0,0 +1 @@ +4
\ No newline at end of file diff --git a/contests/filtrationContest/C/main_output5.txt b/contests/filtrationContest/C/main_output5.txt new file mode 100644 index 0000000..c227083 --- /dev/null +++ b/contests/filtrationContest/C/main_output5.txt @@ -0,0 +1 @@ +0
\ No newline at end of file diff --git a/contests/filtrationContest/D/main.cpp b/contests/filtrationContest/D/main.cpp new file mode 100644 index 0000000..6c53fb2 --- /dev/null +++ b/contests/filtrationContest/D/main.cpp @@ -0,0 +1,15 @@ +#include<bits/stdc++.h> + +using namespace std; + +int main () { + ios_base::sync_with_stdio(false); + cin.tie(NULL); + int tt; + cin >> tt; + while(tt--){ + long long x; + cin >> x; + + } +} diff --git a/contests/filtrationContest/F/main.cpp b/contests/filtrationContest/F/main.cpp new file mode 100644 index 0000000..6283d18 --- /dev/null +++ b/contests/filtrationContest/F/main.cpp @@ -0,0 +1,26 @@ +#include<bits/stdc++.h> +#include <utility> + +using namespace std; + +int main () { + ios_base::sync_with_stdio(false); + cin.tie(NULL); + string home, away; + cin >> home >> away; + int n; + cin >> n; +// (home/away, tshirtnum) -> (minute, card) + map<pair<char, int>, pair<int, char>> mp; + while(n--) { + int m; + cin >> m; + char ch; + cin >> ch; + int tn; + cin >> tn; + char card; + cin >> card; + mp[make_pair(ch, tn)] = make_pair(m, card); + } +} diff --git a/contests/filtrationContest/G/main b/contests/filtrationContest/G/main Binary files differnew file mode 100755 index 0000000..aff0ca9 --- /dev/null +++ b/contests/filtrationContest/G/main diff --git a/contests/filtrationContest/G/main.cpp b/contests/filtrationContest/G/main.cpp new file mode 100644 index 0000000..c1f15a6 --- /dev/null +++ b/contests/filtrationContest/G/main.cpp @@ -0,0 +1,20 @@ +#include<bits/stdc++.h> + +using namespace std; + +int main () { + ios_base::sync_with_stdio(false); + cin.tie(NULL); + int tt; + cin >> tt; + while(tt--){ + int l, r, a; + cin >> l >> r >> a; + int mx = r / a + r % a; + int y = r / a * a - 1; + if (y >= l) { + mx = max(mx, y / a + y % a); + } + cout << mx << '\n'; + } +} diff --git a/contests/filtrationContest/G/main_input0.txt b/contests/filtrationContest/G/main_input0.txt new file mode 100644 index 0000000..338c54c --- /dev/null +++ b/contests/filtrationContest/G/main_input0.txt @@ -0,0 +1,6 @@ +5 +1 4 3 +5 8 4 +6 10 6 +1 1000000000 1000000000 +10 12 8 diff --git a/contests/filtrationContest/G/main_output0.txt b/contests/filtrationContest/G/main_output0.txt new file mode 100644 index 0000000..0e984df --- /dev/null +++ b/contests/filtrationContest/G/main_output0.txt @@ -0,0 +1,5 @@ +2 +4 +5 +999999999 +5 diff --git a/contests/filtrationContest/H/main b/contests/filtrationContest/H/main Binary files differnew file mode 100755 index 0000000..dff87e5 --- /dev/null +++ b/contests/filtrationContest/H/main diff --git a/contests/filtrationContest/H/main.cpp b/contests/filtrationContest/H/main.cpp new file mode 100644 index 0000000..db30a23 --- /dev/null +++ b/contests/filtrationContest/H/main.cpp @@ -0,0 +1,20 @@ +#include<bits/stdc++.h> + +using namespace std; + +int main () { + ios_base::sync_with_stdio(false); + cin.tie(NULL); + int n, k; + cin >> n >> k; + unordered_set<int> st; + vector<int> v(n); + for (auto &x : v) cin >> x; + sort(v.begin(), v.end()); + for(auto x : v) { + if(!st.count(x / k)) { + st.insert(x); + } + } + cout << st.size() << endl; +} diff --git a/contests/filtrationContest/H/main_input0.txt b/contests/filtrationContest/H/main_input0.txt new file mode 100644 index 0000000..740f61c --- /dev/null +++ b/contests/filtrationContest/H/main_input0.txt @@ -0,0 +1,2 @@ +6 2 +2 3 6 5 4 10 diff --git a/contests/filtrationContest/H/main_output0.txt b/contests/filtrationContest/H/main_output0.txt new file mode 100644 index 0000000..00750ed --- /dev/null +++ b/contests/filtrationContest/H/main_output0.txt @@ -0,0 +1 @@ +3 diff --git a/contests/filtrationContest/I/main b/contests/filtrationContest/I/main Binary files differnew file mode 100755 index 0000000..5792575 --- /dev/null +++ b/contests/filtrationContest/I/main diff --git a/contests/filtrationContest/I/main.cpp b/contests/filtrationContest/I/main.cpp new file mode 100644 index 0000000..e0ab17a --- /dev/null +++ b/contests/filtrationContest/I/main.cpp @@ -0,0 +1,20 @@ +#include<bits/stdc++.h> + +using namespace std; + +int main () { + ios_base::sync_with_stdio(false); + cin.tie(NULL); + int n, k; + cin >> n >> k; + vector<int> v(n); + for(auto &x : v) cin >> x; + vector<long long> dp(n); + for (int i = 0; i < k; i++) { + dp[0] += v[i]; + } + for (int i = 1; i <= n - k; i++) { + dp[i] = dp[i - 1] + v[i + k - 1] - v[i - 1]; + } + cout << min_element(dp.begin(), dp.end() - k + 1) - dp.begin() + 1 << endl; +} diff --git a/contests/filtrationContest/I/main_input0.txt b/contests/filtrationContest/I/main_input0.txt new file mode 100644 index 0000000..6e3da58 --- /dev/null +++ b/contests/filtrationContest/I/main_input0.txt @@ -0,0 +1,2 @@ +7 3 +1 2 6 1 1 7 1 diff --git a/contests/filtrationContest/I/main_input1.txt b/contests/filtrationContest/I/main_input1.txt new file mode 100644 index 0000000..079afd6 --- /dev/null +++ b/contests/filtrationContest/I/main_input1.txt @@ -0,0 +1,2 @@ +1 1 +1
\ No newline at end of file diff --git a/contests/filtrationContest/I/main_input2.txt b/contests/filtrationContest/I/main_input2.txt new file mode 100644 index 0000000..9823f9e --- /dev/null +++ b/contests/filtrationContest/I/main_input2.txt @@ -0,0 +1,2 @@ +7 3 +1 2 3 4 5 6 7
\ No newline at end of file diff --git a/contests/filtrationContest/I/main_input3.txt b/contests/filtrationContest/I/main_input3.txt new file mode 100644 index 0000000..ca70d19 --- /dev/null +++ b/contests/filtrationContest/I/main_input3.txt @@ -0,0 +1,2 @@ +4 1 +2 4 5 3
\ No newline at end of file diff --git a/contests/filtrationContest/I/main_input4.txt b/contests/filtrationContest/I/main_input4.txt new file mode 100644 index 0000000..3fb68bb --- /dev/null +++ b/contests/filtrationContest/I/main_input4.txt @@ -0,0 +1,2 @@ +2 1 +20 1
\ No newline at end of file diff --git a/contests/filtrationContest/I/main_output0.txt b/contests/filtrationContest/I/main_output0.txt new file mode 100644 index 0000000..00750ed --- /dev/null +++ b/contests/filtrationContest/I/main_output0.txt @@ -0,0 +1 @@ +3 diff --git a/contests/filtrationContest/I/main_output1.txt b/contests/filtrationContest/I/main_output1.txt new file mode 100644 index 0000000..56a6051 --- /dev/null +++ b/contests/filtrationContest/I/main_output1.txt @@ -0,0 +1 @@ +1
\ No newline at end of file diff --git a/contests/filtrationContest/I/main_output2.txt b/contests/filtrationContest/I/main_output2.txt new file mode 100644 index 0000000..56a6051 --- /dev/null +++ b/contests/filtrationContest/I/main_output2.txt @@ -0,0 +1 @@ +1
\ No newline at end of file diff --git a/contests/filtrationContest/I/main_output3.txt b/contests/filtrationContest/I/main_output3.txt new file mode 100644 index 0000000..56a6051 --- /dev/null +++ b/contests/filtrationContest/I/main_output3.txt @@ -0,0 +1 @@ +1
\ No newline at end of file diff --git a/contests/filtrationContest/I/main_output4.txt b/contests/filtrationContest/I/main_output4.txt new file mode 100644 index 0000000..d8263ee --- /dev/null +++ b/contests/filtrationContest/I/main_output4.txt @@ -0,0 +1 @@ +2
\ No newline at end of file diff --git a/contests/filtrationContest/J/main b/contests/filtrationContest/J/main Binary files differnew file mode 100755 index 0000000..da8fb9c --- /dev/null +++ b/contests/filtrationContest/J/main diff --git a/contests/filtrationContest/J/main.cpp b/contests/filtrationContest/J/main.cpp new file mode 100644 index 0000000..ca665c9 --- /dev/null +++ b/contests/filtrationContest/J/main.cpp @@ -0,0 +1,22 @@ +#include<bits/stdc++.h> + +using namespace std; + +int main () { + ios_base::sync_with_stdio(false); + cin.tie(NULL); + int n, m; + cin >> n >> m; + vector<int> v(n); + for(auto&x : v) cin >> x; + int ans = 1; + int sum = 0; + for(int i = 0; i < n; i++) { + sum += v[i]; + if (sum > m) { + ans++; + sum = v[i]; + } + } + cout << ans << '\n'; +} diff --git a/contests/filtrationContest/J/main_input0.txt b/contests/filtrationContest/J/main_input0.txt new file mode 100644 index 0000000..804e677 --- /dev/null +++ b/contests/filtrationContest/J/main_input0.txt @@ -0,0 +1,2 @@ +4 3 +2 3 2 1 diff --git a/contests/filtrationContest/J/main_input1.txt b/contests/filtrationContest/J/main_input1.txt new file mode 100644 index 0000000..6e5cdd1 --- /dev/null +++ b/contests/filtrationContest/J/main_input1.txt @@ -0,0 +1,2 @@ +3 4 +1 2 1 diff --git a/contests/filtrationContest/J/main_input2.txt b/contests/filtrationContest/J/main_input2.txt new file mode 100644 index 0000000..edf85b1 --- /dev/null +++ b/contests/filtrationContest/J/main_input2.txt @@ -0,0 +1,2 @@ +7 6 +1 1 1 1 1 1 2
\ No newline at end of file diff --git a/contests/filtrationContest/J/main_input3.txt b/contests/filtrationContest/J/main_input3.txt new file mode 100644 index 0000000..14c66d0 --- /dev/null +++ b/contests/filtrationContest/J/main_input3.txt @@ -0,0 +1,2 @@ +1 5 +4
\ No newline at end of file diff --git a/contests/filtrationContest/J/main_output0.txt b/contests/filtrationContest/J/main_output0.txt new file mode 100644 index 0000000..00750ed --- /dev/null +++ b/contests/filtrationContest/J/main_output0.txt @@ -0,0 +1 @@ +3 diff --git a/contests/filtrationContest/J/main_output1.txt b/contests/filtrationContest/J/main_output1.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/contests/filtrationContest/J/main_output1.txt @@ -0,0 +1 @@ +1 diff --git a/contests/filtrationContest/J/main_output2.txt b/contests/filtrationContest/J/main_output2.txt new file mode 100644 index 0000000..d8263ee --- /dev/null +++ b/contests/filtrationContest/J/main_output2.txt @@ -0,0 +1 @@ +2
\ No newline at end of file diff --git a/contests/filtrationContest/J/main_output3.txt b/contests/filtrationContest/J/main_output3.txt new file mode 100644 index 0000000..56a6051 --- /dev/null +++ b/contests/filtrationContest/J/main_output3.txt @@ -0,0 +1 @@ +1
\ No newline at end of file diff --git a/contests/testcont/A/main.cpp b/contests/testcont/A/main.cpp new file mode 100644 index 0000000..9549f1d --- /dev/null +++ b/contests/testcont/A/main.cpp @@ -0,0 +1,13 @@ +#include<bits/stdc++.h> + +using namespace std; + +int main () { + ios_base::sync_with_stdio(false); + cin.tie(NULL); + int tt; + cin >> tt; + while(tt--){ + + } +} diff --git a/contests/testcont/B/main.cpp b/contests/testcont/B/main.cpp new file mode 100644 index 0000000..9549f1d --- /dev/null +++ b/contests/testcont/B/main.cpp @@ -0,0 +1,13 @@ +#include<bits/stdc++.h> + +using namespace std; + +int main () { + ios_base::sync_with_stdio(false); + cin.tie(NULL); + int tt; + cin >> tt; |
