CSES - Datatähti 2024 loppu - Results
Submission details
Task:Palindromi
Sender:ToukoP
Submission time:2024-01-20 13:09:50 +0200
Language:C++ (C++11)
Status:READY
Result:0
Feedback
groupverdictscore
#10
Test results
testverdicttime
#1ACCEPTED0.00 sdetails
#2ACCEPTED0.00 sdetails
#30.00 sdetails
#4ACCEPTED0.00 sdetails
#5ACCEPTED0.00 sdetails
#60.00 sdetails
#7ACCEPTED0.00 sdetails
#8ACCEPTED0.00 sdetails
#9ACCEPTED0.00 sdetails
#100.00 sdetails
#11ACCEPTED0.00 sdetails
#12ACCEPTED0.00 sdetails
#130.00 sdetails
#14ACCEPTED0.00 sdetails
#15ACCEPTED0.00 sdetails
#160.00 sdetails
#170.00 sdetails

Code

#include <bits/stdc++.h>

using namespace std;

int main() {
    string abc = "abcdefghijklmnopqrstuvwyxz";
    int n;
    int k;
    cin >> n >> k;

    int o = 0;
    int c = 0;
    while (true) {
        for (int i = 0; i < k; i++) {
            cout << abc[(min(i, k - i) + o) % abc.length()];
            c++;
            if (c == n) {
                return 0;
            }
        }
        o++;
    }

}

// g++ --std=c++11 -O2 -Wall test.cpp -o test && ./test

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:

input
2 2

correct output
aa

user output
ab

Test 4

Verdict: ACCEPTED

input
3 1

correct output
abc

user output
abc

Test 5

Verdict: ACCEPTED

input
3 2

correct output
aab

user output
abb

Test 6

Verdict:

input
3 3

correct output
aaa

user output
abb

Test 7

Verdict: ACCEPTED

input
4 1

correct output
abca

user output
abcd

Test 8

Verdict: ACCEPTED

input
4 2

correct output
aabc

user output
abbc

Test 9

Verdict: ACCEPTED

input
4 3

correct output
aaab

user output
abbb

Test 10

Verdict:

input
4 4

correct output
aaaa

user output
abcb

Test 11

Verdict: ACCEPTED

input
100 1

correct output
abcabcabcabcabcabcabcabcabcabc...

user output
abcdefghijklmnopqrstuvwyxzabcd...
Truncated

Test 12

Verdict: ACCEPTED

input
100 2

correct output
aabcabcabcabcabcabcabcabcabcab...

user output
abbccddeeffgghhiijjkkllmmnnoop...
Truncated

Test 13

Verdict:

input
100 5

correct output
aaaaabcabcabcabcabcabcabcabcab...

user output
abccbbcddccdeeddeffeefggffghhg...
Truncated

Test 14

Verdict: ACCEPTED

input
100 10

correct output
aaaaaaaaaabcabcabcabcabcabcabc...

user output
abcdefedcbbcdefgfedccdefghgfed...
Truncated

Test 15

Verdict: ACCEPTED

input
100 50

correct output
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaa...

user output
abcdefghijklmnopqrstuvwyxzxywv...
Truncated

Test 16

Verdict:

input
100 90

correct output
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaa...

user output
abcdefghijklmnopqrstuvwyxzabcd...
Truncated

Test 17

Verdict:

input
100 100

correct output
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaa...

user output
abcdefghijklmnopqrstuvwyxzabcd...
Truncated