# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
30100 |
2017-07-22T06:00:23 Z |
구사과(#1250) |
Difference (POI11_roz) |
C++14 |
|
253 ms |
2996 KB |
#include <bits/stdc++.h>
using namespace std;
typedef long long lint;
typedef long double llf;
typedef pair<int, int> pi;
const int MAXN = 1000005;
int n;
char str[MAXN];
int main(){
cin >> n >> (str + 1);
int ans = 0;
for(int i='a'; i<='z'; i++){
int cnt[26] = {};
for(int j=1; j<=n; j++){
if(str[j] == i){
for(int j=0; j<26; j++) cnt[j] = max(cnt[j], 0);
int aux[26] = {};
for(int k=j+1; k<=n && str[k] != i; k++){
aux[str[k] - 'a']++;
}
cnt[str[j] - 'a']++;
for(int j=0; j<26; j++) cnt[j]--;
for(int j=0; j<26; j++){
if(j == i) continue;
ans = max(ans, cnt[j] + aux[j]);
}
}
else{
cnt[str[j] - 'a']++;
}
}
}
cout << ans;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
0 ms |
2996 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
0 ms |
2996 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
2996 KB |
Output is correct |
2 |
Correct |
0 ms |
2996 KB |
Output is correct |
3 |
Correct |
0 ms |
2996 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
0 ms |
2996 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
0 ms |
2996 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
16 ms |
2996 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
196 ms |
2996 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
226 ms |
2996 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
253 ms |
2996 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
223 ms |
2996 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |