Submission #345922
Source Code Expand
import java.util.*;
import java.math.*;
import java.io.*;
import static java.lang.Math.*;
import static java.util.Arrays.*;
import static java.util.Collections.*;
public class Main{
// ArrayList<Integer> lis = new ArrayList<Integer>();
// ArrayList<String> lis = new ArrayList<String>();
// PriorityQueue<P> que = new PriorityQueue<P>();
// PriorityQueue<Integer> que = new PriorityQueue<Integer>();
// Stack<Integer> que = new Stack<Integer>();
//HashMap<Long,Long> map = new HashMap<Long,Long>();
// static long sum=0;
// 1000000007 (10^9+7)
static int mod = 1000000007;
//static int mod = 1000000009; ArrayList<Integer> l[]= new ArrayList[n];
// static int dx[]={1,-1,0,0};
//static int dy[]={0,0,1,-1};
// static int dx[]={1,-1,0,0,1,1,-1,-1};
// static int dy[]={0,0,1,-1,1,-1,1,-1};
//static Set<Integer> set = new HashSet<Integer>();
//static ArrayList<Integer> l[];
//static int parent[][],depth[],node,max_log;
// static ArrayList<Integer> nd[]= new ArrayList[2001];
public static void main(String[] args) throws Exception, IOException{
//Scanner sc =new Scanner(System.in);
Reader sc = new Reader(System.in);
//int n=sc.nextInt();//,m=sc.nextInt(),k=sc.nextInt();
//int a=sc.nextInt(),b=sc.nextInt(),c=sc.nextInt();
int n=sc.nextInt();//,k=sc.nextInt(),s=0;
int r=0;
int d[]=new int[n];
d[0]++;
int s=1;
for (int i = 0; i < n-1 ; i++) {int t=-1;
for (int j = 0; j < d.length; j++) {
if(d[j]==0){t=j;break;}
}
if(t<0){ break; }
System.out.println('?'+" "+1+" "+(t+1));
d[t]++;
int v=sc.nextInt();
if( r<v ){ r=v; s=t; }
}
d=new int[n];
d[s]++;
for (int i = 0; i < n-1 ; i++) {int t=-1;
for (int j = 0; j < d.length; j++) {
if(d[j]==0){t=j;break;}
}
if(t<0){ break; }
System.out.println('?'+" "+(s+1)+" "+(t+1));
d[t]++;
int v=sc.nextInt();
if( r<v ){ r=v; }
}
System.out.println(r);
}
/*
static class P implements Comparable<P>{
int id, d; ;
P(int id,int d){
this.id=id;
this.d=d;
}
public int compareTo(P x){
// return (-x.d+d)>=0?1:-1 ; // ascend long
// return -x.d+d ; // ascend
return x.d-d ; //descend
}
}//*/
static void db(Object... os){
System.err.println(Arrays.deepToString(os));
}
static boolean validpos(int x,int y,int r, int c){
return x<r && 0<=x && y<c && 0<=y;
}
static boolean bit(int x,int k){
// weather k-th bit (from right) be one or zero
return ( 0 < ( (x>>k) & 1 ) ) ? true:false;
}
}
class Reader
{
private BufferedReader x;
private StringTokenizer st;
public Reader(InputStream in)
{
x = new BufferedReader(new InputStreamReader(in));
st = null;
}
public String nextString() throws IOException
{
while( st==null || !st.hasMoreTokens() )
st = new StringTokenizer(x.readLine());
return st.nextToken();
}
public int nextInt() throws IOException
{
return Integer.parseInt(nextString());
}
public long nextLong() throws IOException
{
return Long.parseLong(nextString());
}
public double nextDouble() throws IOException
{
return Double.parseDouble(nextString());
}
}
Submission Info
Submission Time |
|
Task |
D - 高橋くんと木の直径 |
User |
mukku |
Language |
Java (OpenJDK 1.7.0) |
Score |
0 |
Code Size |
3309 Byte |
Status |
WA |
Exec Time |
547 ms |
Memory |
21808 KB |
Judge Result
Set Name |
Sample |
Subtask1 |
All |
Score / Max Score |
0 / 0 |
0 / 20 |
0 / 80 |
Status |
|
|
|
Set Name |
Test Cases |
Sample |
subtask0_0.txt |
Subtask1 |
subtask1_0.txt, subtask1_1.txt, subtask1_10.txt, subtask1_11.txt, subtask1_12.txt, subtask1_13.txt, subtask1_14.txt, subtask1_15.txt, subtask1_16.txt, subtask1_17.txt, subtask1_18.txt, subtask1_19.txt, subtask1_2.txt, subtask1_20.txt, subtask1_3.txt, subtask1_4.txt, subtask1_5.txt, subtask1_6.txt, subtask1_7.txt, subtask1_8.txt, subtask1_9.txt, subtask0_0.txt |
All |
subtask0_0.txt, subtask1_0.txt, subtask1_1.txt, subtask1_10.txt, subtask1_11.txt, subtask1_12.txt, subtask1_13.txt, subtask1_14.txt, subtask1_15.txt, subtask1_16.txt, subtask1_17.txt, subtask1_18.txt, subtask1_19.txt, subtask1_2.txt, subtask1_20.txt, subtask1_3.txt, subtask1_4.txt, subtask1_5.txt, subtask1_6.txt, subtask1_7.txt, subtask1_8.txt, subtask1_9.txt, subtask2_0.txt, subtask2_1.txt, subtask2_10.txt, subtask2_11.txt, subtask2_12.txt, subtask2_13.txt, subtask2_14.txt, subtask2_15.txt, subtask2_16.txt, subtask2_17.txt, subtask2_18.txt, subtask2_19.txt, subtask2_2.txt, subtask2_3.txt, subtask2_4.txt, subtask2_5.txt, subtask2_6.txt, subtask2_7.txt, subtask2_8.txt, subtask2_9.txt |
Case Name |
Status |
Exec Time |
Memory |
subtask0_0.txt |
WA |
328 ms |
21588 KB |
subtask1_0.txt |
WA |
323 ms |
21808 KB |
subtask1_1.txt |
WA |
314 ms |
21656 KB |
subtask1_10.txt |
WA |
313 ms |
21744 KB |
subtask1_11.txt |
WA |
314 ms |
21664 KB |
subtask1_12.txt |
WA |
315 ms |
21744 KB |
subtask1_13.txt |
WA |
314 ms |
21656 KB |
subtask1_14.txt |
WA |
310 ms |
21684 KB |
subtask1_15.txt |
WA |
316 ms |
21704 KB |
subtask1_16.txt |
WA |
313 ms |
21732 KB |
subtask1_17.txt |
WA |
316 ms |
21660 KB |
subtask1_18.txt |
WA |
313 ms |
21632 KB |
subtask1_19.txt |
WA |
324 ms |
21696 KB |
subtask1_2.txt |
WA |
328 ms |
21660 KB |
subtask1_20.txt |
WA |
330 ms |
21596 KB |
subtask1_3.txt |
WA |
547 ms |
21568 KB |
subtask1_4.txt |
WA |
333 ms |
21684 KB |
subtask1_5.txt |
WA |
327 ms |
21724 KB |
subtask1_6.txt |
WA |
368 ms |
21720 KB |
subtask1_7.txt |
WA |
337 ms |
21700 KB |
subtask1_8.txt |
WA |
338 ms |
21696 KB |
subtask1_9.txt |
WA |
332 ms |
21692 KB |
subtask2_0.txt |
WA |
339 ms |
21724 KB |
subtask2_1.txt |
WA |
354 ms |
21664 KB |
subtask2_10.txt |
WA |
330 ms |
21712 KB |
subtask2_11.txt |
WA |
326 ms |
21696 KB |
subtask2_12.txt |
WA |
325 ms |
21732 KB |
subtask2_13.txt |
WA |
320 ms |
21724 KB |
subtask2_14.txt |
WA |
329 ms |
21728 KB |
subtask2_15.txt |
WA |
327 ms |
21660 KB |
subtask2_16.txt |
WA |
333 ms |
21720 KB |
subtask2_17.txt |
WA |
333 ms |
21688 KB |
subtask2_18.txt |
WA |
335 ms |
21668 KB |
subtask2_19.txt |
WA |
320 ms |
21724 KB |
subtask2_2.txt |
WA |
328 ms |
21700 KB |
subtask2_3.txt |
WA |
330 ms |
21720 KB |
subtask2_4.txt |
WA |
329 ms |
21660 KB |
subtask2_5.txt |
WA |
337 ms |
21668 KB |
subtask2_6.txt |
WA |
335 ms |
21712 KB |
subtask2_7.txt |
WA |
332 ms |
21712 KB |
subtask2_8.txt |
WA |
323 ms |
21680 KB |
subtask2_9.txt |
WA |
314 ms |
21736 KB |