# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
871626 |
2023-11-11T08:01:07 Z |
vjudge1 |
Difference (POI11_roz) |
C++17 |
|
1000 ms |
65536 KB |
#include "bits/stdc++.h"
using namespace std;
const int N = 1e6+5;
int n;
char c[N];
int sum[N][30];
int Get(int l, int r, int c) {
return sum[r][c] - sum[l-1][c];
}
signed main() {
ios_base::sync_with_stdio(0);
cin.tie(0);cout.tie(0);
cin >> n;
for (int i = 1 ; i <= n ; i++) {
cin >> c[i];
for (int j = 0 ; j < 26 ; j++)
sum[i][j] = sum[i-1][j] + (c[i]-'a' == j);
}
int res = 0;
for (int i = 1 ; i <= n ; i++)
for (int j = 1 ; j < i ; j++) {
int ma = 0, mi = 1e9;
for (int c = 0 ; c < 26 ; c++)
if (Get(j, i, c)) {
ma = max(ma, Get(j, i, c));
mi = min(mi, Get(j, i, c));
}
res = max(res, ma-mi);
}
cout << res;
return 0;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
348 KB |
Output is correct |
2 |
Correct |
0 ms |
348 KB |
Output is correct |
3 |
Correct |
0 ms |
348 KB |
Output is correct |
4 |
Correct |
0 ms |
348 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
348 KB |
Output is correct |
2 |
Correct |
0 ms |
348 KB |
Output is correct |
3 |
Correct |
0 ms |
348 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
344 KB |
Output is correct |
2 |
Correct |
1 ms |
344 KB |
Output is correct |
3 |
Correct |
1 ms |
348 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
98 ms |
2676 KB |
Output is correct |
2 |
Correct |
0 ms |
348 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Execution timed out |
1097 ms |
2652 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Execution timed out |
1044 ms |
12892 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Runtime error |
26 ms |
65536 KB |
Execution killed with signal 9 |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Runtime error |
32 ms |
65536 KB |
Execution killed with signal 9 |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Runtime error |
27 ms |
65536 KB |
Execution killed with signal 9 |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Runtime error |
27 ms |
65536 KB |
Execution killed with signal 9 |
2 |
Halted |
0 ms |
0 KB |
- |