Submission #750000

#TimeUsernameProblemLanguageResultExecution timeMemory
750000vjudge1Carnival (CEOI14_carnival)Java
Compilation error
0 ms0 KiB
//#pragma GCC optimize("Ofast,unroll-loops") //#pragma GCC target("avx2,popcnt,lzcnt,abm,bmi,bmi2,fma,tune=native") //#pragma expected_value //#pragma isolated_call //#pragma disjoint #include <bits/stdc++.h> using namespace std; #define ll long long #define ull unsigned long long #define ld long double #define pb push_back #define setpre(i) setprecision(i)<<fixed #define foru(i, a, b) for(int i=a;i<=b;i++) #define ford(i, a, b) for(int i=a;i>=b;i--) #define mp make_pair #define moo cout<<"moo " #define fi first #define se second ll lmod = 1e9 + 7; typedef vector<int> vi; typedef vector< vector<int> > vvi; typedef pair<int, int> ii; typedef pair<double, double> dd; int main(){ // freopen("input.inp", "r", stdin); // freopen("output.out", "w", stdout); ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0); int n; cin >> n; cout << "? 1 " << n << endl; int pos, x; cin >> pos; bool left; if(pos != 1){ cout << "? 1 " << pos << endl; cin >> x; left = (x == pos); } else left = false; if(left){ int l = 1, r = pos - 1; while(l < r){ int mid = (l + r + 1) / 2; cout << "? " << mid << " " << pos << endl; cin >> x; if(x != pos) r = mid - 1; else l = mid; } cout << "! " << l << endl; } else{ int l = pos + 1, r = n; while(l < r){ int mid = (l + r) / 2; cout << "? " << pos << " " << mid << endl; cin >> x; if(x != pos) l = mid + 1; else r = mid; } cout << "! " << l << endl; } // fclose(stdout); }

Compilation message (stderr)

carnival.java:7: error: illegal character: '#'
#include <bits/stdc++.h>
^
carnival.java:7: error: class, interface, or enum expected
#include <bits/stdc++.h>
         ^
carnival.java:10: error: illegal character: '#'
#define ll long long
^
carnival.java:10: error: class, interface, or enum expected
#define ll long long
        ^
carnival.java:11: error: illegal character: '#'
#define ull unsigned long long
^
carnival.java:12: error: illegal character: '#'
#define ld long double
^
carnival.java:13: error: illegal character: '#'
#define pb push_back
^
carnival.java:14: error: illegal character: '#'
#define setpre(i) setprecision(i)<<fixed
^
carnival.java:15: error: illegal character: '#'
#define foru(i, a, b) for(int i=a;i<=b;i++)
^
carnival.java:15: error: class, interface, or enum expected
#define foru(i, a, b) for(int i=a;i<=b;i++)
                                  ^
carnival.java:15: error: class, interface, or enum expected
#define foru(i, a, b) for(int i=a;i<=b;i++)
                                       ^
carnival.java:16: error: illegal character: '#'
#define ford(i, a, b) for(int i=a;i>=b;i--)
^
carnival.java:16: error: class, interface, or enum expected
#define ford(i, a, b) for(int i=a;i>=b;i--)
                                  ^
carnival.java:16: error: class, interface, or enum expected
#define ford(i, a, b) for(int i=a;i>=b;i--)
                                       ^
carnival.java:17: error: illegal character: '#'
#define mp make_pair
^
carnival.java:18: error: illegal character: '#'
#define moo cout<<"moo "
^
carnival.java:19: error: illegal character: '#'
#define fi first
^
carnival.java:20: error: illegal character: '#'
#define se second
^
carnival.java:23: error: class, interface, or enum expected
typedef vector<int> vi;
^
carnival.java:24: error: class, interface, or enum expected
typedef vector< vector<int> > vvi;
^
carnival.java:25: error: class, interface, or enum expected
typedef pair<int, int> ii;
^
carnival.java:26: error: class, interface, or enum expected
typedef pair<double, double> dd;
^
carnival.java:28: error: class, interface, or enum expected
int main(){
^
carnival.java:31: error: class, interface, or enum expected
    ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
                                  ^
carnival.java:31: error: class, interface, or enum expected
    ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
                                              ^
carnival.java:32: error: class, interface, or enum expected
    int n; cin >> n;
    ^
carnival.java:32: error: class, interface, or enum expected
    int n; cin >> n;
           ^
carnival.java:33: error: class, interface, or enum expected
    cout << "? 1 " << n << endl;
    ^
carnival.java:34: error: class, interface, or enum expected
    int pos, x; cin >> pos;
    ^
carnival.java:34: error: class, interface, or enum expected
    int pos, x; cin >> pos;
                ^
carnival.java:35: error: class, interface, or enum expected
    bool left;
    ^
carnival.java:36: error: class, interface, or enum expected
    if(pos != 1){
    ^
carnival.java:38: error: class, interface, or enum expected
        cin >> x;   
        ^
carnival.java:39: error: class, interface, or enum expected
        left = (x == pos); 
        ^
carnival.java:40: error: class, interface, or enum expected
    }
    ^
carnival.java:42: error: class, interface, or enum expected
    if(left){
    ^
carnival.java:44: error: class, interface, or enum expected
        while(l < r){
        ^
carnival.java:46: error: class, interface, or enum expected
            cout << "? " << mid << " " << pos << endl;
            ^
carnival.java:47: error: class, interface, or enum expected
            cin >> x;
            ^
carnival.java:49: error: class, interface, or enum expected
            if(x != pos) r = mid - 1;
            ^
carnival.java:50: error: class, interface, or enum expected
            else l = mid;
            ^
carnival.java:51: error: class, interface, or enum expected
        }
        ^
carnival.java:53: error: class, interface, or enum expected
    }
    ^
carnival.java:56: error: class, interface, or enum expected
        while(l < r){
        ^
carnival.java:58: error: class, interface, or enum expected
            cout << "? " << pos << " " << mid << endl;
            ^
carnival.java:59: error: class, interface, or enum expected
            cin >> x;
            ^
carnival.java:60: error: class, interface, or enum expected
            if(x != pos) l = mid + 1;
            ^
carnival.java:61: error: class, interface, or enum expected
            else r = mid;
            ^
carnival.java:62: error: class, interface, or enum expected
        }
        ^
carnival.java:64: error: class, interface, or enum expected
    }
    ^
50 errors