# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
30103 |
2017-07-22T06:09:35 Z |
구사과(#1250) |
Difference (POI11_roz) |
C++14 |
|
226 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){
int aux[26] = {};
for(int k=j+1; k<=n && str[k] != i; k++){
aux[str[k] - 'a']++;
}
for(int j=0; j<26; j++){
if(j + 'a' == i) continue;
ans = max(ans, cnt[j] + aux[j] - 1);
}
}
cnt[str[j] - 'a']++;
if(str[j] == i) for(int j=0; j<26; j++) cnt[j] = max(cnt[j] - 1, 0);
}
}
cout << ans;
}
# |
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 |
4 |
Correct |
0 ms |
2996 KB |
Output is correct |
# |
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 |
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 |
Correct |
0 ms |
2996 KB |
Output is correct |
2 |
Correct |
0 ms |
2996 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
2996 KB |
Output is correct |
2 |
Correct |
0 ms |
2996 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
19 ms |
2996 KB |
Output is correct |
2 |
Correct |
0 ms |
2996 KB |
Output is correct |
3 |
Correct |
3 ms |
2996 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
216 ms |
2996 KB |
Output is correct |
2 |
Correct |
0 ms |
2996 KB |
Output is correct |
3 |
Correct |
179 ms |
2996 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
209 ms |
2996 KB |
Output is correct |
2 |
Correct |
176 ms |
2996 KB |
Output is correct |
3 |
Correct |
183 ms |
2996 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
226 ms |
2996 KB |
Output is correct |
2 |
Correct |
206 ms |
2996 KB |
Output is correct |
3 |
Correct |
203 ms |
2996 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
216 ms |
2996 KB |
Output is correct |
2 |
Correct |
169 ms |
2996 KB |
Output is correct |
3 |
Correct |
213 ms |
2996 KB |
Output is correct |