File tree Expand file tree Collapse file tree 2 files changed +39
-3
lines changed
java/com/lzw/solutions/codeforces/p2189A
resources/codeforces/p2189A Expand file tree Collapse file tree 2 files changed +39
-3
lines changed Original file line number Diff line number Diff line change @@ -10,11 +10,32 @@ public class Main {
1010 private static final PrintWriter out = new PrintWriter (System .out , true );
1111
1212 private static void solve () throws IOException {
13- // your code here
13+ String [] first = in .readLine ().split (" " );
14+ int n = Integer .parseInt (first [0 ]);
15+ int h = Integer .parseInt (first [1 ]);
16+ int l = Integer .parseInt (first [2 ]);
17+
18+ String [] line = in .readLine ().split (" " );
19+ int cntRow = 0 ;
20+ int cntCol = 0 ;
21+
22+ for (String s : line ) {
23+ int x = Integer .parseInt (s );
24+ if (x <= h ) cntRow ++;
25+ if (x <= l ) cntCol ++;
26+ }
27+
28+ int maxPairs = Math .min (cntRow , cntCol );
29+ maxPairs = Math .min (maxPairs , n / 2 );
30+
31+ out .println (maxPairs );
1432 }
1533
1634 public static void main (String [] args ) throws IOException {
17- solve ();
35+ int t = Integer .parseInt (in .readLine ());
36+ while (t -- > 0 ) {
37+ solve ();
38+ }
1839 out .close ();
1940 }
20- }
41+ }
Original file line number Diff line number Diff line change 1+ 7
2+ 2 1 1
3+ 1 1
4+ 5 2 2
5+ 1 2 2 3 2
6+ 8 4 2
7+ 7 2 2 2 3 4 4 2
8+ 7 3 6
9+ 10 4 1 3 5 4 6
10+ 2 4 4
11+ 5 5
12+ 7 6 3
13+ 10 4 1 3 5 4 6
14+ 4 1 1
15+ 1 1 1 1
You can’t perform that action at this time.
0 commit comments