| Task: | slom |
| Sender: | siirikuoppala |
| Submission time: | 2016-08-01 16:29:31 +0300 |
| Language: | C++ |
| Status: | READY |
| Result: | 100 |
| group | verdict | score |
|---|---|---|
| #1 | ACCEPTED | 100 |
| test | verdict | time | |
|---|---|---|---|
| #1 | ACCEPTED | 0.05 s | details |
| #2 | ACCEPTED | 0.05 s | details |
| #3 | ACCEPTED | 0.05 s | details |
| #4 | ACCEPTED | 0.06 s | details |
| #5 | ACCEPTED | 0.06 s | details |
| #6 | ACCEPTED | 0.06 s | details |
| #7 | ACCEPTED | 0.05 s | details |
| #8 | ACCEPTED | 0.06 s | details |
| #9 | ACCEPTED | 0.06 s | details |
| #10 | ACCEPTED | 0.05 s | details |
| #11 | ACCEPTED | 0.06 s | details |
| #12 | ACCEPTED | 0.05 s | details |
| #13 | ACCEPTED | 0.05 s | details |
Code
#include <iostream>
using namespace std;
int t[1010][30];
char v[1010];
string s;
int main(){
int X;
cin >> X >> s;
int n=s.size();
for(int i=0; i<n; i+=2){
t[i][0]=i/2;
}for(int i=1; i<n; i+=2){
t[i][0]=n-i/2-1;
}
for(int j=1; j<30; ++j){
for(int i=0; i<n; ++i){
t[i][j]=t[t[i][j-1]][j-1];
}
}
for(int i=0; i<n; ++i){
int a=i;
int x=X;
for(int b=29; b>=0; --b){
while((1<<b) <= x){
a=t[a][b];
x-=(1<<b);
}
}
v[a]=s[i];
}
for(int i=0; i<n; ++i) cout << v[i];
}
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... |
