CSES - Datatähti 2022 alku - Results
Submission details
Task:Merkkijono
Sender:rixu
Submission time:2021-10-08 00:52:57 +0300
Language:C++ (C++11)
Status:READY
Result:0
Feedback
groupverdictscore
#10
Test results
testverdicttime
#1ACCEPTED0.01 sdetails
#2ACCEPTED0.00 sdetails
#30.00 sdetails
#40.01 sdetails
#50.01 sdetails
#60.00 sdetails
#70.00 sdetails
#80.00 sdetails
#90.01 sdetails
#100.01 sdetails
#110.00 sdetails
#120.01 sdetails
#130.00 sdetails
#140.00 sdetails
#150.01 sdetails
#160.01 sdetails

Code

#include <stdio.h>
#include <stdlib.h>
#include <string.h>

#pragma GCC diagnostic ignored "-Wunused-result"

unsigned long function(unsigned long x) { return x*x-x+1; }

int main()
{
    unsigned long n;

    scanf("%lu", &n);

    unsigned long length = function(n);
    char* string = (char*)malloc(length + 1);
    string[0] = 'a';
    string[length] = 0;

    unsigned long index = 1;

    for(unsigned long i = 1; i < n; i++)
    {
        string[index] = 'a';
        for(unsigned long j = 0; j < index; j++) { string[j]++; }
        memcpy(string + index + 1, string, index);

        index = function(i + 1) + 1;
    }

    printf("%s", string);

}

#pragma GCC diagnostic pop

Test details

Test 1

Verdict: ACCEPTED

input
1

correct output
a

user output
a

Test 2

Verdict: ACCEPTED

input
2

correct output
bab

user output
bab

Test 3

Verdict:

input
3

correct output
cbcacbc

user output
cbcacbc

Test 4

Verdict:

input
4

correct output
dcdbdcdadcdbdcd

user output
dcdbdcdadcdbdcd

Test 5

Verdict:

input
5

correct output
edecedebedecedeaedecedebedeced...

user output
edecedebedecaedecedeb

Test 6

Verdict:

input
6

correct output
fefdfefcfefdfefbfefdfefcfefdfe...

user output
fefdfefcfefdbfefdfeafefdfe...

Test 7

Verdict:

input
7

correct output
gfgegfgdgfgegfgcgfgegfgdgfgegf...

user output
gfgegfgdgfgecgfgegfbgfgegf...

Test 8

Verdict:

input
8

correct output
hghfhghehghfhghdhghfhghehghfhg...

user output
hghfhghehghfdhghfhgchghfhg...

Test 9

Verdict:

input
9

correct output
ihigihifihigihieihigihifihigih...

user output
ihigihifihigeihigihdihigih...
Truncated

Test 10

Verdict:

input
10

correct output
jijhjijgjijhjijfjijhjijgjijhji...

user output
jijhjijgjijhfjijhjiejijhji...
Truncated

Test 11

Verdict:

input
11

correct output
kjkikjkhkjkikjkgkjkikjkhkjkikj...

user output
kjk ikjkhkjk igkjk ikjfkjk ikj...
Truncated

Test 12

Verdict:

input
12

correct output
lkljlklilkljlklhlkljlklilkljlk...

user output
lkl
jlklilkl
jhlkl
jlkglkl
jlkliflkl
...
Truncated

Test 13

Verdict:

input
13

correct output
mlmkmlmjmlmkmlmimlmkmlmjmlmkml...

user output
mlm kmlmjmlm kimlm kmlhmlm kml...
Truncated

Test 14

Verdict:

input
14

correct output
nmnlnmnknmnlnmnjnmnlnmnknmnlnm...

user output
nmn lnmnknmn ljnmn lnminmn lnm...
Truncated

Test 15

Verdict:

input
15

correct output
onomonolonomonokonomonolonomon...

user output
ono monolono mkono monjono mon...
Truncated

Test 16

Verdict:

input
16

correct output
popnpopmpopnpoplpopnpopmpopnpo...

user output
popnpopmpopnlpopnpokpopnpo...
Truncated