답안 #30093

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
30093 2017-07-22T05:55:46 Z 구사과(#1250) Difference (POI11_roz) C++
0 / 100
0 ms 1844 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 opt1[MAXN][26];
int opt2[MAXN][26];

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

roz.cpp: In function 'int main()':
roz.cpp:22:15: warning: name lookup of 'j' changed
     for(int k=j+1; k<=n && str[k] != i; k++){
               ^
roz.cpp:18:11: warning:   matches this 'j' under ISO standard rules
   for(int j=1; j<=n; j++){
           ^
roz.cpp:20:13: warning:   matches this 'j' under old rules
     for(int j=0; j<26; j++) cnt[j] = max(cnt[j], 0);
             ^
# 결과 실행 시간 메모리 Grader output
1 Runtime error 0 ms 1844 KB Execution killed with signal 11 (could be triggered by violating memory limits)
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Runtime error 0 ms 1844 KB Execution killed with signal 11 (could be triggered by violating memory limits)
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Runtime error 0 ms 1844 KB Execution killed with signal 11 (could be triggered by violating memory limits)
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Runtime error 0 ms 1844 KB Execution killed with signal 11 (could be triggered by violating memory limits)
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Runtime error 0 ms 1844 KB Execution killed with signal 11 (could be triggered by violating memory limits)
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Runtime error 0 ms 1844 KB Execution killed with signal 11 (could be triggered by violating memory limits)
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Runtime error 0 ms 1844 KB Execution killed with signal 11 (could be triggered by violating memory limits)
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Runtime error 0 ms 1844 KB Execution killed with signal 11 (could be triggered by violating memory limits)
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Runtime error 0 ms 1844 KB Execution killed with signal 11 (could be triggered by violating memory limits)
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Runtime error 0 ms 1844 KB Execution killed with signal 11 (could be triggered by violating memory limits)
2 Halted 0 ms 0 KB -