# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
1012447 |
2024-07-02T07:36:44 Z |
basa |
Difference (POI11_roz) |
C++14 |
|
1000 ms |
44280 KB |
#include <bits/stdc++.h>
using namespace std;
#define int long long
const int maxa = 1000005;
vector<int>p[maxa];
signed main()
{
cin.tie(0) -> sync_with_stdio(0);
int n;
cin >> n;
string s;
cin >> s;
vector<int>ind[30];
for(int i = 0; i < n; i++) ind[s[i] - 'a'].push_back(i);
int ans = 0;
for(int i = 0; i < 26; i++){
for(int j = 0; j < 26; j++){
if(ind[i].size() == 0) break;
if(ind[j].size() == 0) continue;
int a[n] = {};
for(int k = 0; k < n; k++){
a[k] += (s[k] - 'a' == i ? 1 : 0);
a[k] += (s[k] - 'a' == j ? -1 : 0);
}
int curr = a[0];
int mx = curr;
for(int i = 1; i < n; i++){
curr = max(a[i], curr + a[i]);
mx = max(mx, curr);
}
ans = max(mx, ans);
}
}
cout << ans;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
7 ms |
23896 KB |
Output is correct |
2 |
Correct |
7 ms |
23900 KB |
Output is correct |
3 |
Correct |
7 ms |
23900 KB |
Output is correct |
4 |
Incorrect |
9 ms |
23900 KB |
Output isn't correct |
5 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
9 ms |
23900 KB |
Output is correct |
2 |
Incorrect |
7 ms |
23900 KB |
Output isn't correct |
3 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
10 ms |
23900 KB |
Output is correct |
2 |
Correct |
7 ms |
23896 KB |
Output is correct |
3 |
Incorrect |
8 ms |
23900 KB |
Output isn't correct |
4 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
11 ms |
23900 KB |
Output is correct |
2 |
Incorrect |
7 ms |
23856 KB |
Output isn't correct |
3 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
20 ms |
24156 KB |
Output is correct |
2 |
Incorrect |
11 ms |
23828 KB |
Output isn't correct |
3 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
157 ms |
25688 KB |
Output is correct |
2 |
Incorrect |
7 ms |
23900 KB |
Output isn't correct |
3 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Execution timed out |
1072 ms |
44280 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Execution timed out |
1012 ms |
44276 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Execution timed out |
1077 ms |
43828 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Execution timed out |
1060 ms |
44280 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |