답안 #614013

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
614013 2022-07-30T16:35:44 Z MohamedAliSaidane Monochrome Points (JOI20_monochrome) C++14
4 / 100
2000 ms 340 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 ;
        do
        {
            vpi inter;
            int rep  = 0 ;
            for(int i = 0 ; i < n; i++)
                inter.pb({min(ot[i], perm[i]), max(ot[i], perm[i])});
            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);


        }while(next_permutation(all(perm)));

        cout << ans;
    }
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 212 KB Output is correct
2 Correct 1 ms 212 KB Output is correct
3 Correct 0 ms 212 KB Output is correct
4 Correct 1 ms 212 KB Output is correct
5 Correct 1 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 1 ms 212 KB Output is correct
9 Correct 10 ms 324 KB Output is correct
10 Correct 9 ms 328 KB Output is correct
11 Correct 9 ms 212 KB Output is correct
12 Correct 10 ms 212 KB Output is correct
13 Correct 11 ms 212 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 212 KB Output is correct
2 Correct 1 ms 212 KB Output is correct
3 Correct 0 ms 212 KB Output is correct
4 Correct 1 ms 212 KB Output is correct
5 Correct 1 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 1 ms 212 KB Output is correct
9 Correct 10 ms 324 KB Output is correct
10 Correct 9 ms 328 KB Output is correct
11 Correct 9 ms 212 KB Output is correct
12 Correct 10 ms 212 KB Output is correct
13 Correct 11 ms 212 KB Output is correct
14 Execution timed out 2076 ms 340 KB Time limit exceeded
15 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 212 KB Output is correct
2 Correct 1 ms 212 KB Output is correct
3 Correct 0 ms 212 KB Output is correct
4 Correct 1 ms 212 KB Output is correct
5 Correct 1 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 1 ms 212 KB Output is correct
9 Correct 10 ms 324 KB Output is correct
10 Correct 9 ms 328 KB Output is correct
11 Correct 9 ms 212 KB Output is correct
12 Correct 10 ms 212 KB Output is correct
13 Correct 11 ms 212 KB Output is correct
14 Execution timed out 2076 ms 340 KB Time limit exceeded
15 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 212 KB Output is correct
2 Correct 1 ms 212 KB Output is correct
3 Correct 0 ms 212 KB Output is correct
4 Correct 1 ms 212 KB Output is correct
5 Correct 1 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 1 ms 212 KB Output is correct
9 Correct 10 ms 324 KB Output is correct
10 Correct 9 ms 328 KB Output is correct
11 Correct 9 ms 212 KB Output is correct
12 Correct 10 ms 212 KB Output is correct
13 Correct 11 ms 212 KB Output is correct
14 Execution timed out 2076 ms 340 KB Time limit exceeded
15 Halted 0 ms 0 KB -