Submission #1033494

#TimeUsernameProblemLanguageResultExecution timeMemory
1033494vjudge1Monochrome Points (JOI20_monochrome)C++17
4 / 100
2075 ms456 KiB
#include<bits/stdc++.h> using namespace std; int inter(int a,int b,int c,int d){ if(a>b)swap(a,b); if(c>d)swap(c,d); if(a<c&&c<b&&b<d) return 1; if(c<a&&a<d&&d<b) return 1; return 0; } int main(){ cin.tie(0)->sync_with_stdio(0); int n; string str; cin>>n>>str; vector<int>blk,wht; for(int i=0;i<2*n;i++) if(str[i]=='B') blk.push_back(i+1); else wht.push_back(i+1); int ans=-1; vector<int>bst; do { int tmp=0; for(int i=0;i<n;i++) for(int j=i+1;j<n;j++) if(inter(blk[i],wht[i],blk[j],wht[j])) tmp++; if(tmp>ans) ans=tmp,bst=wht; }while(next_permutation(wht.begin(),wht.end())); cout<<ans<<'\n'; for(int i=0;i<n;i++); //cerr<<"("<<blk[i]<<','<<bst[i]<<")\n"; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...