답안 #580700

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
580700 2022-06-21T17:00:04 Z groshi Nizovi (COI14_nizovi) C++17
60 / 100
202 ms 280 KB
#include<iostream>

using namespace std;

int main()
{
    //cin.tie(0);
    //cout.tie(0);
    //ios_base::sync_with_stdio(0);
    int a,b;
    cin>>a>>b;
    int pocz_a=1,pocz_b=a+1;
    for(int i=1;i<=a;i++)
    {
        cout<<"cmp "<<pocz_a<<" "<<pocz_b<<"\n";
        cout<<flush;
        int x;
        cin>>x;
        if(x==-1)
        {
            pocz_a++;
            continue;
        }
        int pocz=pocz_b,kon=a+b+1,sre,ostd=0;
        while(pocz<kon)
        {
            sre=(pocz+kon)/2;
            cout<<"cmp "<<pocz_a<<" "<<sre<<"\n";
            cout<<flush;
            int x;
            cin>>x;
            if(x==-1)
                kon=sre;
            else{
                pocz=sre+1;
                ostd=sre;
            }
        }
        if(ostd==0)
        {
            pocz_a++;
            continue;
        }
        if(pocz_a!=ostd)
        {
            //cout<<flush;
            cout<<"reverse "<<pocz_a<<" "<<ostd<<"\n";
            cout<<flush;
        }
        int ile=ostd-pocz_b+1;
        if(pocz_a!=pocz_a+ile-1)
        {
            //cout<<flush;
            cout<<"reverse "<<pocz_a<<" "<<pocz_a+ile-1<<"\n";
            cout<<flush;
        }
        if(pocz_a+ile!=ostd)
        {
            //cout<<flush;
            cout<<"reverse "<<pocz_a+ile<<" "<<ostd<<"\n";
            cout<<flush;
        }
        pocz_a+=ile+1;
        pocz_b+=ile;
    }
    cout<<"end\n";
    cout<<flush;
    return 0;
}
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 208 KB Output is correct
2 Runtime error 3 ms 208 KB Execution killed with signal 13
3 Runtime error 2 ms 208 KB Execution killed with signal 13
4 Correct 22 ms 208 KB Output is correct
5 Runtime error 23 ms 280 KB Execution killed with signal 13
6 Correct 26 ms 208 KB Output is correct
7 Correct 148 ms 208 KB Output is correct
8 Correct 97 ms 208 KB Output is correct
9 Correct 159 ms 208 KB Output is correct
10 Runtime error 202 ms 208 KB Execution killed with signal 13