Submission #29239

# Submission time Handle Problem Language Result Execution time Memory
29239 2017-07-18T19:56:54 Z samir_droubi Nizovi (COI14_nizovi) C++14
0 / 100
0 ms 5928 KB
#include <bits/stdc++.h>
using namespace std;
int n,N;
const int mxn=(1e6)+(1e3)+5;
int id[mxn];
int bs(int i,int j)
{
    int in=-1;
    int l=j;
    int r=n+N;
    while(l<=r)
    {
        int md=(l+r)/2;
        printf("cmp %d %d\n",md,i);
        int x;
        scanf("%d",&x);
        if(x<=0)
        {
            in=md;
            l=md+1;
        }
        else
            r=md-1;
    }
    return in;
}
int main()
{
    scanf("%d%d",&n,&N);
    int c=n;
    int in=1;
    while(c)
    {
        int x = bs( in, in + c );
        if(x==-1)
        {
            --c;
            ++in;
            continue;
        }
        printf("reverse %d %d\n", in, x);
        printf("reverse %d %d\n", in, x - c );
        printf("reverse %d %d\n", x - c + 1, x);
        in = x - c + 1;
    }
    puts("end");
}

Compilation message

nizovi.cpp: In function 'int bs(int, int)':
nizovi.cpp:16:23: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
         scanf("%d",&x);
                       ^
nizovi.cpp: In function 'int main()':
nizovi.cpp:29:24: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
     scanf("%d%d",&n,&N);
                        ^
# Verdict Execution time Memory Grader output
1 Runtime error 0 ms 5928 KB Execution timed out (wall clock limit exceeded)
2 Runtime error 0 ms 5928 KB Execution timed out (wall clock limit exceeded)
3 Runtime error 0 ms 5928 KB Execution timed out (wall clock limit exceeded)
4 Runtime error 0 ms 5928 KB Execution timed out (wall clock limit exceeded)
5 Runtime error 0 ms 5928 KB Execution timed out (wall clock limit exceeded)
6 Runtime error 0 ms 5928 KB Execution timed out (wall clock limit exceeded)
7 Runtime error 0 ms 5928 KB Execution timed out (wall clock limit exceeded)
8 Runtime error 0 ms 5928 KB Execution timed out (wall clock limit exceeded)
9 Runtime error 0 ms 5928 KB Execution timed out (wall clock limit exceeded)
10 Runtime error 0 ms 5928 KB Execution timed out (wall clock limit exceeded)