Submission #614016

# Submission time Handle Problem Language Result Execution time Memory
614016 2022-07-30T16:42:13 Z MohamedAliSaidane Monochrome Points (JOI20_monochrome) C++14
25 / 100
2000 ms 348 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 = 0 ; shift < n ; 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 << ans;
    }
# 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 1 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 0 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 1 ms 212 KB Output is correct
10 Correct 0 ms 212 KB Output is correct
11 Correct 0 ms 212 KB Output is correct
12 Correct 0 ms 212 KB Output is correct
13 Correct 0 ms 212 KB Output is correct
# 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 1 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 0 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 1 ms 212 KB Output is correct
10 Correct 0 ms 212 KB Output is correct
11 Correct 0 ms 212 KB Output is correct
12 Correct 0 ms 212 KB Output is correct
13 Correct 0 ms 212 KB Output is correct
14 Correct 25 ms 340 KB Output is correct
15 Correct 25 ms 344 KB Output is correct
16 Correct 32 ms 340 KB Output is correct
17 Correct 24 ms 348 KB Output is correct
18 Correct 24 ms 212 KB Output is correct
19 Correct 20 ms 336 KB Output is correct
20 Correct 21 ms 340 KB Output is correct
21 Correct 17 ms 340 KB Output is correct
22 Correct 18 ms 336 KB Output is correct
23 Correct 7 ms 332 KB Output is correct
24 Correct 15 ms 344 KB Output is correct
25 Correct 15 ms 336 KB Output is correct
26 Correct 19 ms 336 KB Output is correct
27 Correct 20 ms 340 KB Output is correct
28 Correct 22 ms 340 KB Output is correct
29 Correct 19 ms 340 KB Output is correct
30 Correct 18 ms 344 KB Output is correct
31 Correct 21 ms 336 KB Output is correct
32 Correct 25 ms 212 KB Output is correct
33 Correct 24 ms 344 KB Output is correct
# 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 1 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 0 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 1 ms 212 KB Output is correct
10 Correct 0 ms 212 KB Output is correct
11 Correct 0 ms 212 KB Output is correct
12 Correct 0 ms 212 KB Output is correct
13 Correct 0 ms 212 KB Output is correct
14 Correct 25 ms 340 KB Output is correct
15 Correct 25 ms 344 KB Output is correct
16 Correct 32 ms 340 KB Output is correct
17 Correct 24 ms 348 KB Output is correct
18 Correct 24 ms 212 KB Output is correct
19 Correct 20 ms 336 KB Output is correct
20 Correct 21 ms 340 KB Output is correct
21 Correct 17 ms 340 KB Output is correct
22 Correct 18 ms 336 KB Output is correct
23 Correct 7 ms 332 KB Output is correct
24 Correct 15 ms 344 KB Output is correct
25 Correct 15 ms 336 KB Output is correct
26 Correct 19 ms 336 KB Output is correct
27 Correct 20 ms 340 KB Output is correct
28 Correct 22 ms 340 KB Output is correct
29 Correct 19 ms 340 KB Output is correct
30 Correct 18 ms 344 KB Output is correct
31 Correct 21 ms 336 KB Output is correct
32 Correct 25 ms 212 KB Output is correct
33 Correct 24 ms 344 KB Output is correct
34 Execution timed out 2072 ms 340 KB Time limit exceeded
35 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 1 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 0 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 1 ms 212 KB Output is correct
10 Correct 0 ms 212 KB Output is correct
11 Correct 0 ms 212 KB Output is correct
12 Correct 0 ms 212 KB Output is correct
13 Correct 0 ms 212 KB Output is correct
14 Correct 25 ms 340 KB Output is correct
15 Correct 25 ms 344 KB Output is correct
16 Correct 32 ms 340 KB Output is correct
17 Correct 24 ms 348 KB Output is correct
18 Correct 24 ms 212 KB Output is correct
19 Correct 20 ms 336 KB Output is correct
20 Correct 21 ms 340 KB Output is correct
21 Correct 17 ms 340 KB Output is correct
22 Correct 18 ms 336 KB Output is correct
23 Correct 7 ms 332 KB Output is correct
24 Correct 15 ms 344 KB Output is correct
25 Correct 15 ms 336 KB Output is correct
26 Correct 19 ms 336 KB Output is correct
27 Correct 20 ms 340 KB Output is correct
28 Correct 22 ms 340 KB Output is correct
29 Correct 19 ms 340 KB Output is correct
30 Correct 18 ms 344 KB Output is correct
31 Correct 21 ms 336 KB Output is correct
32 Correct 25 ms 212 KB Output is correct
33 Correct 24 ms 344 KB Output is correct
34 Execution timed out 2072 ms 340 KB Time limit exceeded
35 Halted 0 ms 0 KB -