제출 #849755

#제출 시각아이디문제언어결과실행 시간메모리
849755AbitoMonochrome Points (JOI20_monochrome)C++17
4 / 100
2027 ms348 KiB
#include <bits/stdc++.h> #define F first #define S second #define pb push_back #define ppb pop_back #define ep insert #define endl '\n' #define elif else if #define pow pwr #define sqrt sqrtt #define int long long #define y1 YONE typedef unsigned long long ull; using namespace std; int n; int32_t main(){ ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL); vector<int> a,b; cin>>n; for (int i=0;i<2*n;i++){ char c;cin>>c; if (c=='W') a.pb(i); else b.pb(i); }int ans=0; do{ int x=0; for (int i=0;i<n;i++){ for (int j=i+1;j<n;j++){ int x1=b[i],y1=a[i],x2=b[j],y2=a[j]; if (x1>y1) swap(x1,y1); if (x2>y2) swap(x2,y2); x+=(bool(x2<y1 && x2>x1)+bool(y2<y1 && y2>x1))%2; } }ans=max(ans,x); }while (next_permutation(a.begin(),a.end())); cout<<ans<<endl; 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...