# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
30096 | 2017-07-22T05:56:05 Z | 구사과(#1250) | Difference (POI11_roz) | C++ | 266 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++){ ans = max(ans, cnt[j] + aux[j]); } } else{ cnt[str[j] - 'a']++; } } } cout << ans; }
Compilation message
# | 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 | 26 ms | 2996 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 236 ms | 2996 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 233 ms | 2996 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 266 ms | 2996 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 219 ms | 2996 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |