Submission #683930

#TimeUsernameProblemLanguageResultExecution timeMemory
683930victor_gaoMonochrome Points (JOI20_monochrome)C++17
4 / 100
12 ms1236 KiB
//#pragma GCC optimize("Ofast,unroll-loops,O3") //#pragma GCC optimize("avx,avx2,sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,fma,tune=native") #include<bits/stdc++.h> //#include<bits/extc++.h> //#pragma pack(1) #define fast ios::sync_with_stdio(0); cin.tie(0); #define int long long #define pii pair<int,int> #define x first #define y second using namespace std; //using namespace __gnu_pbds; mt19937 rng(chrono::steady_clock::now().time_since_epoch().count()); //typedef tree<int, null_type,less_equal<int>, rb_tree_tag,tree_order_statistics_node_update> order_multiset; //typedef tree<int, null_type,less<int>, rb_tree_tag,tree_order_statistics_node_update> order_set; vector<int>W,B; int n; char arr[20]; signed main(){ fast cin>>n; for (int i=1;i<=2*n;i++){ cin>>arr[i]; if (arr[i]=='W') W.push_back(i); else B.push_back(i); } int ans=0; do { vector<pii>all; for (int i=0;i<n;i++) all.push_back({W[i],B[i]}); int tans=0; for (int i=0;i<n;i++){ for (int j=i+1;j<n;j++){ pii a=all[i],b=all[j]; if (a.x>a.y) swap(a.x,a.y); if (b.x>a.x&&b.x<a.y&&(b.y<a.x||b.y>a.y)) tans++; if (b.y>a.x&&b.y<a.y&&(b.x<a.x||b.x>a.y)) tans++; } } ans=max(ans,tans); } while (next_permutation(W.begin(),W.end())); cout<<ans<<'\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...