Submission #1039880

#TimeUsernameProblemLanguageResultExecution timeMemory
1039880AndreyMonochrome Points (JOI20_monochrome)C++14
25 / 100
2059 ms600 KiB
#include<bits/stdc++.h> using namespace std; int main() { ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL); int n; cin >> n; string s; cin >> s; vector<int> p(0); vector<int> q(0); for(int i = 0; i < 2*n; i++) { if(s[i] == 'B') { p.push_back(i); } else { q.push_back(i); } } int ans = 0; for(int i = 0; i < n; i++) { int br = 0; for(int j = 0; j < n; j++) { for(int k = j+1; k < n; k++) { int a = p[j],b = q[j],c = p[k],d = q[k]; if(c > d) { swap(c,d); } if(a > b) { swap(a,b); } if(c < a) { swap(a,c); swap(b,d); } if(c > a && c < b && d > b) { br++; } } } ans = max(ans,br); for(int j = 0; j < n-1; j++) { swap(q[j],q[j+1]); } } cout << ans; return 0; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...