Submission #516344

# Submission time Handle Problem Language Result Execution time Memory
516344 2022-01-21T07:07:45 Z qwerasdfzxcl Monochrome Points (JOI20_monochrome) C++14
0 / 100
1 ms 296 KB
#include <bits/stdc++.h>

typedef long long ll;
using namespace std;
const ll INF = 1e18;
char a[5050];
vector<pair<int, int>> E;

int main(){
    int n;
    scanf("%d", &n);
    scanf("%s", a+1);
    n *= 2;

    int ans = (n/2) * (n/2-1);
    for (int i=1;i<=n;i++) if (a[i]=='B'){
        int idx = -1, mx = -1;
        for (int j=1;j<=n;j++) if (a[j]=='W'){
            int val = min((n+j-i)%n, (n+i-j)%n);
            if (mx<val) idx = j, mx = val;
        }
        ans -= (n/2 - mx);
        E.emplace_back(i, idx);
        if (i>idx) swap(E.back().first, E.back().second);
        //a[idx] = 0;
    }

    printf("%d\n", ans/2);
    return 0;
}

Compilation message

monochrome.cpp: In function 'int main()':
monochrome.cpp:11:10: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
   11 |     scanf("%d", &n);
      |     ~~~~~^~~~~~~~~~
monochrome.cpp:12:10: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
   12 |     scanf("%s", a+1);
      |     ~~~~~^~~~~~~~~~~
# Verdict Execution time Memory Grader output
1 Correct 1 ms 204 KB Output is correct
2 Correct 1 ms 296 KB Output is correct
3 Correct 0 ms 296 KB Output is correct
4 Correct 0 ms 204 KB Output is correct
5 Correct 0 ms 204 KB Output is correct
6 Correct 1 ms 204 KB Output is correct
7 Correct 0 ms 204 KB Output is correct
8 Incorrect 1 ms 204 KB Output isn't correct
9 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 204 KB Output is correct
2 Correct 1 ms 296 KB Output is correct
3 Correct 0 ms 296 KB Output is correct
4 Correct 0 ms 204 KB Output is correct
5 Correct 0 ms 204 KB Output is correct
6 Correct 1 ms 204 KB Output is correct
7 Correct 0 ms 204 KB Output is correct
8 Incorrect 1 ms 204 KB Output isn't correct
9 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 204 KB Output is correct
2 Correct 1 ms 296 KB Output is correct
3 Correct 0 ms 296 KB Output is correct
4 Correct 0 ms 204 KB Output is correct
5 Correct 0 ms 204 KB Output is correct
6 Correct 1 ms 204 KB Output is correct
7 Correct 0 ms 204 KB Output is correct
8 Incorrect 1 ms 204 KB Output isn't correct
9 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 204 KB Output is correct
2 Correct 1 ms 296 KB Output is correct
3 Correct 0 ms 296 KB Output is correct
4 Correct 0 ms 204 KB Output is correct
5 Correct 0 ms 204 KB Output is correct
6 Correct 1 ms 204 KB Output is correct
7 Correct 0 ms 204 KB Output is correct
8 Incorrect 1 ms 204 KB Output isn't correct
9 Halted 0 ms 0 KB -