답안 #683930

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
683930 2023-01-19T16:48:45 Z victor_gao Monochrome Points (JOI20_monochrome) C++17
4 / 100
12 ms 1236 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[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';
}
# 결과 실행 시간 메모리 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 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 2 ms 212 KB Output is correct
9 Correct 10 ms 212 KB Output is correct
10 Correct 10 ms 212 KB Output is correct
11 Correct 9 ms 212 KB Output is correct
12 Correct 8 ms 316 KB Output is correct
13 Correct 12 ms 324 KB Output is correct
# 결과 실행 시간 메모리 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 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 2 ms 212 KB Output is correct
9 Correct 10 ms 212 KB Output is correct
10 Correct 10 ms 212 KB Output is correct
11 Correct 9 ms 212 KB Output is correct
12 Correct 8 ms 316 KB Output is correct
13 Correct 12 ms 324 KB Output is correct
14 Runtime error 2 ms 1236 KB Execution killed with signal 11
15 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 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 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 2 ms 212 KB Output is correct
9 Correct 10 ms 212 KB Output is correct
10 Correct 10 ms 212 KB Output is correct
11 Correct 9 ms 212 KB Output is correct
12 Correct 8 ms 316 KB Output is correct
13 Correct 12 ms 324 KB Output is correct
14 Runtime error 2 ms 1236 KB Execution killed with signal 11
15 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 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 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 2 ms 212 KB Output is correct
9 Correct 10 ms 212 KB Output is correct
10 Correct 10 ms 212 KB Output is correct
11 Correct 9 ms 212 KB Output is correct
12 Correct 8 ms 316 KB Output is correct
13 Correct 12 ms 324 KB Output is correct
14 Runtime error 2 ms 1236 KB Execution killed with signal 11
15 Halted 0 ms 0 KB -