CSES - Leirikisa 4 - Results
Submission details
Task:slom
Sender:zxc
Submission time:2016-08-01 15:27:42 +0300
Language:C++
Status:READY
Result:100
Feedback
groupverdictscore
#1ACCEPTED100
Test results
testverdicttime
#1ACCEPTED0.05 sdetails
#2ACCEPTED0.05 sdetails
#3ACCEPTED0.06 sdetails
#4ACCEPTED0.05 sdetails
#5ACCEPTED0.05 sdetails
#6ACCEPTED0.06 sdetails
#7ACCEPTED0.06 sdetails
#8ACCEPTED0.05 sdetails
#9ACCEPTED0.05 sdetails
#10ACCEPTED0.05 sdetails
#11ACCEPTED0.06 sdetails
#12ACCEPTED0.06 sdetails
#13ACCEPTED0.06 sdetails

Compiler report

input/code.cpp: In function 'int main()':
input/code.cpp:13:9: warning: unused variable 'z' [-Wunused-variable]
     int z = 0;
         ^

Code

#include <bits/stdc++.h>
using namespace std;
int q[2111];
int q2[2111];
int ans[1111];
int ans2[1111];
int lolans[1111];
int main() {
    int x;
    string s;
    cin>>x>>s;
    int n = s.size();
    int z = 0;

    for(int i = 0; i < n; ++i) {
	q[i*2] = i;
	q[i*2+1] = n-i-1;
	ans[i] = i;
    }
    for(; x; x/=2) {
	if(x&1) {
	    for(int i = 0; i < n; ++i) {
		ans2[i] = ans[q[i]];
	    }
	    memcpy(ans, ans2, sizeof ans);
	}
	for(int i = 0; i < n; ++i) {
	    q2[i] = q[q[i]];
	}
	memcpy(q, q2, sizeof q);
    }
    for(int i = 0; i < n; ++i) {
	//cout<<ans[i]<<' ';
	lolans[ans[i]] = i;
    }
    //cout<<'\n';
    for(int i = 0; i < n; ++i) {
	cout<<s[lolans[i]];
    }
    cout<<'\n';
}

Test details

Test 1

Verdict: ACCEPTED

input
4
acefdb

correct output
abcdef

user output
abcdef

Test 2

Verdict: ACCEPTED

input
1000
aaaaaa

correct output
aaaaaa

user output
aaaaaa

Test 3

Verdict: ACCEPTED

input
11
srama

correct output
sarma

user output
sarma

Test 4

Verdict: ACCEPTED

input
10
tbqhcahaje

correct output
tqchjeaahb

user output
tqchjeaahb

Test 5

Verdict: ACCEPTED

input
50
mvkaysdrpqkahelvtxwd

correct output
myphtdvaravsqexwlkdk

user output
myphtdvaravsqexwlkdk

Test 6

Verdict: ACCEPTED

input
60
hfhnhgjyqegacpwcvieckehtayuqgi...

correct output
hhqcvkagqtccaynfgepieyiuhewgjh...

user output
hhqcvkagqtccaynfgepieyiuhewgjh

Test 7

Verdict: ACCEPTED

input
100
kqrminhwirfjvnliauxbnltmdxexqg...

correct output
kddjxfpoagwhrigjcifgqxwynfwckj...

user output
kddjxfpoagwhrigjcifgqxwynfwckj...

Test 8

Verdict: ACCEPTED

input
100
renxibkpvavjnopqftypofrtfbfkke...

correct output
rpmkvedndjakqcrybmuywbnqspjraq...

user output
rpmkvedndjakqcrybmuywbnqspjraq...

Test 9

Verdict: ACCEPTED

input
98765322
pjbsuxmdxyoxmlfokhmgpcnebqcpyx...

correct output
pgypycmdmnjkrlkcaqtrwyhdswtmne...

user output
pgypycmdmnjkrlkcaqtrwyhdswtmne...

Test 10

Verdict: ACCEPTED

input
33892018
bmrtldbdycikkknkifujppdldpqxee...

correct output
bwxqwwogalkjqrrarbqlrekfxoltkf...

user output
bwxqwwogalkjqrrarbqlrekfxoltkf...

Test 11

Verdict: ACCEPTED

input
839254838
xjvoqfnjtgcscdexvaccdetxxppgsl...

correct output
xvuocylqxrdedqcirbveydcculfmev...

user output
xvuocylqxrdedqcirbveydcculfmev...

Test 12

Verdict: ACCEPTED

input
1000000000
rsiufeylcjcvvyaxuknaxpjmelvugt...

correct output
rifyccvaunxjevgumtjieklaxggldh...

user output
rifyccvaunxjevgumtjieklaxggldh...

Test 13

Verdict: ACCEPTED

input
997997997
pintfuxuddywgihkulppiuhwdpofbc...

correct output
pasfapecysfwqommqhotrublrmbpdn...

user output
pasfapecysfwqommqhotrublrmbpdn...