# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
516344 | qwerasdfzxcl | Monochrome Points (JOI20_monochrome) | C++14 | 1 ms | 296 KiB |
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#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;
}
컴파일 시 표준 에러 (stderr) 메시지
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |