utd bob competition over

This commit is contained in:
2026-04-18 16:02:31 -05:00
parent 3936b37e29
commit ee7b6b1581
3 changed files with 97 additions and 25 deletions

View File

@@ -0,0 +1,52 @@
// General imports
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.Arrays;
import java.util.StringTokenizer;
public class DontTestMe {
public static void main(String[] args) throws IOException{
BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
StringTokenizer st = new StringTokenizer(br.readLine());
int N = Integer.parseInt(st.nextToken());
int H = Integer.parseInt(st.nextToken());
Test[] ar = new Test[N];
for (int i =0; i < N; i++){
st = new StringTokenizer(br.readLine());
ar[i] = new Test(Integer.parseInt(st.nextToken()),Integer.parseInt(st.nextToken()),Double.parseDouble(st.nextToken()));
}
Arrays.sort(ar, (a1,a2) -> a1.compareTo(a2));
}
}
class Test{
int hours,points;
double percent;
double weight;
public Test (int h, int p, double per){
hours = h;
points = p;
percent = per;
weight = 1/(double) hours * points * percent;
}
public int compareTo(Object o){
Test t = (Test) o;
if (this.weight > t.weight) return 1;
else if (this.weight < t.weight) return -1;
return 0;
}
}

View File

@@ -1,50 +1,61 @@
// General imports
import java.util.Scanner;
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.util.PriorityQueue;
import java.util.StringTokenizer;
public class MaximumAura {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
public static void main(String[] args) throws IOException {
long t = System.nanoTime();
BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
PrintWriter out = new PrintWriter(System.out);
// Write code here
int a = sc.nextInt();
int[]input = new int[a];
int a = Integer.parseInt(br.readLine());
int[] input = new int[a];
int[] left = new int[a];
int[] right = new int[a];
left[0] = 1;
right[a-1] =1;
right[a - 1] = 1;
StringTokenizer st = new StringTokenizer(br.readLine());
for (int i = 0; i < a; i++) {
input[i] =sc.nextInt();
input[i] = Integer.parseInt(st.nextToken());
}
for (int i = 1; i < input.length; i++) {
int max = 0;
for (int j =0; j < i; j++) {
if (input[j]< input[i]) {
for (int j = 0; j < i; j++) {
if (input[j] < input[i]) {
max = Math.max(max, left[j]);
}
}
left[i] = max +1;
left[i] = max + 1;
}
for (int i = a-2; i >= 0; i--) {
for (int i = a - 2; i >= 0; i--) {
right[i] = 1;
int max = 0;
for (int j = a-1; j > i; j--) {
if (input[j]< input[i]) {
for (int j = a - 1; j > i; j--) {
if (input[j] < input[i]) {
max = Math.max(max, right[j]);
}
}
right[i] += max;
}
PriorityQueue<Integer> p = new PriorityQueue<>();
for (int i = 0; i < input.length; i++) {
System.out.print((left[i]+right[i]-1)+" ");
out.print((left[i] + right[i] - 1) + " ");
}
sc.close();
br.close();
out.flush();
}
}

View File

@@ -1,17 +1,25 @@
// General imports
import java.util.Scanner;
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.StringTokenizer;
public class WeightedDifference {
public static void main(String[] args) throws IOException{
double t = System.currentTimeMillis();
BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
public class WeightedDifference {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
// Write code here
int a = sc.nextInt();
int a = Integer.parseInt(br.readLine());
StringTokenizer st = new StringTokenizer(br.readLine());
int[] ar = new int[a];
for (int i = 0; i < a; i++) {
ar[i] = sc.nextInt();
ar[i] = Integer.parseInt(st.nextToken());
}
long max = Long.MIN_VALUE;
@@ -34,7 +42,8 @@ public class WeightedDifference {
}
System.out.println(max);
sc.close();
System.out.println(System.currentTimeMillis()-t);
}
}