11767 | 2024-11-09 19:36:31 | balint | Számjegycsere | cpp17 | Runtime error 0/100 | 2ms | 756 KiB |
#include <stdio.h>
#include <stdbool.h>
int main()
{
int n;
scanf("%d", &n);
scanf("%c");
bool arr[5];
char last;
char c;
char buff;
for (int _ = 0; _ < n; _++)
{
while (true)
{
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");
}
else
{
if (c == '0')
{
if (last == '0' || last == '5')
{
printf("0");
}
else
{
printf("1");
}
}
else if (c == '5')
{
if (last == '2' || last == '7')
{
printf("0");
}
else
{
printf("1");
}
}
else
{
printf("2");
}
}
}
return 0;
}
// 00
// 25
// 50
// 75
Subtask | Sum | Test | Verdict | Time | Memory | ||
---|---|---|---|---|---|---|---|
subtask1 | 0/0 | ||||||
1 | Runtime error | 1ms | 320 KiB | ||||
subtask2 | 0/21 | ||||||
2 | Runtime error | 1ms | 320 KiB | ||||
subtask3 | 0/23 | ||||||
3 | Runtime error | 1ms | 320 KiB | ||||
4 | Runtime error | 1ms | 320 KiB | ||||
5 | Runtime error | 1ms | 756 KiB | ||||
6 | Runtime error | 1ms | 756 KiB | ||||
7 | Runtime error | 1ms | 508 KiB | ||||
8 | Runtime error | 1ms | 512 KiB | ||||
9 | Runtime error | 1ms | 320 KiB | ||||
10 | Runtime error | 1ms | 508 KiB | ||||
11 | Runtime error | 1ms | 320 KiB | ||||
12 | Runtime error | 1ms | 320 KiB | ||||
13 | Runtime error | 1ms | 320 KiB | ||||
14 | Runtime error | 1ms | 508 KiB | ||||
15 | Runtime error | 1ms | 320 KiB | ||||
16 | Runtime error | 1ms | 320 KiB | ||||
17 | Runtime error | 1ms | 320 KiB | ||||
18 | Runtime error | 1ms | 320 KiB | ||||
19 | Runtime error | 1ms | 500 KiB | ||||
20 | Runtime error | 1ms | 320 KiB | ||||
21 | Runtime error | 1ms | 320 KiB | ||||
22 | Runtime error | 1ms | 320 KiB | ||||
23 | Runtime error | 1ms | 500 KiB | ||||
subtask4 | 0/41 | ||||||
24 | Runtime error | 1ms | 320 KiB | ||||
25 | Runtime error | 1ms | 320 KiB | ||||
26 | Runtime error | 1ms | 320 KiB | ||||
27 | Runtime error | 1ms | 320 KiB | ||||
28 | Runtime error | 2ms | 388 KiB | ||||
29 | Runtime error | 1ms | 376 KiB | ||||
30 | Runtime error | 1ms | 320 KiB | ||||
31 | Runtime error | 1ms | 320 KiB | ||||
32 | Runtime error | 1ms | 320 KiB | ||||
33 | Runtime error | 1ms | 576 KiB | ||||
34 | Runtime error | 1ms | 320 KiB | ||||
35 | Runtime error | 1ms | 320 KiB | ||||
36 | Runtime error | 1ms | 320 KiB | ||||
37 | Runtime error | 1ms | 320 KiB | ||||
38 | Runtime error | 1ms | 508 KiB | ||||
39 | Runtime error | 1ms | 320 KiB | ||||
40 | Runtime error | 1ms | 336 KiB | ||||
41 | Runtime error | 1ms | 320 KiB | ||||
42 | Runtime error | 1ms | 320 KiB | ||||
43 | Runtime error | 1ms | 320 KiB | ||||
44 | Runtime error | 1ms | 320 KiB | ||||
45 | Runtime error | 1ms | 388 KiB | ||||
46 | Runtime error | 1ms | 320 KiB | ||||
47 | Runtime error | 1ms | 320 KiB | ||||
subtask5 | 0/15 | ||||||
48 | Runtime error | 2ms | 320 KiB | ||||
49 | Runtime error | 2ms | 320 KiB | ||||
50 | Runtime error | 1ms | 568 KiB | ||||
51 | Runtime error | 1ms | 320 KiB | ||||
52 | Runtime error | 1ms | 568 KiB | ||||
53 | Runtime error | 1ms | 320 KiB | ||||
54 | Runtime error | 1ms | 320 KiB | ||||
55 | Runtime error | 1ms | 320 KiB | ||||
56 | Runtime error | 1ms | 320 KiB | ||||
57 | Runtime error | 1ms | 320 KiB | ||||
58 | Runtime error | 1ms | 320 KiB | ||||
59 | Runtime error | 1ms | 320 KiB | ||||
60 | Runtime error | 1ms | 500 KiB | ||||
61 | Runtime error | 1ms | 320 KiB | ||||
62 | Runtime error | 1ms | 320 KiB | ||||
63 | Runtime error | 1ms | 320 KiB | ||||
64 | Runtime error | 1ms | 320 KiB | ||||
65 | Runtime error | 1ms | 320 KiB | ||||
66 | Runtime error | 1ms | 320 KiB |