| Task: | Monistus |
| Sender: | cylaps |
| Submission time: | 2023-11-12 20:01:51 +0200 |
| Language: | C++ (C++11) |
| Status: | READY |
| Result: | 0 |
| group | verdict | score |
|---|---|---|
| #1 | WRONG ANSWER | 0 |
| #2 | WRONG ANSWER | 0 |
| test | verdict | time | group | |
|---|---|---|---|---|
| #1 | WRONG ANSWER | 0.00 s | 1, 2 | details |
| #2 | WRONG ANSWER | 0.00 s | 1, 2 | details |
| #3 | WRONG ANSWER | 0.00 s | 1, 2 | details |
| #4 | WRONG ANSWER | 0.00 s | 1, 2 | details |
| #5 | WRONG ANSWER | 0.00 s | 1, 2 | details |
| #6 | WRONG ANSWER | 0.00 s | 1, 2 | details |
| #7 | WRONG ANSWER | 0.00 s | 1, 2 | details |
| #8 | WRONG ANSWER | 0.00 s | 2 | details |
| #9 | WRONG ANSWER | 0.01 s | 2 | details |
| #10 | WRONG ANSWER | 0.01 s | 2 | details |
| #11 | WRONG ANSWER | 0.01 s | 2 | details |
| #12 | WRONG ANSWER | 0.01 s | 2 | details |
| #13 | WRONG ANSWER | 0.01 s | 2 | details |
| #14 | WRONG ANSWER | 0.01 s | 2 | details |
Compiler report
input/code.cpp: In function 'int main()':
input/code.cpp:36:10: warning: ignoring return value of 'ssize_t write(int, const void*, size_t)' declared with attribute 'warn_unused_result' [-Wunused-result]
36 | write(STDOUT_FILENO, oc, 500000 + o - oc);
| ~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~Code
#include <unistd.h>
#include <stdio.h>
#include <string.h>
#include <stdint.h>
typedef unsigned char u1;
typedef uint64_t u8;
int main() {
u1 i[500001];
u1 o[500000];
uint64_t il = read(STDIN_FILENO, i, 500001);
u1 *oc = o + 500000 - 1;
for (u1 *ic = i + il - 2; ic >= i; ic--) {
if (*ic - (u1)'0' > 9) {
*oc = *ic;
oc--;
} else {
u8 l = *ic - (u1)'0';
for (u1 *icc = ic + l; icc > ic; icc--) {
if (*icc - (u1)'0' > 9) {
*oc = *icc;
oc--;
} else {
u8 l2 = *icc - (u1)'0';
oc -= l2 - 1;
memcpy(oc, oc + l2, l2);
oc -= 1;
}
}
}
}
write(STDOUT_FILENO, oc, 500000 + o - oc);
printf("\n");
return 0;
}
