CSES - Datatähti 2016 alku - Results
Submission details
Task:Osajono
Sender:KARHU
Submission time:2015-10-05 17:39:00 +0300
Language:C++
Status:READY
Result:39
Feedback
groupverdictscore
#1ACCEPTED12
#2ACCEPTED27
#30
Test results
testverdicttimegroup
#1ACCEPTED0.06 s1details
#2ACCEPTED0.05 s1details
#3ACCEPTED0.06 s1details
#4ACCEPTED0.06 s1details
#5ACCEPTED0.05 s1details
#6ACCEPTED0.05 s2details
#7ACCEPTED0.06 s2details
#8ACCEPTED0.05 s2details
#9ACCEPTED0.06 s2details
#10ACCEPTED0.05 s2details
#110.14 s3details
#120.14 s3details
#130.14 s3details
#140.14 s3details
#150.14 s3details

Compiler report

input/code.cpp: In function 'int main()':
input/code.cpp:14:43: warning: ignoring return value of 'char* fgets(char*, int, FILE*)', declared with attribute warn_unused_result [-Wunused-result]
     fgets(syote, sizeof(syote) + 1, stdin);
                                           ^
In file included from /usr/include/stdio.h:937:0,
                 from input/code.cpp:1:
In function 'char* fgets(char*, int, FILE*)',
    inlined from 'int main()' at input/code.cpp:14:43:
/usr/include/x86_64-linux-gnu/bits/stdio2.h:261:58: warning: call to '__fgets_chk_warn' declared with attribute warning: fgets called with bigger size than length of destination buffer
  return __fgets_chk_warn (__s, __bos (__s), __n, __stream);
                                                          ^

Code

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

int summa(int i)
{
    return i > 0 ? i + summa(i - 1) : 0;
}

int main()
{
    int i, j, k, tuloste = 0;
    char syote[100000] = {0};

    fgets(syote, sizeof(syote) + 1, stdin);
    for(i = 'A'; i < 'Z' + 1; ++i)
    {
        k = 0;
        for(j = 0; syote[j] != 0; ++j)
            if(syote[j] == i || syote[j] == i + 32)
                ++k;

        tuloste += summa(k);
    }

    printf("%u\n", tuloste);
    return 0;
}

Test details

Test 1

Group: 1

Verdict: ACCEPTED

input
BBBAABBBAAAABBAAAABAABAABBBBBB...

correct output
2554

user output
2554

Test 2

Group: 1

Verdict: ACCEPTED

input
GDFVYWQCZAFGICSXOSWBZMGPDBSSVL...

correct output
299

user output
299

Test 3

Group: 1

Verdict: ACCEPTED

input
AAAAAAAAAAAAAAAAAAAAAAAAAZAAAA...

correct output
4314

user output
4314

Test 4

Group: 1

Verdict: ACCEPTED

input
AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA...

correct output
4231

user output
4231

Test 5

Group: 1

Verdict: ACCEPTED

input
QQQQQQQQQQQQQQQQQQQQQQQQQQQQQQ...

correct output
5050

user output
5050

Test 6

Group: 2

Verdict: ACCEPTED

input
BBABABBBABBAABBABBABAABAAABABA...

correct output
6253029

user output
6253029

Test 7

Group: 2

Verdict: ACCEPTED

input
RBKJMLDVQMKHYKCNDIVVKOMFUXTFMG...

correct output
485173

user output
485173

Test 8

Group: 2

Verdict: ACCEPTED

input
AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA...

correct output
12427725

user output
12427725

Test 9

Group: 2

Verdict: ACCEPTED

input
AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA...

correct output
12467549

user output
12467549

Test 10

Group: 2

Verdict: ACCEPTED

input
QQQQQQQQQQQQQQQQQQQQQQQQQQQQQQ...

correct output
12502500

user output
12502500

Test 11

Group: 3

Verdict:

input
BAAAAABABBABAABAABABABBBABBAAB...

correct output
2500051369

user output
(empty)

Error:
*** buffer overflow detected ***: input/code terminated
======= Backtrace: =========
/lib/x86_64-linux-gnu/libc.so.6(+0x77f6f)[0x7fabe962cf6f]
/lib/x86_64-linux-gnu/libc.so.6(__fortify_fail+0x5c)[0x7fabe96c0a7c]
/lib/x86_64-linux-gnu/libc.so.6(+0x109ad0)[0x7fabe96bead0]
/lib/x86_64-linux-gnu/libc.so.6(__fgets_chk+0x129)[0x7fabe96bede9]
input/code[0x4005f2]
/lib/x86_64-linux-gnu/libc.so.6(__libc_start_main+0xf5)[0x7fabe95d6ec5]
input/code[0x4006c1]
======= Memory map: ========
00400000-00401000 r-xp 00000000 00:12 8088753                            /home/runner/input/code
00600000-00601000 r--p 00000000 00:12 8088753                            /home/runner/input/code
00601000-00602000 rw-p 00001000 00:12 8088753                            /home/runner/input/code
00d3b000-00d5c000 rw-p 00000000 00:00 0                                  [heap]
7fabe939e000-7fabe93b4000 r-xp 00000000 00:26 50                         /lib/x86_64-linux-gnu/libgcc_s.so.1
7fabe93b4000-7fabe95b3000 ---p 00016000...

Test 12

Group: 3

Verdict:

input
ABBURXDRVXAYBPXXOQZNYHLWGUEEWR...

correct output
192407124

user output
(empty)

Error:
*** buffer overflow detected ***: input/code terminated
======= Backtrace: =========
/lib/x86_64-linux-gnu/libc.so.6(+0x77f6f)[0x7f329bb0df6f]
/lib/x86_64-linux-gnu/libc.so.6(__fortify_fail+0x5c)[0x7f329bba1a7c]
/lib/x86_64-linux-gnu/libc.so.6(+0x109ad0)[0x7f329bb9fad0]
/lib/x86_64-linux-gnu/libc.so.6(__fgets_chk+0x129)[0x7f329bb9fde9]
input/code[0x4005f2]
/lib/x86_64-linux-gnu/libc.so.6(__libc_start_main+0xf5)[0x7f329bab7ec5]
input/code[0x4006c1]
======= Memory map: ========
00400000-00401000 r-xp 00000000 00:12 8564747                            /home/runner/input/code
00600000-00601000 r--p 00000000 00:12 8564747                            /home/runner/input/code
00601000-00602000 rw-p 00001000 00:12 8564747                            /home/runner/input/code
00fd2000-00ff3000 rw-p 00000000 00:00 0                                  [heap]
7f329b87f000-7f329b895000 r-xp 00000000 00:26 50                         /lib/x86_64-linux-gnu/libgcc_s.so.1
7f329b895000-7f329ba94000 ---p 00016000...

Test 13

Group: 3

Verdict:

input
AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA...

correct output
4998050400

user output
(empty)

Error:
*** buffer overflow detected ***: input/code terminated
======= Backtrace: =========
/lib/x86_64-linux-gnu/libc.so.6(+0x77f6f)[0x7ffb6095af6f]
/lib/x86_64-linux-gnu/libc.so.6(__fortify_fail+0x5c)[0x7ffb609eea7c]
/lib/x86_64-linux-gnu/libc.so.6(+0x109ad0)[0x7ffb609ecad0]
/lib/x86_64-linux-gnu/libc.so.6(__fgets_chk+0x129)[0x7ffb609ecde9]
input/code[0x4005f2]
/lib/x86_64-linux-gnu/libc.so.6(__libc_start_main+0xf5)[0x7ffb60904ec5]
input/code[0x4006c1]
======= Memory map: ========
00400000-00401000 r-xp 00000000 00:12 8088293                            /home/runner/input/code
00600000-00601000 r--p 00000000 00:12 8088293                            /home/runner/input/code
00601000-00602000 rw-p 00001000 00:12 8088293                            /home/runner/input/code
01d4a000-01d6b000 rw-p 00000000 00:00 0                                  [heap]
7ffb606cc000-7ffb606e2000 r-xp 00000000 00:26 50                         /lib/x86_64-linux-gnu/libgcc_s.so.1
7ffb606e2000-7ffb608e1000 ---p 00016000...

Test 14

Group: 3

Verdict:

input
AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA...

correct output
4998850144

user output
(empty)

Error:
*** buffer overflow detected ***: input/code terminated
======= Backtrace: =========
/lib/x86_64-linux-gnu/libc.so.6(+0x77f6f)[0x7f00a457ff6f]
/lib/x86_64-linux-gnu/libc.so.6(__fortify_fail+0x5c)[0x7f00a4613a7c]
/lib/x86_64-linux-gnu/libc.so.6(+0x109ad0)[0x7f00a4611ad0]
/lib/x86_64-linux-gnu/libc.so.6(__fgets_chk+0x129)[0x7f00a4611de9]
input/code[0x4005f2]
/lib/x86_64-linux-gnu/libc.so.6(__libc_start_main+0xf5)[0x7f00a4529ec5]
input/code[0x4006c1]
======= Memory map: ========
00400000-00401000 r-xp 00000000 00:12 8562382                            /home/runner/input/code
00600000-00601000 r--p 00000000 00:12 8562382                            /home/runner/input/code
00601000-00602000 rw-p 00001000 00:12 8562382                            /home/runner/input/code
010a8000-010c9000 rw-p 00000000 00:00 0                                  [heap]
7f00a42f1000-7f00a4307000 r-xp 00000000 00:26 50                         /lib/x86_64-linux-gnu/libgcc_s.so.1
7f00a4307000-7f00a4506000 ---p 00016000...

Test 15

Group: 3

Verdict:

input
QQQQQQQQQQQQQQQQQQQQQQQQQQQQQQ...

correct output
5000050000

user output
(empty)

Error:
*** buffer overflow detected ***: input/code terminated
======= Backtrace: =========
/lib/x86_64-linux-gnu/libc.so.6(+0x77f6f)[0x7f52b54e8f6f]
/lib/x86_64-linux-gnu/libc.so.6(__fortify_fail+0x5c)[0x7f52b557ca7c]
/lib/x86_64-linux-gnu/libc.so.6(+0x109ad0)[0x7f52b557aad0]
/lib/x86_64-linux-gnu/libc.so.6(__fgets_chk+0x129)[0x7f52b557ade9]
input/code[0x4005f2]
/lib/x86_64-linux-gnu/libc.so.6(__libc_start_main+0xf5)[0x7f52b5492ec5]
input/code[0x4006c1]
======= Memory map: ========
00400000-00401000 r-xp 00000000 00:12 8562516                            /home/runner/input/code
00600000-00601000 r--p 00000000 00:12 8562516                            /home/runner/input/code
00601000-00602000 rw-p 00001000 00:12 8562516                            /home/runner/input/code
025f2000-02613000 rw-p 00000000 00:00 0                                  [heap]
7f52b525a000-7f52b5270000 r-xp 00000000 00:26 50                         /lib/x86_64-linux-gnu/libgcc_s.so.1
7f52b5270000-7f52b546f000 ---p 00016000...