| Task: | Hypyt |
| Sender: | NicholasAhman |
| Submission time: | 2025-11-04 19:14:29 +0200 |
| Language: | C++ (C++17) |
| Status: | READY |
| Result: | 0 |
| group | verdict | score |
|---|---|---|
| #1 | WRONG ANSWER | 0 |
| #2 | WRONG ANSWER | 0 |
| #3 | WRONG ANSWER | 0 |
| #4 | WRONG ANSWER | 0 |
| #5 | WRONG ANSWER | 0 |
| test | verdict | time | group | |
|---|---|---|---|---|
| #1 | WRONG ANSWER | 0.00 s | 1, 2, 3, 4, 5 | details |
| #2 | WRONG ANSWER | 0.00 s | 1, 2, 3, 4, 5 | details |
| #3 | WRONG ANSWER | 0.00 s | 1, 2, 3, 4, 5 | details |
| #4 | WRONG ANSWER | 0.00 s | 1, 2, 3, 4, 5 | details |
| #5 | RUNTIME ERROR | 0.00 s | 1, 2, 3, 4, 5 | details |
| #6 | WRONG ANSWER | 0.01 s | 2, 5 | details |
| #7 | WRONG ANSWER | 0.00 s | 2, 5 | details |
| #8 | WRONG ANSWER | 0.00 s | 2, 5 | details |
| #9 | WRONG ANSWER | 0.03 s | 3, 4, 5 | details |
| #10 | WRONG ANSWER | 0.03 s | 3, 4, 5 | details |
| #11 | WRONG ANSWER | 0.03 s | 3, 4, 5 | details |
| #12 | WRONG ANSWER | 0.03 s | 4, 5 | details |
| #13 | WRONG ANSWER | 0.03 s | 4, 5 | details |
| #14 | WRONG ANSWER | 0.03 s | 4, 5 | details |
| #15 | WRONG ANSWER | 0.03 s | 5 | details |
| #16 | WRONG ANSWER | 0.03 s | 5 | details |
| #17 | WRONG ANSWER | 0.03 s | 5 | details |
| #18 | WRONG ANSWER | 0.03 s | 5 | details |
| #19 | WRONG ANSWER | 0.03 s | 5 | details |
| #20 | WRONG ANSWER | 0.03 s | 5 | details |
| #21 | WRONG ANSWER | 0.03 s | 5 | details |
| #22 | WRONG ANSWER | 0.00 s | 1, 2, 3, 4, 5 | details |
| #23 | WRONG ANSWER | 0.00 s | 1, 2, 3, 4, 5 | details |
| #24 | WRONG ANSWER | 0.03 s | 5 | details |
| #25 | WRONG ANSWER | 0.03 s | 5 | details |
| #26 | WRONG ANSWER | 0.03 s | 5 | details |
| #27 | WRONG ANSWER | 0.03 s | 5 | details |
Compiler report
input/code.cpp: In function 'void draw_line(int, size_t, int)':
input/code.cpp:49:39: warning: comparison of integer expressions of different signedness: 'size_t' {aka 'long unsigned int'} and 'int' [-Wsign-compare]
49 | for (size_t i = ops.size() - 1; i != -1; i--) {
| ~~^~~~~Code
#include <cstdlib>
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#include <unistd.h>
#include <stdint.h>
#include <unordered_map>
#include <unordered_set>
#include <vector>
uint64_t *colors;
size_t width;
size_t height;
size_t color_count;
struct Drawing {
int rc;
size_t n;
int color;
};
struct Point {
size_t x;
size_t y;
};
std::vector<Drawing> ops;
Point intersection(int rc1, size_t n1, int rc2, size_t n2) {
if (rc1 == 'C') {
return { .x = n1, .y = n2};
} else {
return { .x = n2, .y = n1};
}
}
void draw_line(int rc, size_t n, int color) {
colors[color] += rc == 'R' ? width : height;
if (ops.size() == 0) {
ops.push_back({rc, n, color});
return;
}
bool same_line = false;
std::unordered_map<size_t, Point> intersections;
for (size_t i = ops.size() - 1; i != -1; i--) {
if (ops[i].rc != rc) {
Point is = intersection(rc, n, ops[i].rc, ops[i].n);
if (intersections.count(is.x + width * is.y) == 0) {
colors[ops[i].color]--;
intersections.insert({is.x + width * is.y, is});
}
} else {
if (n != ops[i].n) {
continue;
}
if (same_line) {
continue;
}
std::unordered_set<size_t> is2;
size_t covered = rc == 'R' ? width : height;
for (size_t j = i + 1; j < ops.size(); j++) {
if (ops[j].rc != ops[i].rc) {
Point is = intersection(ops[i].rc, ops[i].n, ops[j].rc, ops[j].n);
if (is2.count(is.x + width * is.y) == 0) {
covered--;
is2.insert(is.x + width * is.y);
}
} else {
if (ops[i].n != ops[j].n) {
continue;
}
covered = 0;
break;
}
}
colors[ops[i].color] -= covered;
same_line = true;
}
}
ops.push_back({rc, n, color});
}
int main(void) {
char *input = (char *)malloc(1024*1024*8);
const size_t len = read(0, input, 1024*1024*8);
size_t idx = 0;
size_t next_space = strchr(input, ' ') - input;
input[next_space] = '\0';
height = atoi(input);
idx += next_space + 1;
next_space = strchr((input + idx), ' ') - (input + idx);
(input + idx)[next_space] = '\0';
width = atoi((input + idx));
idx += next_space + 1;
next_space = strchr((input + idx), ' ') - (input + idx);
(input + idx)[next_space] = '\0';
color_count = atoi((input + idx));
idx += next_space + 1;
next_space = strchr((input + idx), '\n') - (input + idx);
(input + idx)[next_space] = '\0';
size_t operations = atoi((input + idx));
idx += next_space + 1;
colors = (uint64_t *)malloc((color_count + 1) * sizeof(uint64_t));
ops.reserve(operations);
for (size_t i = 0; i < color_count + 1; i++) {
colors[i] = 0;
}
for (size_t i = 0; i < operations; i++) {
int rc = (input + idx)[0];
idx += 2;
next_space = strchr((input + idx), ' ') - (input + idx);
(input + idx)[next_space] = '\0';
size_t n = atoi((input + idx));
idx += next_space + 1;
if (i == operations - 1) {
next_space = len - ((input + idx) - input) - 1;
} else {
next_space = strchr((input + idx), '\n') - (input + idx);
}
(input + idx)[next_space] = '\0';
size_t color = atoi((input + idx));
idx += next_space + 1;
draw_line(rc, n, color);
}
for (size_t i = 1; i < color_count + 1; i++) {
printf("%lu ", colors[i]);
}
free(input);
free(colors);
}
Test details
Test 1 (public)
Group: 1, 2, 3, 4, 5
Verdict: WRONG ANSWER
| input |
|---|
| 4 6 5 .*.*** *...** *****. *..*.* ... |
| correct output |
|---|
| 1 0 3 3 -1 |
| user output |
|---|
| 0 4 0 0 0 |
Feedback: Incorrect character on line 1 col 1: expected "1", got "0"
Test 2
Group: 1, 2, 3, 4, 5
Verdict: WRONG ANSWER
| input |
|---|
| 10 10 10 .......... .....*.... ........*. *.*....*.. ... |
| correct output |
|---|
| 1 2 1 2 2 ... |
| user output |
|---|
| 0 0 0 0 0 17 9 0 0 9 |
Feedback: Incorrect character on line 1 col 1: expected "1", got "0"
Test 3
Group: 1, 2, 3, 4, 5
Verdict: WRONG ANSWER
| input |
|---|
| 10 10 10 *...***.** *****.*... **..**.**. ..**.**.*. ... |
| correct output |
|---|
| 1 2 2 1 2 ... |
| user output |
|---|
| 0 0 0 0 0 0 0 0 19 0 |
Feedback: Incorrect character on line 1 col 1: expected "1", got "0"
Test 4
Group: 1, 2, 3, 4, 5
Verdict: WRONG ANSWER
| input |
|---|
| 10 10 10 ***.*.**** ********** *.******** .*.***.**. ... |
| correct output |
|---|
| 3 4 2 3 4 ... |
| user output |
|---|
| 0 0 0 10 9 0 0 0 0 16 |
Feedback: Incorrect character on line 1 col 1: expected "3", got "0"
Test 5
Group: 1, 2, 3, 4, 5
Verdict: RUNTIME ERROR
| input |
|---|
| 10 10 1 .****.**** **.**..*** ********** *******..* ... |
| correct output |
|---|
| 7 |
| user output |
|---|
| (empty) |
Test 6
Group: 2, 5
Verdict: WRONG ANSWER
| input |
|---|
| 250 250 250 .*...*.....*******..**...*....... |
| correct output |
|---|
| 2 3 3 2 2 ... |
| user output |
|---|
| 0 0 0 18446744073709551608 0 4... |
Feedback: Incorrect character on line 1 col 1: expected "2", got "0"
Test 7
Group: 2, 5
Verdict: WRONG ANSWER
| input |
|---|
| 250 250 250 ...*......**.**.*.*..**..*..**... |
| correct output |
|---|
| 2 2 2 2 3 ... |
| user output |
|---|
| 0 0 0 0 0 469 0 0 244 0 223 6 ... |
Feedback: Incorrect character on line 1 col 1: expected "2", got "0"
Test 8
Group: 2, 5
Verdict: WRONG ANSWER
| input |
|---|
| 250 250 250 **..**..****.****.*.***.***..*... |
| correct output |
|---|
| 2 3 3 3 3 ... |
| user output |
|---|
| 207 6 0 0 0 0 0 0 0 0 0 0 9 18... |
Feedback: Incorrect character on line 1 col 2: expected "2", got "207"
Test 9
Group: 3, 4, 5
Verdict: WRONG ANSWER
| input |
|---|
| 40 40 200000 ...*.**.*..*.............*.*..... |
| correct output |
|---|
| 2 2 2 2 2 ... |
| user output |
|---|
| 35 0 0 61 0 0 0 0 0 1 1 184467... |
Feedback: Incorrect character on line 1 col 1: expected "2", got "35"
Test 10
Group: 3, 4, 5
Verdict: WRONG ANSWER
| input |
|---|
| 40 40 200000 **.**..*.*.*.******....****.*.... |
| correct output |
|---|
| 2 1 3 2 2 ... |
| user output |
|---|
| 0 0 24 79 0 2 1844674407370955... |
Feedback: Incorrect character on line 1 col 1: expected "2", got "0"
Test 11
Group: 3, 4, 5
Verdict: WRONG ANSWER
| input |
|---|
| 40 40 200000 .*.*.**.*****.***.*.****.**.**... |
| correct output |
|---|
| 3 3 3 3 3 ... |
| user output |
|---|
| 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 ... |
Feedback: Incorrect character on line 1 col 1: expected "3", got "0"
Test 12
Group: 4, 5
Verdict: WRONG ANSWER
| input |
|---|
| 80 80 200000 *....**.***..****...*.....*...... |
| correct output |
|---|
| 2 2 2 2 2 ... |
| user output |
|---|
| 0 0 0 79 0 0 0 0 0 0 0 0 0 79 ... |
Feedback: Incorrect character on line 1 col 1: expected "2", got "0"
Test 13
Group: 4, 5
Verdict: WRONG ANSWER
| input |
|---|
| 80 80 200000 .***.*..*.***..*****....**...*... |
| correct output |
|---|
| 3 2 2 3 2 ... |
| user output |
|---|
| 0 0 0 0 0 0 0 2 0 0 71 80 3 1 ... |
Feedback: Incorrect character on line 1 col 1: expected "3", got "0"
Test 14
Group: 4, 5
Verdict: WRONG ANSWER
| input |
|---|
| 80 80 200000 *******.*****.*..*..****...***... |
| correct output |
|---|
| 2 3 1 2 2 ... |
| user output |
|---|
| 0 0 0 0 0 0 0 0 0 0 0 0 80 0 0... |
Feedback: Incorrect character on line 1 col 1: expected "2", got "0"
Test 15
Group: 5
Verdict: WRONG ANSWER
| input |
|---|
| 250 250 200000 *....*..*..*..**..*.........**... |
| correct output |
|---|
| 3 2 2 2 2 ... |
| user output |
|---|
| 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 ... |
Feedback: Incorrect character on line 1 col 1: expected "3", got "0"
Test 16
Group: 5
Verdict: WRONG ANSWER
| input |
|---|
| 250 250 200000 ..*....*..*......*.**.*.*..***... |
| correct output |
|---|
| 2 2 2 2 2 ... |
| user output |
|---|
| 0 0 0 224 0 0 1 0 250 0 0 0 18... |
Feedback: Incorrect character on line 1 col 1: expected "2", got "0"
Test 17
Group: 5
Verdict: WRONG ANSWER
| input |
|---|
| 250 250 200000 *..*.*****.*********.****.****... |
| correct output |
|---|
| 3 3 2 2 2 ... |
| user output |
|---|
| 0 0 0 0 0 248 0 2 0 0 1 0 0 0 ... |
Feedback: Incorrect character on line 1 col 1: expected "3", got "0"
Test 18
Group: 5
Verdict: WRONG ANSWER
| input |
|---|
| 250 250 200000 *********.**********.******.**... |
| correct output |
|---|
| 3 3 3 3 3 ... |
| user output |
|---|
| 0 0 0 18446744073709551613 0 2... |
Feedback: Incorrect character on line 1 col 1: expected "3", got "0"
Test 19
Group: 5
Verdict: WRONG ANSWER
| input |
|---|
| 250 250 200000 .*****************************... |
| correct output |
|---|
| 104 422 145 93 65 ... |
| user output |
|---|
| 0 0 0 0 0 0 184467440737095515... |
Feedback: Incorrect character on line 1 col 1: expected "104", got "0"
Test 20
Group: 5
Verdict: WRONG ANSWER
| input |
|---|
| 250 250 200000 ..****************************... |
| correct output |
|---|
| 57 155 38 65 98 ... |
| user output |
|---|
| 0 0 0 0 18446744073709551573 0... |
Feedback: Incorrect character on line 1 col 1: expected "57", got "0"
Test 21
Group: 5
Verdict: WRONG ANSWER
| input |
|---|
| 250 250 200000 .*****************************... |
| correct output |
|---|
| 498 498 498 498 498 ... |
| user output |
|---|
| 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 ... |
Feedback: Incorrect character on line 1 col 1: expected "498", got "0"
Test 22
Group: 1, 2, 3, 4, 5
Verdict: WRONG ANSWER
| input |
|---|
| 10 1 10 * * . * ... |
| correct output |
|---|
| 0 1 1 0 0 ... |
| user output |
|---|
| 10 0 0 0 0 0 0 0 0 0 |
Feedback: Incorrect character on line 1 col 1: expected "0", got "10"
Test 23
Group: 1, 2, 3, 4, 5
Verdict: WRONG ANSWER
| input |
|---|
| 1 10 10 ........*. 1 7 1 10 1 4 1 7 1 5 1 1 ... |
| correct output |
|---|
| 1 1 1 1 1 ... |
| user output |
|---|
| 7 0 0 0 0 0 0 0 0 0 |
Feedback: Incorrect character on line 1 col 1: expected "1", got "7"
Test 24
Group: 5
Verdict: WRONG ANSWER
| input |
|---|
| 250 1 200000 * . * . ... |
| correct output |
|---|
| 1 1 1 1 1 ... |
| user output |
|---|
| 250 0 0 0 0 0 0 0 0 0 0 0 0 0 ... |
Feedback: Incorrect character on line 1 col 1: expected "1", got "250"
Test 25
Group: 5
Verdict: WRONG ANSWER
| input |
|---|
| 1 250 200000 *.*.*...*.*.**.***..**.*.*..**... |
| correct output |
|---|
| 1 1 1 1 1 ... |
| user output |
|---|
| 4 0 0 0 0 0 0 0 0 0 0 0 0 0 0 ... |
Feedback: Incorrect character on line 1 col 1: expected "1", got "4"
Test 26
Group: 5
Verdict: WRONG ANSWER
| input |
|---|
| 250 250 200000 ................................. |
| correct output |
|---|
| 2 2 2 2 2 ... |
| user output |
|---|
| 0 0 18446744073709551613 0 228... |
Feedback: Incorrect character on line 1 col 1: expected "2", got "0"
Test 27
Group: 5
Verdict: WRONG ANSWER
| input |
|---|
| 250 250 200000 ******************************... |
| correct output |
|---|
| 0 0 0 0 0 ... |
| user output |
|---|
| 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 ... |
Feedback: Incorrect character on line 1 col 499: expected "0", got "250"
