CSES - Datatähti 2024 loppu - Results
Submission details
Task:Palindromi
Sender:andreibe
Submission time:2024-01-20 13:05:12 +0200
Language:C++ (C++11)
Status:READY
Result:0
Feedback
groupverdictscore
#10
Test results
testverdicttime
#1ACCEPTED0.00 sdetails
#2ACCEPTED0.00 sdetails
#3ACCEPTED0.00 sdetails
#40.00 sdetails
#5ACCEPTED0.00 sdetails
#6ACCEPTED0.00 sdetails
#70.00 sdetails
#80.00 sdetails
#9ACCEPTED0.00 sdetails
#10ACCEPTED0.00 sdetails
#11ACCEPTED0.00 sdetails
#12ACCEPTED0.00 sdetails
#13ACCEPTED0.00 sdetails
#14ACCEPTED0.00 sdetails
#15ACCEPTED0.00 sdetails
#16ACCEPTED0.00 sdetails
#17ACCEPTED0.00 sdetails

Compiler report

input/code.cpp: In function 'int main()':
input/code.cpp:15:9: warning: unused variable 'end' [-Wunused-variable]
   15 |     int end = rest - start;
      |         ^~~

Code

#include <bits/stdc++.h>
using namespace std;


char ch[110];


int main() {
    int n, k;
    cin >> n >> k;

    int rest = n - k;

    int start = rest / 2;
    int end = rest - start;

    char c = 'a';
    for (int i = 0; i < start; i++)
    {
        ch[i] = c;
        c++;
        if (c == 'z') c = 'a';
    }
    for (int i = start; i < start + k; i++)
    {
        ch[i] = 'a';
    }
    c = 'b';
    for (int i = start + k; i < n; i++)
    {
        ch[i] = c;
        c++;
        if (c == 'z') c = 'a';
    }
    
    cout << ch;
}

Test details

Test 1

Verdict: ACCEPTED

input
1 1

correct output
a

user output
a

Test 2

Verdict: ACCEPTED

input
2 1

correct output
ab

user output
ab

Test 3

Verdict: ACCEPTED

input
2 2

correct output
aa

user output
aa

Test 4

Verdict:

input
3 1

correct output
abc

user output
aab

Test 5

Verdict: ACCEPTED

input
3 2

correct output
aab

user output
aab

Test 6

Verdict: ACCEPTED

input
3 3

correct output
aaa

user output
aaa

Test 7

Verdict:

input
4 1

correct output
abca

user output
aabc

Test 8

Verdict:

input
4 2

correct output
aabc

user output
aaab

Test 9

Verdict: ACCEPTED

input
4 3

correct output
aaab

user output
aaab

Test 10

Verdict: ACCEPTED

input
4 4

correct output
aaaa

user output
aaaa

Test 11

Verdict: ACCEPTED

input
100 1

correct output
abcabcabcabcabcabcabcabcabcabc...

user output
abcdefghijklmnopqrstuvwxyabcde...
Truncated

Test 12

Verdict: ACCEPTED

input
100 2

correct output
aabcabcabcabcabcabcabcabcabcab...

user output
abcdefghijklmnopqrstuvwxyabcde...
Truncated

Test 13

Verdict: ACCEPTED

input
100 5

correct output
aaaaabcabcabcabcabcabcabcabcab...

user output
abcdefghijklmnopqrstuvwxyabcde...
Truncated

Test 14

Verdict: ACCEPTED

input
100 10

correct output
aaaaaaaaaabcabcabcabcabcabcabc...

user output
abcdefghijklmnopqrstuvwxyabcde...
Truncated

Test 15

Verdict: ACCEPTED

input
100 50

correct output
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaa...

user output
abcdefghijklmnopqrstuvwxyaaaaa...
Truncated

Test 16

Verdict: ACCEPTED

input
100 90

correct output
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaa...

user output
abcdeaaaaaaaaaaaaaaaaaaaaaaaaa...
Truncated

Test 17

Verdict: ACCEPTED

input
100 100

correct output
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaa...

user output
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaa...
Truncated