| # | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 | 
|---|---|---|---|---|---|---|---|
| 572603 | groshi | Monochrome Points (JOI20_monochrome) | C++17 | 52 ms | 5764 KiB | 
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include<iostream>
#include<vector>
#include<string>
using namespace std;
#define int long long
vector<int> b,w;
int n;
int wyn(int ile)
{
    int wynik=0;
    for(int i=0;i<b.size();i++)
    {
        int l=b[i];
        int r=w[(i+ile)%n];
        if(l>r)
            swap(l,r);
        int ile1=(r-l-1);
        int ile2=2*n-ile1-2;
        wynik+=min(ile1,ile2);
    }
    return wynik/2;
}
int32_t main()
{
    cin.tie(0);
    cout.tie(0);
    ios_base::sync_with_stdio(0);
    cin>>n;
    string s;
    cin>>s;
    for(int i=0;i<s.length();i++)
        if(s[i]=='B')
            b.push_back(i);
        else w.push_back(i);
    int pocz=0,kon=n,sre,ostd=0;
    while(pocz<kon)
    {
        sre=(pocz+kon)/2;
        if(wyn(sre)<wyn(sre+1))
        {
            ostd=sre+1;
            pocz=sre+1;
        }
        else kon=sre;
    }
    //for(int i=0;i<n;i++)
        //cout<<wyn(i)<<" ";
    cout<<wyn(ostd);
    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... | ||||
