# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
542367 | rembocoder | Mutating DNA (IOI21_dna) | C++17 | 0 ms | 0 KiB |
This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#pragma GCC target ("avx2")
#pragma GCC optimization ("O3")
#pragma GCC optimization ("unroll-loops")
#include <ext/pb_ds/assoc_container.hpp>
using namespace __gnu_pbds;
#include <bits/stdc++.h>
using namespace std;
#define int int64_t
#define forn(i, n) for (int i = 0; i < (int)(n); i++)
struct my_hash {
inline size_t operator()(const pair<int, int>& a) const {
return a.first * 31 + a.second;
}
};
string s, t;
string act = "ACT";
vector<vector<int>> cnt(3);
void init(string s_, string t_) {
s = s_;
t = t_;
int n = s.size();
for (int i = 0; i < 3; i++) {
cnt[i].resize(n + 1);
for (int j = 0; j < n; j++) {
cnt[i][j + 1] = cnt[i][j] + (act[i] == s[j]);
cnt[i][j + 1] = cnt[i][j] - (act[i] == t[j]);
}
}
}
int get_distance(int l, int r) {
r++;
for (int i = 0; i < 3; i++) {
if (cnt[i][r] != cnt[i][l]) {
return -1;
}
}
return 0;
}
/*int32_t main() {
ios_base::sync_with_stdio(0);
int t = 1;
cin >> t;
while (t--) {
int n;
cin >> n;
vector<int> a(n);
for (int i = 0; i < n; i++) {
cin >> a[i];
}
sort(a.begin(), a.end());
int sum_a0 = 0;
for (int i = 1; i < n; i++) {
sum_a0 += a[0] + a[i];
}
int sum_ab = 0;
for (int i = 0; i < n - 1; i++) {
sum_ab += a[i] + a.back();
}
if (sum_a0 > 0 || sum_ab < 0) {
cout << "INF\n";
continue;
}
vector<int> sum(n + 1);
for (int i = 0; i < n; i++) {
sum[i + 1] = sum[i] + a[i];
}
int ans = -2e18;
for (int i = 0; i < n; i++) {
int cur = -a[i] * a[i] * (n - 1);
cur += (sum[n] - sum[i + 1] - a[i] * (n - i - 1)) * (a[0] - a[i]);
cur += (sum[i] - sum[1] - a[i] * (i - 1)) * (a[n - 1] - a[i]);
ans = max(ans, cur);
}
cout << ans << '\n';
}
return 0;
}
*/