|
|
вернуться в форумwr #11 - Time limit exceed. Help me...!!! import java.util.Scanner; /** * Created by Coder on 25.11.2014. */ public class FinalStandings1100_ { public static void main(String[] args) { Scanner x = new Scanner(System.in); int n = x.nextInt(); int a[][] = new int[n][2]; for (int i = 0; i < n; i++) { for (int j = 0; j < 2; j++) { a[i][j] = x.nextInt(); } } int k = 1; int d = 0 for (int i = 0; i < n; i++) { for (int j = 0; j < n - 1; j++) { if (a[j][k] < a[j + 1][k]) { int v = a[j][d]; a[j][d] = a[j + 1][d]; a[j + 1][d] = v; int c = a[j][k]; a[j][k] = a[j + 1][k]; a[j + 1][k] = c; } } } for (int i = 0; i < n; i++) { for (int j = 0; j < 2; j++) { System.out.print(a[i][j] + " "); } System.out.println(); } } } |
|
|