CSES - Aalto Competitive Programming 2024 - wk7 - Wed - Results
Submission details
Task:Shortest palindrome
Sender:aalto2024h_005
Submission time:2024-10-23 16:37:29 +0300
Language:C++ (C++11)
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
#190.00 sdetails
#200.01 sdetails
#210.00 sdetails
#220.00 sdetails
#230.00 sdetails
#240.00 sdetails
#250.00 sdetails
#260.00 sdetails
#270.00 sdetails
#280.00 sdetails
#290.00 sdetails
#300.00 sdetails
#310.00 sdetails
#320.00 sdetails
#330.00 sdetails
#340.00 sdetails
#350.00 sdetails
#360.00 sdetails
#370.00 sdetails
#380.00 sdetails
#390.00 sdetails
#400.00 sdetails
#410.00 sdetails
#420.00 sdetails
#430.00 sdetails
#440.00 sdetails
#450.00 sdetails
#460.00 sdetails
#470.00 sdetails
#480.00 sdetails
#490.00 sdetails
#500.00 sdetails
#510.00 sdetails
#520.00 sdetails
#530.00 sdetails
#540.00 sdetails
#550.00 sdetails
#560.00 sdetails
#570.00 sdetails
#580.00 sdetails
#590.00 sdetails
#600.00 sdetails
#610.00 sdetails
#620.00 sdetails
#630.00 sdetails
#640.00 sdetails
#650.00 sdetails
#660.00 sdetails
#670.00 sdetails
#680.00 sdetails

Code

#include <bits/stdc++.h>

using namespace std;


int main() {
	int n;
    long long x;

	cin >> n >> x;

	vector<pair<long long, int>> arr;

	for (int i = 1; i <= n; i++) {

		long long a;

		cin >> a;

		pair<int, int> p;

		p.first = a;

		p.second = i;

		arr.push_back(p);

	}

	sort(begin(arr), end(arr));

	for (int i = 0; i < n; i++) {

		int l, r;

		l = 0;

		r = n - 1;

		while (l != r) {

			int target;

			target = x - arr.at(i).first;

			if (l != i && r != i && arr.at(l).first + arr.at(r).first == target) {

				cout << arr.at(i).second << " " << arr.at(l).second << " "

				     << arr.at(r).second << endl;

				return 0;

			}

			if (arr.at(l).first + arr.at(r).first < target) {

				l++;

			} else {

				r--;

			}

		}

	}

	cout << "IMPOSSIBLE" << endl;

}

Test details

Test 1

Verdict:

input
sl

correct output
-1

user output
IMPOSSIBLE

Test 2

Verdict:

input
uz

correct output
-1

user output
IMPOSSIBLE

Test 3

Verdict:

input
vum

correct output
-1

user output
IMPOSSIBLE

Test 4

Verdict:

input
ltw

correct output
-1

user output
IMPOSSIBLE

Test 5

Verdict:

input
srhm

correct output
-1

user output
IMPOSSIBLE

Test 6

Verdict:

input
agwj

correct output
-1

user output
IMPOSSIBLE

Test 7

Verdict:

input
vcgm

correct output
-1

user output
IMPOSSIBLE

Test 8

Verdict:

input
cwld

correct output
-1

user output
IMPOSSIBLE

Test 9

Verdict:

input
psvpw

correct output
-1

user output
IMPOSSIBLE

Test 10

Verdict:

input
zsyad

correct output
-1

user output
IMPOSSIBLE

Test 11

Verdict:

input
eayoy

correct output
3

user output
IMPOSSIBLE

Test 12

Verdict:

input
bsvhd

correct output
-1

user output
IMPOSSIBLE

Test 13

Verdict:

input
xezws

correct output
-1

user output
IMPOSSIBLE

Test 14

Verdict:

input
bwvfj

correct output
-1

user output
IMPOSSIBLE

Test 15

Verdict:

input
yfvbj

correct output
-1

user output
IMPOSSIBLE

Test 16

Verdict:

input
fuilz

correct output
-1

user output
IMPOSSIBLE

Test 17

Verdict:

input
agwjn

correct output
-1

user output
IMPOSSIBLE

Test 18

Verdict:

input
jnmma

correct output
2

user output
IMPOSSIBLE

Test 19

Verdict:

input
psvpwowlqj

correct output
3

user output
IMPOSSIBLE

Test 20

Verdict:

input
zsyadhzdgc

correct output
-1

user output
IMPOSSIBLE

Test 21

Verdict:

input
eayoylmkie

correct output
3

user output
IMPOSSIBLE

Test 22

Verdict:

input
bsvhdnoxlx

correct output
3

user output
IMPOSSIBLE

Test 23

Verdict:

input
xezwspfdzf

correct output
-1

user output
IMPOSSIBLE

Test 24

Verdict:

input
bwvfjxzmcp

correct output
-1

user output
IMPOSSIBLE

Test 25

Verdict:

input
yfvbjczpcn

correct output
-1

user output
IMPOSSIBLE

Test 26

Verdict:

input
fuilzslzio

correct output
-1

user output
IMPOSSIBLE

Test 27

Verdict:

input
agwjnvgkap

correct output
-1

user output
IMPOSSIBLE

Test 28

Verdict:

input
jnmmadidaf

correct output
2

user output
IMPOSSIBLE

Test 29

Verdict:

input
psvpwowlqjlhxbzhjmuvnmokyvbicq...

correct output
3

user output
IMPOSSIBLE

Test 30

Verdict:

input
zsyadhzdgckekirkyowkirnflwfanr...

correct output
3

user output
IMPOSSIBLE

Test 31

Verdict:

input
eayoylmkiefsqdhmgqvnrdmnpesugw...

correct output
3

user output
IMPOSSIBLE

Test 32

Verdict:

input
bsvhdnoxlxadbfgbclsadlqfhjrmpx...

correct output
3

user output
IMPOSSIBLE

Test 33

Verdict:

input
xezwspfdzfasgxlquafowjzpekpvap...

correct output
-1

user output
IMPOSSIBLE

Test 34

Verdict:

input
bwvfjxzmcpktjnmhzevcqtvlgetwch...

correct output
3

user output
IMPOSSIBLE

Test 35

Verdict:

input
yfvbjczpcnpknimqvltkngpeqszxvm...

correct output
-1

user output
IMPOSSIBLE

Test 36

Verdict:

input
fuilzslziogncbkgamnrwuijkbrhrx...

correct output
2

user output
IMPOSSIBLE

Test 37

Verdict:

input
agwjnvgkapltknwmyodstksvqaljhm...

correct output
-1

user output
IMPOSSIBLE

Test 38

Verdict:

input
jnmmadidafwkdgdckimeiwjytbzsso...

correct output
2

user output
IMPOSSIBLE

Test 39

Verdict:

input
psvpwowlqjlhxbzhjmuvnmokyvbicq...

correct output
3

user output
IMPOSSIBLE

Test 40

Verdict:

input
zsyadhzdgckekirkyowkirnflwfanr...

correct output
3

user output
IMPOSSIBLE

Test 41

Verdict:

input
eayoylmkiefsqdhmgqvnrdmnpesugw...

correct output
3

user output
IMPOSSIBLE

Test 42

Verdict:

input
bsvhdnoxlxadbfgbclsadlqfhjrmpx...

correct output
3

user output
IMPOSSIBLE

Test 43

Verdict:

input
xezwspfdzfasgxlquafowjzpekpvap...

correct output
-1

user output
IMPOSSIBLE

Test 44

Verdict:

input
bwvfjxzmcpktjnmhzevcqtvlgetwch...

correct output
2

user output
IMPOSSIBLE

Test 45

Verdict:

input
yfvbjczpcnpknimqvltkngpeqszxvm...

correct output
-1

user output
IMPOSSIBLE

Test 46

Verdict:

input
fuilzslziogncbkgamnrwuijkbrhrx...

correct output
2

user output
IMPOSSIBLE

Test 47

Verdict:

input
agwjnvgkapltknwmyodstksvqaljhm...

correct output
-1

user output
IMPOSSIBLE

Test 48

Verdict:

input
jnmmadidafwkdgdckimeiwjytbzsso...

correct output
2

user output
IMPOSSIBLE

Test 49

Verdict:

input
psvpwowlqjlhxbzhjmuvnmokyvbicq...

correct output
3

user output
IMPOSSIBLE

Test 50

Verdict:

input
zsyadhzdgckekirkyowkirnflwfanr...

correct output
3

user output
IMPOSSIBLE

Test 51

Verdict:

input
eayoylmkiefsqdhmgqvnrdmnpesugw...

correct output
3

user output
IMPOSSIBLE

Test 52

Verdict:

input
bsvhdnoxlxadbfgbclsadlqfhjrmpx...

correct output
3

user output
IMPOSSIBLE

Test 53

Verdict:

input
xezwspfdzfasgxlquafowjzpekpvap...

correct output
-1

user output
IMPOSSIBLE

Test 54

Verdict:

input
bwvfjxzmcpktjnmhzevcqtvlgetwch...

correct output
2

user output
IMPOSSIBLE

Test 55

Verdict:

input
yfvbjczpcnpknimqvltkngpeqszxvm...

correct output
-1

user output
IMPOSSIBLE

Test 56

Verdict:

input
fuilzslziogncbkgamnrwuijkbrhrx...

correct output
2

user output
IMPOSSIBLE

Test 57

Verdict:

input
agwjnvgkapltknwmyodstksvqaljhm...

correct output
-1

user output
IMPOSSIBLE

Test 58

Verdict:

input
jnmmadidafwkdgdckimeiwjytbzsso...

correct output
2

user output
IMPOSSIBLE

Test 59

Verdict:

input
psvpwowlqjlhxbzhjmuvnmokyvbicq...

correct output
3

user output
IMPOSSIBLE

Test 60

Verdict:

input
zsyadhzdgckekirkyowkirnflwfanr...

correct output
3

user output
IMPOSSIBLE

Test 61

Verdict:

input
eayoylmkiefsqdhmgqvnrdmnpesugw...

correct output
3

user output
IMPOSSIBLE

Test 62

Verdict:

input
bsvhdnoxlxadbfgbclsadlqfhjrmpx...

correct output
3

user output
IMPOSSIBLE

Test 63

Verdict:

input
xezwspfdzfasgxlquafowjzpekpvap...

correct output
-1

user output
IMPOSSIBLE

Test 64

Verdict:

input
bwvfjxzmcpktjnmhzevcqtvlgetwch...

correct output
2

user output
IMPOSSIBLE

Test 65

Verdict:

input
yfvbjczpcnpknimqvltkngpeqszxvm...

correct output
-1

user output
IMPOSSIBLE

Test 66

Verdict:

input
fuilzslziogncbkgamnrwuijkbrhrx...

correct output
2

user output
IMPOSSIBLE

Test 67

Verdict:

input
agwjnvgkapltknwmyodstksvqaljhm...

correct output
-1

user output
IMPOSSIBLE

Test 68

Verdict:

input
jnmmadidafwkdgdckimeiwjytbzsso...

correct output
2

user output
IMPOSSIBLE