답안 #413297

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
413297 2021-05-28T13:01:45 Z Ruxandra985 Colors (BOI20_colors) C++14
0 / 100
1 ms 200 KB
#include <bits/stdc++.h>

using namespace std;

int main()
{
    //FILE *fin = fopen ("a.in" , "r");

    long long n , c , now , x , sol = 0 , eq , p2 , st , dr , mid , dir;

    //fscanf (fin,"%lld%lld",&n,&c);
    cin >> n;

    cout << "? 1" << endl;
    cin >> x;

    now = 1;

    st = 1;
    dr = n - 1;
    dir = 0;

    while (st <= dr){
        mid = (st + dr)/2;

        now += mid;
        cout << "? " << now << endl;
        cin >> x;

        now = 1;
        cout << "? 1" << endl;
        cin >> x;

        if (x)
            dr = mid - 1;
        else st = mid + 1;

    }

    cout << "= " << st << endl;

    /*
    eq = -1;
    sol = n;
    for (p2 = 62 ; p2 >= 0 ; p2--){

        if ((1LL << p2) <= n){

            /// vezi daca merge p2, daca merge add la C, altfel nu

            if (now + sol - (1LL << p2) <= n){

                cout << "? " << now + sol - (1LL << p2);
                cin >> x;
                cout << endl;

                now = now + sol - (1LL << p2);

                if (x)
                    sol -= (1LL << p2);

            }
            else if (now - sol + (1LL << p2) > 0){

                cout << "? " << now - sol + (1LL << p2);
                cin >> x;
                cout << endl;

                now = now - sol + (1LL << p2);

                if (x)
                    sol -= (1LL << p2);

            }
            else cout << "nu";


        }


    }



    cout << "= " << sol - 1 << endl;*/

    return 0;
}

Compilation message

Colors.cpp: In function 'int main()':
Colors.cpp:9:19: warning: unused variable 'c' [-Wunused-variable]
    9 |     long long n , c , now , x , sol = 0 , eq , p2 , st , dr , mid , dir;
      |                   ^
Colors.cpp:9:33: warning: unused variable 'sol' [-Wunused-variable]
    9 |     long long n , c , now , x , sol = 0 , eq , p2 , st , dr , mid , dir;
      |                                 ^~~
Colors.cpp:9:43: warning: unused variable 'eq' [-Wunused-variable]
    9 |     long long n , c , now , x , sol = 0 , eq , p2 , st , dr , mid , dir;
      |                                           ^~
Colors.cpp:9:48: warning: unused variable 'p2' [-Wunused-variable]
    9 |     long long n , c , now , x , sol = 0 , eq , p2 , st , dr , mid , dir;
      |                                                ^~
Colors.cpp:9:69: warning: variable 'dir' set but not used [-Wunused-but-set-variable]
    9 |     long long n , c , now , x , sol = 0 , eq , p2 , st , dr , mid , dir;
      |                                                                     ^~~
# 결과 실행 시간 메모리 Grader output
1 Incorrect 1 ms 200 KB Hair color 1 was used multiple times
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 1 ms 200 KB Hair color 1 was used multiple times
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 1 ms 200 KB Hair color 1 was used multiple times
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 1 ms 200 KB Hair color 1 was used multiple times
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 1 ms 200 KB Hair color 1 was used multiple times
2 Halted 0 ms 0 KB -