# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
209743 | 2020-03-15T13:04:00 Z | kapsel | Difference (POI11_roz) | C++14 | 331 ms | 8464 KB |
#include <bits/stdc++.h> using namespace std; #define LL long long #define ULL unsigned long long #define LD long double vector<int> wyst[26]; const int INF = 1e9 + 2137; int main() { ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0); int n; cin>>n; string s; cin>>s; for(int i=0; i<n; i++) { wyst[s[i]-97].push_back(i); } int wynik = 0; for(int a=0; a<26; a++) { for(int b=0; b<26; b++) { vector<int> ciag; int i = 0; int j = 0; int suma = 0; int minimum = INF; int w = 0; int sumap = 0; while(i<wyst[a].size() || j<wyst[b].size()) { int ob; if(i<wyst[a].size() && j<wyst[b].size()) { if(wyst[a][i]<wyst[b][j]) { ob = 1; i++; } else { ob = -1; j++; } } else if(i<wyst[a].size()) { i++; ob = 1; } else { j++; ob = -1; } suma+=ob; if(ob==-1) { minimum = min(minimum, sumap); sumap = suma; } w = max(w, suma-minimum); } wynik = max(wynik, w); } } cout<<wynik; }
Compilation message
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 5 ms | 380 KB | Output is correct |
2 | Correct | 5 ms | 376 KB | Output is correct |
3 | Correct | 5 ms | 376 KB | Output is correct |
4 | Correct | 4 ms | 376 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 5 ms | 376 KB | Output is correct |
2 | Correct | 5 ms | 376 KB | Output is correct |
3 | Correct | 5 ms | 376 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 5 ms | 376 KB | Output is correct |
2 | Correct | 5 ms | 380 KB | Output is correct |
3 | Correct | 5 ms | 376 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 6 ms | 376 KB | Output is correct |
2 | Correct | 5 ms | 376 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 8 ms | 376 KB | Output is correct |
2 | Correct | 5 ms | 376 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 39 ms | 1144 KB | Output is correct |
2 | Correct | 5 ms | 376 KB | Output is correct |
3 | Correct | 6 ms | 504 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 331 ms | 8464 KB | Output is correct |
2 | Correct | 5 ms | 376 KB | Output is correct |
3 | Correct | 191 ms | 6416 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 330 ms | 7956 KB | Output is correct |
2 | Correct | 256 ms | 7080 KB | Output is correct |
3 | Correct | 77 ms | 5908 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 326 ms | 8340 KB | Output is correct |
2 | Correct | 112 ms | 6532 KB | Output is correct |
3 | Correct | 87 ms | 6804 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 327 ms | 8080 KB | Output is correct |
2 | Correct | 100 ms | 7048 KB | Output is correct |
3 | Correct | 90 ms | 6804 KB | Output is correct |