Submission #614020

# Submission time Handle Problem Language Result Execution time Memory
614020 2022-07-30T16:48:19 Z MohamedAliSaidane Monochrome Points (JOI20_monochrome) C++14
0 / 100
1 ms 244 KB
#include<bits/stdc++.h>

    using namespace std;

    typedef long long ll;

    typedef pair<int,int> pii;
    typedef pair<ll,ll> pll;

    typedef vector<int> vi;
    typedef vector<ll> vll;
    typedef vector<pii> vpi;
    typedef vector<pll> vpl;

    #define pb push_back
    #define popb pop_back
    #define all(x) (x).begin(), (x).end()


    #define ff first
    #define ss second

    const int nax = 4e5 + 4;
    int n;
    int col[nax];

    int32_t main()
    {
        ios::sync_with_stdio(false);
        cin.tie(0); cout.tie(0);
        cin >> n;
        vi perm, ot;
        for(int i  = 0 ; i < 2 * n ; i++)
        {
            char c; cin >> c;
            if(c == 'B')
                col[i] = 1;
            if(col[i])
                perm.pb(i);
            else
                ot.pb(i);
        }
        int ans = 0 ;
        for(int shift = max(0,(n - 3)/2); shift <= min(n -1,(n + 3)/2); shift ++ )
        {
            vpi inter;
            int rep  = 0 ;
            for(int i = 0 ; i < n; i++)
                inter.pb({min(ot[i], perm[(i+shift)%n]), max(ot[i], perm[(i+shift)%n])});
            for(int i  =  0 ; i < n - 1;i ++)
            {
                for(int j=  i + 1; j < n; j ++)
                {
                    int a = inter[i].ff;
                    int b = inter[i].ss;
                    int c = inter[j].ff;
                    int d=  inter[j].ss;
                    if(c < a && b < d)
                        continue;
                    if(a < c && d < b)
                        continue;
                    if(d < a)
                        continue;
                    if(b < c)
                        continue;
                    rep ++;
                }
            }
            ans = max(ans, rep);
            //cout << shift << ' ' << n - shift << ' ' << rep  << '\n';
        }
        cout << ans;
    }
# Verdict Execution time Memory Grader output
1 Correct 1 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 244 KB Output is correct
5 Correct 0 ms 212 KB Output is correct
6 Correct 1 ms 212 KB Output is correct
7 Correct 0 ms 212 KB Output is correct
8 Correct 0 ms 212 KB Output is correct
9 Correct 0 ms 212 KB Output is correct
10 Correct 0 ms 212 KB Output is correct
11 Incorrect 0 ms 212 KB Output isn't correct
12 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 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 244 KB Output is correct
5 Correct 0 ms 212 KB Output is correct
6 Correct 1 ms 212 KB Output is correct
7 Correct 0 ms 212 KB Output is correct
8 Correct 0 ms 212 KB Output is correct
9 Correct 0 ms 212 KB Output is correct
10 Correct 0 ms 212 KB Output is correct
11 Incorrect 0 ms 212 KB Output isn't correct
12 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 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 244 KB Output is correct
5 Correct 0 ms 212 KB Output is correct
6 Correct 1 ms 212 KB Output is correct
7 Correct 0 ms 212 KB Output is correct
8 Correct 0 ms 212 KB Output is correct
9 Correct 0 ms 212 KB Output is correct
10 Correct 0 ms 212 KB Output is correct
11 Incorrect 0 ms 212 KB Output isn't correct
12 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 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 244 KB Output is correct
5 Correct 0 ms 212 KB Output is correct
6 Correct 1 ms 212 KB Output is correct
7 Correct 0 ms 212 KB Output is correct
8 Correct 0 ms 212 KB Output is correct
9 Correct 0 ms 212 KB Output is correct
10 Correct 0 ms 212 KB Output is correct
11 Incorrect 0 ms 212 KB Output isn't correct
12 Halted 0 ms 0 KB -