| Task: | Hypyt |
| Sender: | TapaniS |
| Submission time: | 2025-10-18 10:12:52 +0300 |
| Language: | Java |
| Status: | READY |
| Result: | 0 |
| group | verdict | score |
|---|---|---|
| #1 | WRONG ANSWER | 0 |
| #2 | WRONG ANSWER | 0 |
| test | verdict | time | group | |
|---|---|---|---|---|
| #1 | WRONG ANSWER | 0.20 s | 1, 2 | details |
| #2 | ACCEPTED | 0.25 s | 1, 2 | details |
| #3 | ACCEPTED | 0.78 s | 2 | details |
| #4 | TIME LIMIT EXCEEDED | -- | 2 | details |
| #5 | TIME LIMIT EXCEEDED | -- | 2 | details |
Code
import java.util.*;
public class hypyt {
public static void main(String[] args) {
Scanner input = new Scanner(System.in);
int t = Integer.parseInt(input.nextLine());
int[] n = new int[t]; // korkeus
int[] m = new int[t]; //leveys
String[] numerot = new String[t]; // numerot
for (int i = 0; i < t; i++) {
numerot[i] = input.nextLine();
String[] numberParts = numerot[i].split("\\s+");
n[i] = Integer.parseInt(numberParts[0]);
m[i] = Integer.parseInt(numberParts[1]);
}
input.close();
// Program here
for (int i = 0; i < t; i++) { // tapaus t
int kor = n[i];
int lev = m[i];
if ((kor == 1) && (lev == 1)) {
continue;
}
if ((kor == 1) && (lev == 2)) {
System.out.println("0 1");
continue;
}
if ((kor == 2) && (lev == 1)) {
System.out.println("-1 0");
continue;
}
if ((kor == 2) && (lev == 2)) {
System.out.println("0 1");
System.out.println("1 0");
System.out.println("0 -1");
continue;
}
// korkeus & leveys > 2
int kpl = kor * lev;
int[] y = new int[(kpl + 1)];
int[] x = new int[(kpl + 1)];
y[1] = 1;
x[1] = 1;
y[2] = kor;
x[2] = lev;
int kor1 = kor / 2;
for (int i1 = 0; i1 < kor1; i1++) {
for (int i2 = 0; i2 < lev; i2++) {
int number = (i1 * lev * 2) + (2 * i2) + 1;
y[number] = i1 + 1;
x[number] = i2 + 1;
} // i2
} // i1
int kor2 = kor1 + (kor % 2) + 1;
for (int i1 = kor; i1 > (kor2 - 1); i1--) {
for (int i2 = lev; i2 > 0; i2--) {
int number = (2 * i2) + ((kor-i1) * lev * 2);
y[number] = i1;
x[number] = lev - i2 + 1;
} // i2
} // i1
if ((kor % 2) == 1) {
int num1 = kpl - lev +1;
int num2 = num1 + lev -1;
int num3 = 0;
int pos3 = 0;
if ((lev % 2) == 1) {
pos3 = (lev + 1) / 2;
y[kpl] = (kor+1)/2;
x[kpl] = pos3;
}
int lev1 = lev / 2;
for (int i2 = 0; i2 < lev1; i2++) {
int number = num1 + (2 * i2);
y[number] = (kor+1)/2;
x[number] = i2 + 1;
}
int lev2 = lev1 + (lev % 2) + 1;
for (int i2 = lev; i2 > (lev2 - 1); i2--) {
int number = num1 + 1 - (2* i2) + (2*lev);
y[number] = (kor+1)/2;
x[number] = i2;
}
} // kor % 2
// tulostus
int dy = 0;
int dx = 0;
for (int i5 = 2; i5 < (kpl+1); i5++) {
dy = y[i5] - y[(i5-1)];
dx = x[i5] - x[(i5-1)];
System.out.println(dy + " " + dx);
}
/*
System.out.println("y: ");
for (int i6 = 0; i6 < kor; i6++) {
for (int i7 = 1; i7 < (lev+1); i7++) {
System.out.print(y[(i6*lev )+ i7] + " ");
}
System.out.println("");
}
System.out.println("x: ");
for (int i6 = 0; i6 < kor; i6++) {
for (int i7 = 1; i7 < (lev+1); i7++) {
System.out.print(x[i7 + (i6*lev)] + " ");
}
System.out.println("");
}
*/
} // tapaus t
}
}Test details
Test 1
Group: 1, 2
Verdict: WRONG ANSWER
| input |
|---|
| 25 1 1 1 2 1 3 1 4 ... |
| correct output |
|---|
| 0 1 0 2 0 -1 0 3 0 -2 ... |
| user output |
|---|
| 0 1 0 2 0 -1 0 3 0 -2 ... Truncated |
Test 2
Group: 1, 2
Verdict: ACCEPTED
| input |
|---|
| 100 5 5 5 5 5 5 5 5 ... |
| correct output |
|---|
| 4 4 -4 -3 4 2 -4 -1 4 0 ... |
| user output |
|---|
| 4 4 -4 -3 4 2 -4 -1 4 0 ... Truncated |
Test 3
Group: 2
Verdict: ACCEPTED
| input |
|---|
| 100 1 25 20 40 5 34 50 34 ... |
| correct output |
|---|
| 0 24 0 -23 0 22 0 -21 0 20 ... |
| user output |
|---|
| 0 24 0 -23 0 22 0 -21 0 20 ... Truncated |
Test 4
Group: 2
Verdict: TIME LIMIT EXCEEDED
| input |
|---|
| 100 46 47 41 39 46 36 46 30 ... |
| correct output |
|---|
| 45 46 -45 -45 45 44 -45 -43 45 42 ... |
| user output |
|---|
| (empty) |
Test 5
Group: 2
Verdict: TIME LIMIT EXCEEDED
| input |
|---|
| 100 50 50 50 50 50 50 50 50 ... |
| correct output |
|---|
| 49 49 -49 -48 49 47 -49 -46 49 45 ... |
| user output |
|---|
| (empty) |
