CSES - Aalto Competitive Programming 2024 - wk9 - Mon - Results
Submission details
Task:String padding
Sender:ilyas.ben
Submission time:2024-11-04 16:49:40 +0200
Language:C++ (C++20)
Status:READY
Result:
Test results
testverdicttime
#10.00 sdetails
#20.00 sdetails
#30.00 sdetails
#40.00 sdetails
#50.00 sdetails
#60.00 sdetails
#70.00 sdetails
#80.00 sdetails
#90.00 sdetails
#100.00 sdetails
#110.00 sdetails
#120.00 sdetails
#130.00 sdetails
#140.00 sdetails
#150.00 sdetails
#160.00 sdetails
#170.00 sdetails
#180.00 sdetails

Code

#include <iostream>
#include <string>

using namespace std;

string chessPawnTour(long long  n, long long m) {
    if ((n * m) % 2 != 0) {
        return "-1";
    }

    string moves;

    for (int i = 0; i < n; ++i) {
        if (i % 2 == 0) {
            moves.append(m - 1, 'R');
            if (i < n - 1) {
                moves += 'D';
            }
        } else {
            moves.append(m - 1, 'L');
            if (i < n - 1) {
                moves += 'D';
            }
        }
    }

    moves.append(n - 1, 'U');
    moves += 'L';

    return moves;
}

int main() {
    long long n, m;
    cin >> n >> m;
    string result = chessPawnTour(n, m);
    cout << result << endl;
    return 0;
}

Test details

Test 1

Verdict:

input
100
YWANYWAZYWANYWA

correct output
134837038

user output
(empty)

Error:
terminate called after throwing an instance of 'std::length_error'
  what():  basic_string::_M_replace_aux

Test 2

Verdict:

input
100
EDMXEDVNEDMXED

correct output
642715950

user output
(empty)

Error:
terminate called after throwing an instance of 'std::length_error'
  what():  basic_string::_M_replace_aux

Test 3

Verdict:

input
100
SDARSDAWVSDARSDA

correct output
748728234

user output
(empty)

Error:
terminate called after throwing an instance of 'std::length_error'
  what():  basic_string::_M_replace_aux

Test 4

Verdict:

input
100
HBDHBSHBDHB

correct output
594110560

user output
(empty)

Error:
terminate called after throwing an instance of 'std::length_error'
  what():  basic_string::_M_replace_aux

Test 5

Verdict:

input
100
CUNXUYGNGNEROXVLASQB

correct output
675706202

user output
(empty)

Error:
terminate called after throwing an instance of 'std::length_error'
  what():  basic_string::_M_replace_aux

Test 6

Verdict:

input
1000
LZAOLRKGLZAOLXLZAOLRKGLZAOLTLZ...

correct output
318756627

user output
(empty)

Error:
terminate called after throwing an instance of 'std::length_error'
  what():  basic_string::_M_replace_aux

Test 7

Verdict:

input
1000
SUASJSUASSGDSUASJSUASGKSUASJSU...

correct output
367950233

user output
(empty)

Error:
terminate called after throwing an instance of 'std::length_error'
  what():  basic_string::_M_replace_aux

Test 8

Verdict:

input
1000
NHYGNHEWNHYGNHFSNHYGNHEWNHYGNH...

correct output
849646061

user output
(empty)

Error:
terminate called after throwing an instance of 'std::length_error'
  what():  basic_string::_M_replace_aux

Test 9

Verdict:

input
1000
ZOCUZOCGRFZOCUZOCOQZOCUZOCGRFZ...

correct output
32142571

user output
(empty)

Error:
terminate called after throwing an instance of 'std::length_error'
  what():  basic_string::_M_replace_aux

Test 10

Verdict:

input
1000
LJZMKDTECKBXBTQQUMLGADBDNGWGPY...

correct output
26128120

user output
(empty)

Error:
terminate called after throwing an instance of 'std::length_error'
  what():  basic_string::_M_replace_aux

Test 11

Verdict:

input
1
A

correct output
1

user output
(empty)

Error:
terminate called after throwing an instance of 'std::length_error'
  what():  basic_string::_M_replace_aux

Test 12

Verdict:

input
100
AVXETIDRHKPAKRBEAAVHLOPFACULSE...

correct output
228794815

user output
(empty)

Error:
terminate called after throwing an instance of 'std::length_error'
  what():  basic_string::_M_replace_aux

Test 13

Verdict:

input
3
ABC

correct output
1

user output
(empty)

Error:
terminate called after throwing an instance of 'std::length_error'
  what():  basic_string::_M_replace_aux

Test 14

Verdict:

input
745
RRQOVUJRQBIMIQK

correct output
504765084

user output
(empty)

Error:
terminate called after throwing an instance of 'std::length_error'
  what():  basic_string::_M_replace_aux

Test 15

Verdict:

input
666
ABCABCDABCABCX

correct output
920654188

user output
(empty)

Error:
terminate called after throwing an instance of 'std::length_error'
  what():  basic_string::_M_replace_aux

Test 16

Verdict:

input
6
AA

correct output
2212651

user output
(empty)

Error:
terminate called after throwing an instance of 'std::length_error'
  what():  basic_string::_M_replace_aux

Test 17

Verdict:

input
1
B

correct output
1

user output
(empty)

Error:
terminate called after throwing an instance of 'std::length_error'
  what():  basic_string::_M_replace_aux

Test 18

Verdict:

input
1000
OMAKARAAA

correct output
408042378

user output
(empty)

Error:
terminate called after throwing an instance of 'std::length_error'
  what():  basic_string::_M_replace_aux