diff options
Diffstat (limited to 'contests')
| -rwxr-xr-x | contests/Round#828/A/main | bin | 0 -> 59888 bytes | |||
| -rw-r--r-- | contests/Round#828/A/main.cpp | 39 | ||||
| -rwxr-xr-x | contests/Round#828/B/main | bin | 0 -> 26712 bytes | |||
| -rw-r--r-- | contests/Round#828/B/main.cpp | 48 | ||||
| -rw-r--r-- | contests/Round#828/B/main_input0.txt | 27 | ||||
| -rw-r--r-- | contests/Round#828/B/main_output0.txt | 18 | ||||
| -rwxr-xr-x | contests/Round#828/C/main | bin | 0 -> 51696 bytes | |||
| -rw-r--r-- | contests/Round#828/C/main.cpp | 48 | ||||
| -rw-r--r-- | contests/Round#828/C/main_input0.txt | 13 | ||||
| -rw-r--r-- | contests/Round#828/C/main_output0.txt | 6 | ||||
| -rw-r--r-- | contests/Round#828/D/main.cpp | 20 | ||||
| -rw-r--r-- | contests/Round#828/E/main.cpp | 20 | ||||
| -rw-r--r-- | contests/Round#828/F/main.cpp | 20 | ||||
| -rwxr-xr-x | contests/filtrationContest/C/main | bin | 22528 -> 50432 bytes | |||
| -rw-r--r-- | contests/filtrationContest/C/main.cpp | 26 |
15 files changed, 270 insertions, 15 deletions
diff --git a/contests/Round#828/A/main b/contests/Round#828/A/main Binary files differnew file mode 100755 index 0000000..e25915f --- /dev/null +++ b/contests/Round#828/A/main diff --git a/contests/Round#828/A/main.cpp b/contests/Round#828/A/main.cpp new file mode 100644 index 0000000..62a742b --- /dev/null +++ b/contests/Round#828/A/main.cpp @@ -0,0 +1,39 @@ +#include<bits/stdc++.h> + +using namespace std; + +typedef long long ll; +typedef pair<int, int> ii; +typedef vector<ii> vii; +typedef vector<int> vi; + +#define INF 1000000000 + +string buildString(map<int, char> &mp, vi &v) { + string s = ""; + for (auto x : v) { + s.push_back(mp[x]); + } + return s; +} + +int main () { + ios_base::sync_with_stdio(false); + cin.tie(NULL); + int tt; + cin >> tt; + while(tt--) { + int n; + cin >> n; + vi v(n); + for (auto &x : v) cin >> x; + string s; + cin >> s; + map<int, char> mp; + for (int i = 0; i < n; i++) { + mp[v[i]] = s[i]; + } + // cerr << buildString(mp,v) << '\n'; + cout << (s == buildString(mp, v) ? "YES" : "NO") << '\n'; + } +} diff --git a/contests/Round#828/B/main b/contests/Round#828/B/main Binary files differnew file mode 100755 index 0000000..ff0612d --- /dev/null +++ b/contests/Round#828/B/main diff --git a/contests/Round#828/B/main.cpp b/contests/Round#828/B/main.cpp new file mode 100644 index 0000000..e2d3d5d --- /dev/null +++ b/contests/Round#828/B/main.cpp @@ -0,0 +1,48 @@ +#include<bits/stdc++.h> + +using namespace std; + +typedef long long ll; +typedef pair<int, int> ii; +typedef vector<ii> vii; +typedef vector<int> vi; + +#define INF 1000000000 + +int main () { + ios_base::sync_with_stdio(false); + cin.tie(NULL); + int tt; + cin >> tt; + while(tt--) { + int n, q; + cin >> n >> q; + vector<long long> v(n); + int even = 0, odd = 0; + long long ans = 0; + for (int i = 0 ; i < n; i++) { + cin >> v[i]; + odd += (v[i] & 1); + ans += v[i]; + } + even = n - odd; + while (q--) { + int t, x; + cin >> t >> x; + if (t == 0) { + ans += even * x; + if (x & 1) { + odd += even; + even = 0; + } + } else { + ans += odd * x; + if (x & 1) { + even += odd; + odd = 0; + } + } + cout << ans << '\n'; + } + } +} diff --git a/contests/Round#828/B/main_input0.txt b/contests/Round#828/B/main_input0.txt new file mode 100644 index 0000000..2a62cb5 --- /dev/null +++ b/contests/Round#828/B/main_input0.txt @@ -0,0 +1,27 @@ +4 +1 1 +1 +1 1 +3 3 +1 2 4 +0 2 +1 3 +0 5 +6 7 +1 3 2 4 10 48 +1 6 +0 5 +0 4 +0 5 +1 3 +0 12 +0 1 +6 7 +1000000000 1000000000 1000000000 11 15 17 +0 17 +1 10000 +1 51 +0 92 +0 53 +1 16 +0 1 diff --git a/contests/Round#828/B/main_output0.txt b/contests/Round#828/B/main_output0.txt new file mode 100644 index 0000000..6427631 --- /dev/null +++ b/contests/Round#828/B/main_output0.txt @@ -0,0 +1,18 @@ +2 +11 +14 +29 +80 +100 +100 +100 +118 +190 +196 +3000000094 +3000060094 +3000060400 +3000060952 +3000061270 +3000061366 +3000061366 diff --git a/contests/Round#828/C/main b/contests/Round#828/C/main Binary files differnew file mode 100755 index 0000000..6931c26 --- /dev/null +++ b/contests/Round#828/C/main diff --git a/contests/Round#828/C/main.cpp b/contests/Round#828/C/main.cpp new file mode 100644 index 0000000..a69f265 --- /dev/null +++ b/contests/Round#828/C/main.cpp @@ -0,0 +1,48 @@ +#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; + int m = 0, mx = 0; + for (int i = 0; i < n; i++) { + int x; + cin >> x; + while (x % 2 == 0) { + x /= 2; + m += 1; + } + } + if (m >= n) { + cout << 0 << '\n'; + } else { + int d = n - m, ans = 0; + vector<int> a; + for (int i = n; i >= 1; i--) { + int j = i, cnt = 0; + while (j % 2 == 0) { + cnt += 1; + j /= 2; + } + if (cnt != 0) { + a.push_back(cnt); + } + } + sort(a.rbegin(), a.rend()); + for (int i = 0; i < (int)a.size(); i++) { + ans += 1; + d -= a[i]; + if (d <= 0) { + break; + } + } + cout << (d <= 0 ? ans : -1) << '\n'; + } + } +} diff --git a/contests/Round#828/C/main_input0.txt b/contests/Round#828/C/main_input0.txt new file mode 100644 index 0000000..c507f1f --- /dev/null +++ b/contests/Round#828/C/main_input0.txt @@ -0,0 +1,13 @@ +6 +1 +2 +2 +3 2 +3 +10 6 11 +4 +13 17 1 1 +5 +1 1 12 1 1 +6 +20 7 14 18 3 5
\ No newline at end of file diff --git a/contests/Round#828/C/main_output0.txt b/contests/Round#828/C/main_output0.txt new file mode 100644 index 0000000..994d708 --- /dev/null +++ b/contests/Round#828/C/main_output0.txt @@ -0,0 +1,6 @@ +0 +1 +1 +-1 +2 +1
\ No newline at end of file diff --git a/contests/Round#828/D/main.cpp b/contests/Round#828/D/main.cpp new file mode 100644 index 0000000..8b6b654 --- /dev/null +++ b/contests/Round#828/D/main.cpp @@ -0,0 +1,20 @@ +#include<bits/stdc++.h> + +using namespace std; + +typedef long long ll; +typedef pair<int, int> ii; +typedef vector<ii> vii; +typedef vector<int> vi; + +#define INF 1000000000 + +int main () { + ios_base::sync_with_stdio(false); + cin.tie(NULL); + int tt; + cin >> tt; + while(tt--) { + + } +} diff --git a/contests/Round#828/E/main.cpp b/contests/Round#828/E/main.cpp new file mode 100644 index 0000000..8b6b654 --- /dev/null +++ b/contests/Round#828/E/main.cpp @@ -0,0 +1,20 @@ +#include<bits/stdc++.h> + +using namespace std; + +typedef long long ll; +typedef pair<int, int> ii; +typedef vector<ii> vii; +typedef vector<int> vi; + +#define INF 1000000000 + +int main () { + ios_base::sync_with_stdio(false); + cin.tie(NULL); + int tt; + cin >> tt; + while(tt--) { + + } +} diff --git a/contests/Round#828/F/main.cpp b/contests/Round#828/F/main.cpp new file mode 100644 index 0000000..8b6b654 --- /dev/null +++ b/contests/Round#828/F/main.cpp @@ -0,0 +1,20 @@ +#include<bits/stdc++.h> + +using namespace std; + +typedef long long ll; +typedef pair<int, int> ii; +typedef vector<ii> vii; +typedef vector<int> vi; + +#define INF 1000000000 + +int main () { + ios_base::sync_with_stdio(false); + cin.tie(NULL); + int tt; + cin >> tt; + while(tt--) { + + } +} diff --git a/contests/filtrationContest/C/main b/contests/filtrationContest/C/main Binary files differindex 4fad05f..b207653 100755 --- a/contests/filtrationContest/C/main +++ b/contests/filtrationContest/C/main diff --git a/contests/filtrationContest/C/main.cpp b/contests/filtrationContest/C/main.cpp index 0d06899..e3ed80c 100644 --- a/contests/filtrationContest/C/main.cpp +++ b/contests/filtrationContest/C/main.cpp @@ -1,23 +1,19 @@ #include<bits/stdc++.h> - + using namespace std; - -int64_t fq[22]; - + int main () { - ios_base::sync_with_stdio(false); - cin.tie(NULL); + ios_base::sync_with_stdio(false); + cin.tie(NULL); long long n; cin >> n; - for (int i = 1; i <= n; i++) { - int64_t x; + long long ans = 0; + map<long long, long long> fq; + for(int i = 0; i < n; i++) { + long long x; cin >> x; - fq[10 + x]++; + ans += fq[x]; + fq[-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; + cout << ans << '\n'; } |
