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

Compiler report

input/code.cpp: In function 'int main()':
input/code.cpp:34: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];


bool u[1010];

int get(int c, int k){
  for (int i=0; i<k; ++i) c=n[c];
  return c;
}

int gl(int c, int d, int x){
  if (x==0) return c;
  if (u[c]) return get(c, x%d);
  u[c]=1;
  int rv=gl(n[c], d+1, x-1);
  u[c]=0;
  return rv;
}

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