carnival.java:1: error: illegal character: '#'
#include<bits/stdc++.h>
^
carnival.java:1: error: class, interface, or enum expected
#include<bits/stdc++.h>
^
carnival.java:3: error: class, interface, or enum expected
int ask(int l, int r) {
^
carnival.java:5: error: class, interface, or enum expected
cout<<"? "<<l<<" "<<r<<endl;
^
carnival.java:6: error: class, interface, or enum expected
int x;
^
carnival.java:7: error: class, interface, or enum expected
cin>>x;
^
carnival.java:8: error: class, interface, or enum expected
return x;
^
carnival.java:9: error: class, interface, or enum expected
}
^
carnival.java:14: error: class, interface, or enum expected
cin>>n;
^
carnival.java:15: error: class, interface, or enum expected
int smax=ask(1,n);
^
carnival.java:16: error: class, interface, or enum expected
int l,r;
^
carnival.java:17: error: class, interface, or enum expected
if(smax==n||ask(1,smax)==smax) {
^
carnival.java:18: error: class, interface, or enum expected
l=1; r=smax;
^
carnival.java:19: error: class, interface, or enum expected
while(l<r-1) {
^
carnival.java:21: error: class, interface, or enum expected
if(ask(m,smax)==smax) {
^
carnival.java:23: error: class, interface, or enum expected
}
^
carnival.java:25: error: class, interface, or enum expected
}
^
carnival.java:27: error: class, interface, or enum expected
}
^
carnival.java:30: error: class, interface, or enum expected
while(l<r-1) {
^
carnival.java:32: error: class, interface, or enum expected
if(ask(smax,m)==smax) {
^
carnival.java:34: error: class, interface, or enum expected
}
^
carnival.java:36: error: class, interface, or enum expected
}
^
carnival.java:38: error: class, interface, or enum expected
}
^
23 errors