11769 | 2024-11-09 20:08:56 | balint | Számjegycsere | cpp17 | Wrong answer 0/100 | 23ms | 664 KiB |
#include <stdio.h>
#include <stdbool.h>
int main()
{
int n;
scanf("%d", &n);
getchar();
bool arr[5] = {false};
char last = '\0';
char c = '\0';
char buff;
for (int _ = 0; _ < n; _++)
{
for (int i = 0; i < 5; i++)
{
arr[i] = false;
}
while (true)
{
buff = getchar();
// scanf("%c", &buff);
if (buff == '\n')
{
break;
}
last = c;
c = buff;
switch (c)
{
case '0':
if (arr[0])
{
arr[1] = true;
}
else
{
arr[0] = true;
}
break;
case '2':
arr[2] = true;
break;
case '5':
arr[3] = true;
break;
case '7':
arr[4] = true;
break;
}
}
if (!((arr[0] && arr[1]) || (arr[2] && arr[3]) || (arr[3] && arr[0]) || (arr[4] && arr[3])))
{
printf("-1\n");
}
else
{
if (c == '0')
{
if (last == '0' || last == '5')
{
printf("0\n");
}
else
{
printf("1\n");
}
}
else if (c == '5')
{
if (last == '2' || last == '7')
{
printf("0\n");
}
else
{
printf("1\n");
}
}
else
{
printf("2\n");
}
}
}
return 0;
}
// 00
// 25
// 50
// 75
Subtask | Sum | Test | Verdict | Time | Memory | ||
---|---|---|---|---|---|---|---|
subtask1 | 0/0 | ||||||
1 | Accepted | 1ms | 320 KiB | ||||
subtask2 | 0/21 | ||||||
2 | Wrong answer | 3ms | 320 KiB | ||||
subtask3 | 0/23 | ||||||
3 | Wrong answer | 8ms | 568 KiB | ||||
4 | Wrong answer | 8ms | 568 KiB | ||||
5 | Wrong answer | 8ms | 572 KiB | ||||
6 | Wrong answer | 8ms | 644 KiB | ||||
7 | Wrong answer | 8ms | 652 KiB | ||||
8 | Wrong answer | 8ms | 596 KiB | ||||
9 | Wrong answer | 8ms | 568 KiB | ||||
10 | Wrong answer | 8ms | 568 KiB | ||||
11 | Wrong answer | 8ms | 568 KiB | ||||
12 | Wrong answer | 8ms | 568 KiB | ||||
13 | Wrong answer | 8ms | 612 KiB | ||||
14 | Wrong answer | 8ms | 588 KiB | ||||
15 | Wrong answer | 8ms | 584 KiB | ||||
16 | Wrong answer | 9ms | 596 KiB | ||||
17 | Wrong answer | 8ms | 516 KiB | ||||
18 | Wrong answer | 9ms | 560 KiB | ||||
19 | Wrong answer | 9ms | 556 KiB | ||||
20 | Wrong answer | 9ms | 600 KiB | ||||
21 | Wrong answer | 9ms | 400 KiB | ||||
22 | Wrong answer | 10ms | 520 KiB | ||||
23 | Wrong answer | 9ms | 568 KiB | ||||
subtask4 | 0/41 | ||||||
24 | Accepted | 1ms | 320 KiB | ||||
25 | Accepted | 1ms | 508 KiB | ||||
26 | Accepted | 1ms | 320 KiB | ||||
27 | Accepted | 1ms | 320 KiB | ||||
28 | Accepted | 1ms | 320 KiB | ||||
29 | Accepted | 1ms | 320 KiB | ||||
30 | Accepted | 1ms | 320 KiB | ||||
31 | Accepted | 1ms | 388 KiB | ||||
32 | Accepted | 1ms | 356 KiB | ||||
33 | Wrong answer | 1ms | 320 KiB | ||||
34 | Accepted | 1ms | 320 KiB | ||||
35 | Accepted | 1ms | 320 KiB | ||||
36 | Accepted | 1ms | 332 KiB | ||||
37 | Accepted | 1ms | 320 KiB | ||||
38 | Accepted | 1ms | 320 KiB | ||||
39 | Accepted | 1ms | 320 KiB | ||||
40 | Accepted | 1ms | 320 KiB | ||||
41 | Accepted | 1ms | 320 KiB | ||||
42 | Accepted | 1ms | 320 KiB | ||||
43 | Accepted | 1ms | 512 KiB | ||||
44 | Accepted | 1ms | 508 KiB | ||||
45 | Accepted | 1ms | 332 KiB | ||||
46 | Wrong answer | 1ms | 512 KiB | ||||
47 | Wrong answer | 1ms | 320 KiB | ||||
subtask5 | 0/15 | ||||||
48 | Wrong answer | 16ms | 320 KiB | ||||
49 | Wrong answer | 16ms | 392 KiB | ||||
50 | Wrong answer | 23ms | 536 KiB | ||||
51 | Wrong answer | 16ms | 388 KiB | ||||
52 | Wrong answer | 17ms | 320 KiB | ||||
53 | Accepted | 6ms | 320 KiB | ||||
54 | Accepted | 6ms | 320 KiB | ||||
55 | Accepted | 6ms | 424 KiB | ||||
56 | Accepted | 9ms | 568 KiB | ||||
57 | Accepted | 8ms | 388 KiB | ||||
58 | Accepted | 4ms | 392 KiB | ||||
59 | Accepted | 4ms | 320 KiB | ||||
60 | Accepted | 4ms | 388 KiB | ||||
61 | Accepted | 4ms | 320 KiB | ||||
62 | Accepted | 4ms | 320 KiB | ||||
63 | Accepted | 6ms | 388 KiB | ||||
64 | Accepted | 9ms | 604 KiB | ||||
65 | Accepted | 9ms | 664 KiB | ||||
66 | Accepted | 9ms | 624 KiB |