Submission #331331

#TimeUsernameProblemLanguageResultExecution timeMemory
331331anishrajeevUntitled (POI11_tem)Java
8 / 100
638 ms41392 KiB
import java.io.*; import java.util.*; public class tem { public static void main(String[] args) throws IOException { BufferedReader bf = new BufferedReader(new InputStreamReader(System.in)); //BufferedReader bf = new BufferedReader(new FileReader("tester.in")); PrintWriter pw = new PrintWriter(new OutputStreamWriter(System.out)); int N = Integer.parseInt(bf.readLine()); int[] min = new int[N]; int[] max = new int[N]; for(int i = 0; i < N; i++){ StringTokenizer stk = new StringTokenizer(bf.readLine()); min[i] = Integer.parseInt(stk.nextToken()); max[i] = Integer.parseInt(stk.nextToken()); } int num = min[0]; int count = 0; int answer = 0; for(int i = 0; i < N; i++){ if(min[i]>=num||max[i]>=num){ count++; if(min[i]>=num)num = min[i]; else if(min[i]<=num&&num<=max[i])num = num; else num = max[i]; } else{ num = min[i]; i--; answer = Math.max(answer, count); count=0; } } System.out.println(answer); } }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...