Submission #345687


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],s=0;
    d[0]++;
     for (int i = 0; i < n*2; i++) {int t=-1;
    	 for (int j = 0; j < d.length; j++) {
			if(d[j]==0){t=j;break;}
		}
    	 if(t==s)break;
		System.out.println('?'+" "+s+" "+t);
    	s=t;
    	d[s]++;
    	r=max(r,sc.nextInt());
	}


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 2972 Byte
Status WA
Exec Time 599 ms
Memory 21196 KB

Judge Result

Set Name Sample Subtask1 All
Score / Max Score 0 / 0 0 / 20 0 / 80
Status
WA × 1
WA × 22
WA × 42
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 442 ms 21144 KB
subtask1_0.txt WA 434 ms 21072 KB
subtask1_1.txt WA 434 ms 21076 KB
subtask1_10.txt WA 439 ms 21092 KB
subtask1_11.txt WA 439 ms 21048 KB
subtask1_12.txt WA 439 ms 21056 KB
subtask1_13.txt WA 465 ms 21152 KB
subtask1_14.txt WA 453 ms 21092 KB
subtask1_15.txt WA 599 ms 21140 KB
subtask1_16.txt WA 446 ms 21068 KB
subtask1_17.txt WA 445 ms 21136 KB
subtask1_18.txt WA 448 ms 21180 KB
subtask1_19.txt WA 440 ms 21028 KB
subtask1_2.txt WA 442 ms 21032 KB
subtask1_20.txt WA 510 ms 21124 KB
subtask1_3.txt WA 445 ms 21064 KB
subtask1_4.txt WA 445 ms 21168 KB
subtask1_5.txt WA 441 ms 20992 KB
subtask1_6.txt WA 446 ms 21068 KB
subtask1_7.txt WA 442 ms 21136 KB
subtask1_8.txt WA 444 ms 21052 KB
subtask1_9.txt WA 444 ms 21108 KB
subtask2_0.txt WA 449 ms 21096 KB
subtask2_1.txt WA 444 ms 21156 KB
subtask2_10.txt WA 445 ms 21080 KB
subtask2_11.txt WA 447 ms 21196 KB
subtask2_12.txt WA 439 ms 21156 KB
subtask2_13.txt WA 444 ms 21168 KB
subtask2_14.txt WA 441 ms 21048 KB
subtask2_15.txt WA 442 ms 21172 KB
subtask2_16.txt WA 440 ms 21124 KB
subtask2_17.txt WA 445 ms 21056 KB
subtask2_18.txt WA 442 ms 21132 KB
subtask2_19.txt WA 439 ms 21124 KB
subtask2_2.txt WA 438 ms 21100 KB
subtask2_3.txt WA 443 ms 21036 KB
subtask2_4.txt WA 447 ms 21092 KB
subtask2_5.txt WA 442 ms 21012 KB
subtask2_6.txt WA 449 ms 20976 KB
subtask2_7.txt WA 445 ms 21180 KB
subtask2_8.txt WA 440 ms 21112 KB
subtask2_9.txt WA 441 ms 20932 KB