Submission #683929

# Submission time Handle Problem Language Result Execution time Memory
683929 2023-01-19T16:46:59 Z victor_gao Monochrome Points (JOI20_monochrome) C++17
0 / 100
456 ms 308 KB
//#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[10];
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 time Memory Grader output
1 Correct 0 ms 212 KB Output is correct
2 Correct 0 ms 212 KB Output is correct
3 Correct 0 ms 212 KB Output is correct
4 Correct 0 ms 212 KB Output is correct
5 Correct 0 ms 212 KB Output is correct
6 Correct 1 ms 212 KB Output is correct
7 Correct 2 ms 212 KB Output is correct
8 Correct 2 ms 212 KB Output is correct
9 Incorrect 456 ms 308 KB Output isn't correct
10 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 0 ms 212 KB Output is correct
2 Correct 0 ms 212 KB Output is correct
3 Correct 0 ms 212 KB Output is correct
4 Correct 0 ms 212 KB Output is correct
5 Correct 0 ms 212 KB Output is correct
6 Correct 1 ms 212 KB Output is correct
7 Correct 2 ms 212 KB Output is correct
8 Correct 2 ms 212 KB Output is correct
9 Incorrect 456 ms 308 KB Output isn't correct
10 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 0 ms 212 KB Output is correct
2 Correct 0 ms 212 KB Output is correct
3 Correct 0 ms 212 KB Output is correct
4 Correct 0 ms 212 KB Output is correct
5 Correct 0 ms 212 KB Output is correct
6 Correct 1 ms 212 KB Output is correct
7 Correct 2 ms 212 KB Output is correct
8 Correct 2 ms 212 KB Output is correct
9 Incorrect 456 ms 308 KB Output isn't correct
10 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 0 ms 212 KB Output is correct
2 Correct 0 ms 212 KB Output is correct
3 Correct 0 ms 212 KB Output is correct
4 Correct 0 ms 212 KB Output is correct
5 Correct 0 ms 212 KB Output is correct
6 Correct 1 ms 212 KB Output is correct
7 Correct 2 ms 212 KB Output is correct
8 Correct 2 ms 212 KB Output is correct
9 Incorrect 456 ms 308 KB Output isn't correct
10 Halted 0 ms 0 KB -