# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
1031812 | 2024-07-23T07:35:32 Z | 김은성(#10960) | Monochrome Points (JOI20_monochrome) | C++17 | 1 ms | 444 KB |
#include <bits/stdc++.h> using namespace std; char s[400009]; int main(){ int n, i; scanf("%d", &n); scanf(" %s", s); vector<int> b, w; for(i=0; i<2*n; i++){ if(s[i] == 'B') b.push_back(i); else w.push_back(i); } int cnt = 0; for(i=0; i<2*n; i++){ if(s[i] == 'B'){ int mn = n; for(int j=0; j<2*n; j++){ if(s[j] == 'W') mn = min(mn , n - min((j-i+6*n)%(2*n), 2*n - (j-i+6*n)%(2*n))); } // printf("i=%d mn=%d\n", i, mn); cnt += mn; } } printf("%d\n", n*(n-1)/2 - cnt/2); return 0; int ans = 0; do{ int cnt = 0; for(i=0; i<n; i++){ cnt += n - min((w[i]-b[i]+6*n)%(2*n), 2*n - (w[i]-b[i]+6*n)%(2*n)); } ans = max(ans, n*(n-1)/2 - cnt/2); } while(next_permutation(w.begin(), w.end())); printf("%d\n", ans); return 0; }
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 348 KB | Output is correct |
2 | Correct | 0 ms | 348 KB | Output is correct |
3 | Correct | 0 ms | 348 KB | Output is correct |
4 | Correct | 1 ms | 444 KB | Output is correct |
5 | Correct | 0 ms | 348 KB | Output is correct |
6 | Correct | 1 ms | 444 KB | Output is correct |
7 | Correct | 0 ms | 348 KB | Output is correct |
8 | Incorrect | 0 ms | 444 KB | Output isn't correct |
9 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 348 KB | Output is correct |
2 | Correct | 0 ms | 348 KB | Output is correct |
3 | Correct | 0 ms | 348 KB | Output is correct |
4 | Correct | 1 ms | 444 KB | Output is correct |
5 | Correct | 0 ms | 348 KB | Output is correct |
6 | Correct | 1 ms | 444 KB | Output is correct |
7 | Correct | 0 ms | 348 KB | Output is correct |
8 | Incorrect | 0 ms | 444 KB | Output isn't correct |
9 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 348 KB | Output is correct |
2 | Correct | 0 ms | 348 KB | Output is correct |
3 | Correct | 0 ms | 348 KB | Output is correct |
4 | Correct | 1 ms | 444 KB | Output is correct |
5 | Correct | 0 ms | 348 KB | Output is correct |
6 | Correct | 1 ms | 444 KB | Output is correct |
7 | Correct | 0 ms | 348 KB | Output is correct |
8 | Incorrect | 0 ms | 444 KB | Output isn't correct |
9 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 348 KB | Output is correct |
2 | Correct | 0 ms | 348 KB | Output is correct |
3 | Correct | 0 ms | 348 KB | Output is correct |
4 | Correct | 1 ms | 444 KB | Output is correct |
5 | Correct | 0 ms | 348 KB | Output is correct |
6 | Correct | 1 ms | 444 KB | Output is correct |
7 | Correct | 0 ms | 348 KB | Output is correct |
8 | Incorrect | 0 ms | 444 KB | Output isn't correct |
9 | Halted | 0 ms | 0 KB | - |