CSES - Leirikisa 4 - Results
Submission details
Task:slom
Sender:Hansuzu
Submission time:2016-08-01 15:36:27 +0300
Language:C++
Status:READY
Result:0
Feedback
groupverdictscore
#10
Test results
testverdicttime
#1ACCEPTED0.06 sdetails
#2ACCEPTED0.06 sdetails
#3ACCEPTED0.06 sdetails
#4ACCEPTED0.06 sdetails
#50.06 sdetails
#6ACCEPTED0.05 sdetails
#70.06 sdetails
#80.06 sdetails
#9ACCEPTED0.05 sdetails
#100.05 sdetails
#110.05 sdetails
#12ACCEPTED0.06 sdetails
#13ACCEPTED0.05 sdetails

Compiler report

input/code.cpp: In function 'int main()':
input/code.cpp:19:26: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
   for (int i=0; i<s.size(); ++i){
                          ^

Code

#include <iostream>
using namespace std;
int X;
string s;

int n[1010];
char ans[1010];

int main(){
  cin >> X >> s;
  X%=(s.size()-1);
  X=(s.size()-1)-X;
  for (int i=1; i<((int)s.size()-1)/2+1; ++i){
    n[i]=2*i;
    n[s.size()-i]=n[i]-1;
  }
  if (s.size()%2==0) n[s.size()/2]=s.size()-1;
  
  for (int i=0; i<s.size(); ++i){
    int k=i;
    for (int j=0; j<X; ++j) k=n[k];
    ans[k]=s[i];
  }
  cout << ans << "\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:

input
50
mvkaysdrpqkahelvtxwd

correct output
myphtdvaravsqexwlkdk

user output
mrlwayakxvpvdedhskqt

Test 6

Verdict: ACCEPTED

input
60
hfhnhgjyqegacpwcvieckehtayuqgi...

correct output
hhqcvkagqtccaynfgepieyiuhewgjh...

user output
hhqcvkagqtccaynfgepieyiuhewgjh

Test 7

Verdict:

input
100
kqrminhwirfjvnliauxbnltmdxexqg...

correct output
kddjxfpoagwhrigjcifgqxwynfwckj...

user output
kreopgvemnyljogsbmpcsfqghaixtl...

Test 8

Verdict:

input
100
renxibkpvavjnopqftypofrtfbfkke...

correct output
rpmkvedndjakqcrybmuywbnqspjraq...

user output
rebiubphwmeewfaybidlfrneddcvlw...

Test 9

Verdict: ACCEPTED

input
98765322
pjbsuxmdxyoxmlfokhmgpcnebqcpyx...

correct output
pgypycmdmnjkrlkcaqtrwyhdswtmne...

user output
pgypycmdmnjkrlkcaqtrwyhdswtmne...

Test 10

Verdict:

input
33892018
bmrtldbdycikkknkifujppdldpqxee...

correct output
bwxqwwogalkjqrrarbqlrekfxoltkf...

user output
bldwsjcapblbxouaftrytdhekwifnn...

Test 11

Verdict:

input
839254838
xjvoqfnjtgcscdexvaccdetxxppgsl...

correct output
xvuocylqxrdedqcirbveydcculfmev...

user output
xcakjeruvtwooctaqhaxfiynnefvjs...

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...