| Task: | Decrypt |
| Sender: | HäviöLife |
| Submission time: | 2016-09-06 18:54:52 +0300 |
| Language: | C++ |
| Status: | READY |
| Result: | RUNTIME ERROR |
| test | verdict | time | |
|---|---|---|---|
| #1 | RUNTIME ERROR | 0.14 s | details |
| #2 | ACCEPTED | 0.05 s | details |
| #3 | WRONG ANSWER | 0.06 s | details |
| #4 | ACCEPTED | 0.05 s | details |
| #5 | RUNTIME ERROR | 0.15 s | details |
| #6 | ACCEPTED | 0.06 s | details |
| #7 | WRONG ANSWER | 0.06 s | details |
| #8 | ACCEPTED | 0.06 s | details |
| #9 | WRONG ANSWER | 0.06 s | details |
| #10 | ACCEPTED | 0.04 s | details |
| #11 | RUNTIME ERROR | 0.14 s | details |
| #12 | ACCEPTED | 0.06 s | details |
| #13 | ACCEPTED | 0.05 s | details |
| #14 | ACCEPTED | 0.05 s | details |
| #15 | RUNTIME ERROR | 0.14 s | details |
| #16 | ACCEPTED | 0.05 s | details |
| #17 | RUNTIME ERROR | 0.14 s | details |
| #18 | ACCEPTED | 0.05 s | details |
| #19 | ACCEPTED | 0.05 s | details |
| #20 | ACCEPTED | 0.05 s | details |
| #21 | RUNTIME ERROR | 0.15 s | details |
| #22 | ACCEPTED | 0.06 s | details |
| #23 | RUNTIME ERROR | 0.14 s | details |
| #24 | ACCEPTED | 0.05 s | details |
| #25 | ACCEPTED | 0.05 s | details |
| #26 | ACCEPTED | 0.05 s | details |
| #27 | RUNTIME ERROR | 0.14 s | details |
| #28 | ACCEPTED | 0.05 s | details |
| #29 | RUNTIME ERROR | 0.14 s | details |
| #30 | ACCEPTED | 0.06 s | details |
Compiler report
input/code.cpp: In function 'char applyF(char, int)':
input/code.cpp:30:14: warning: array subscript has type 'char' [-Wchar-subscripts]
c=F[c];
^
input/code.cpp: In function 'int main()':
input/code.cpp:41:27: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
for(int i=0; i<f.size(); i++)
^
input/code.cpp:59:30: warning: array subscript has type 'char' [-Wchar-subscripts]
char d=F[iter];
^
input/code.cpp:62:26: warning: array subscript has type 'char' [-Wchar-subscripts]
d=F[d];
^
input/code.cpp:79:27: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
for(int i=0; i<s.size(); i++)
^
input/code.cpp:80:20: warning: array subscript has type 'char' [-Wchar-subscripts]
if(cnt[s[i]]!=1){
^
input/code.cpp:85:27: warn...Code
#include <iostream>
#include <vector>
#include <stack>
#include <queue>
#include <algorithm>
#include <cmath>
#include <iomanip>
#include <unordered_set>
#include <stdio.h>
#include <string.h>
#include <unordered_map>
#include <fstream>
#include <set>
#include <map>
#define MOD 1000000007
#define ll long long
#define N 20000
#define float double
using namespace std;
int F[256];
int G[256];
int cnt[256];
int Ginv[256];
char applyF(char c, int n){
for(int i=0; i<n; i++)
c=F[c];
return c;
}
int main(){
string f;
int k;
cin>>f>>k;
string s;
cin>>s;
for(int i=0; i<f.size(); i++)
F['a' + i] = f[i];
for(int i='a'; i<='z'; i++)
G[i]=i;
if(k<100){
for(int i='a'; i<='z'; i++)
G[i]=applyF(i, k);
}else{
for(int i='a'; i<='z'; i++){
int syklialkaa;
int syklinpituus;
for(int alq=0; alq<30; alq++){
char iter=applyF(i, alq);
int maar=0;
char d=F[iter];
while(maar<30 && d!=iter){
maar++;
d=F[d];
}
if(d==iter){
syklialkaa=alq;
syklinpituus=maar;
}
}
G[i]=applyF(i, syklialkaa + (k-syklialkaa)%syklinpituus);
}
}
for(int i='a'; i<='z'; i++)
cnt[G[i]]++;
for(int i=0; i<s.size(); i++)
if(cnt[s[i]]!=1){
cout<<"impossible"<<endl;
return 0;
}
for(int i=0; i<s.size(); i++){
for(int c='a'; c<='z'; c++){
if(G[c]==s[i]){
s[i]=c;
break;
}
}
}
cout<<s<<endl;
return 0;
}
Test details
Test 1
Verdict: RUNTIME ERROR
| input |
|---|
| egkpmqujbxhiatorvznwcfynds 564... |
| correct output |
|---|
| impossible |
| user output |
|---|
| (empty) |
Test 2
Verdict: ACCEPTED
| input |
|---|
| pdabvolaobzbaaisrntdtwluwf 2 oooooooooooooooooooooooooooooo... |
| correct output |
|---|
| impossible |
| user output |
|---|
| impossible |
Test 3
Verdict: WRONG ANSWER
| input |
|---|
| xtaoqlsjkezrcvinwfmbyhdgpu 872... |
| correct output |
|---|
| mmm |
| user output |
|---|
| ggg |
Test 4
Verdict: ACCEPTED
| input |
|---|
| wlcpatbrudxhofijgskqgevymz 1 joojjojjjoojjjjoojjojoojojoojj... |
| correct output |
|---|
| pmmppmpppmmppppmmppmpmmpmpmmpp... |
| user output |
|---|
| pmmppmpppmmppppmmppmpmmpmpmmpp... |
Test 5
Verdict: RUNTIME ERROR
| input |
|---|
| tjyivkaulcjnehvtilatxjxmxd 300... |
| correct output |
|---|
| impossible |
| user output |
|---|
| (empty) |
Test 6
Verdict: ACCEPTED
| input |
|---|
| tonbvkcqilfjghszxpwmdureay 2 nnv |
| correct output |
|---|
| ggx |
| user output |
|---|
| ggx |
Test 7
Verdict: WRONG ANSWER
| input |
|---|
| edmxaqolzisvnrfkcgwehbtjpu 179... |
| correct output |
|---|
| oooooooooooooooooooooooooooooo... |
| user output |
|---|
| qqqqqqqqqqqqqqqqqqqqqqqqqqqqqq... |
Test 8
Verdict: ACCEPTED
| input |
|---|
| hrygatmxebcusinbdplunukuai 1 i |
| correct output |
|---|
| impossible |
| user output |
|---|
| impossible |
Test 9
Verdict: WRONG ANSWER
| input |
|---|
| nsuftdzbmkqepgihlyxrvwajoc 724... |
| correct output |
|---|
| offfofofofofoffooofofooofffffo... |
| user output |
|---|
| lffflflflflflfflllflflllfffffl... |
Test 10
Verdict: ACCEPTED
| input |
|---|
| kbybextsniougrdmqpwfahzlcv 2 stlooyhhdfzpspsospvhdpedouqsyr... |
| correct output |
|---|
| vmfaayzzkgsnvnvavnwzknekaxqvyi... |
| user output |
|---|
| vmfaayzzkgsnvnvavnwzknekaxqvyi... |
Test 11
Verdict: RUNTIME ERROR
| input |
|---|
| dugyojozcpjlwxepebzhfkqlzc 801... |
| correct output |
|---|
| impossible |
| user output |
|---|
| (empty) |
Test 12
Verdict: ACCEPTED
| input |
|---|
| kibphqeygnmsdvawzrfcuotxjl 2 ggggggggggggggggggggggggggg |
| correct output |
|---|
| bbbbbbbbbbbbbbbbbbbbbbbbbbb |
| user output |
|---|
| bbbbbbbbbbbbbbbbbbbbbbbbbbb |
Test 13
Verdict: ACCEPTED
| input |
|---|
| pstlbyjnovmekdqzrhwxwgcfai 315... |
| correct output |
|---|
| mmm |
| user output |
|---|
| mmm |
Test 14
Verdict: ACCEPTED
| input |
|---|
| uukjvcscfohyvqomdfdlysnuoe 2 eheeheheeheheeheeheeeehhhheehh... |
| correct output |
|---|
| impossible |
| user output |
|---|
| impossible |
Test 15
Verdict: RUNTIME ERROR
| input |
|---|
| pkwsxbvdgmjutiyfqrzhealnoc 822... |
| correct output |
|---|
| hbkxkmhinhmwhwthbmhutgnkgoywho... |
| user output |
|---|
| (empty) |
Test 16
Verdict: ACCEPTED
| input |
|---|
| yqxvbohrlifmzdtwgejpcanuse 1 fl |
| correct output |
|---|
| ki |
| user output |
|---|
| ki |
Test 17
Verdict: RUNTIME ERROR
| input |
|---|
| gauouzffisuxjtuufqdappivxv 205... |
| correct output |
|---|
| impossible |
| user output |
|---|
| (empty) |
Test 18
Verdict: ACCEPTED
| input |
|---|
| ovqzprxiluehkndsmtyafbwgjc 2 oo |
| correct output |
|---|
| tt |
| user output |
|---|
| tt |
Test 19
Verdict: ACCEPTED
| input |
|---|
| goqbyzivahrxnjwtdjluepsmkf 701... |
| correct output |
|---|
| impossible |
| user output |
|---|
| impossible |
Test 20
Verdict: ACCEPTED
| input |
|---|
| vlovrwpvkfbotybcmcbixsbfly 2 jutqryuhbjjqvbpaeqoyduqneybsli... |
| correct output |
|---|
| impossible |
| user output |
|---|
| impossible |
Test 21
Verdict: RUNTIME ERROR
| input |
|---|
| eawzhgmusltxjypkirbcfndovq 262... |
| correct output |
|---|
| a |
| user output |
|---|
| (empty) |
Test 22
Verdict: ACCEPTED
| input |
|---|
| kqdpgnevpuyahrjclfzwsomxti 2 kkkkkkkkkkkkkkkkkkkkkkkkkkkkkk... |
| correct output |
|---|
| llllllllllllllllllllllllllllll... |
| user output |
|---|
| llllllllllllllllllllllllllllll... |
Test 23
Verdict: RUNTIME ERROR
| input |
|---|
| xwfgenquyctxdvmptcrdhvcxwq 778... |
| correct output |
|---|
| impossible |
| user output |
|---|
| (empty) |
Test 24
Verdict: ACCEPTED
| input |
|---|
| sucejvkmrhtobzxglapdnifqwy 1 qddqqqqqdqqqqddddqqdqqqdqdqddq... |
| correct output |
|---|
| xttxxxxxtxxxxttttxxtxxxtxtxttx... |
| user output |
|---|
| xttxxxxxtxxxxttttxxtxxxtxtxttx... |
Test 25
Verdict: ACCEPTED
| input |
|---|
| pzukghijmcsalwnvoydxftbreu 413... |
| correct output |
|---|
| impossible |
| user output |
|---|
| impossible |
Test 26
Verdict: ACCEPTED
| input |
|---|
| adlsmbfijwmdcwglhgnvaooybu 1 aio |
| correct output |
|---|
| impossible |
| user output |
|---|
| impossible |
Test 27
Verdict: RUNTIME ERROR
| input |
|---|
| zqynskaxvcljewmfditourgpbh 756... |
| correct output |
|---|
| oooooooooooooooooooooooooooooo... |
| user output |
|---|
| (empty) |
Test 28
Verdict: ACCEPTED
| input |
|---|
| truzcldhkeqspoabgyvmjwnfik 1 zz |
| correct output |
|---|
| dd |
| user output |
|---|
| dd |
Test 29
Verdict: RUNTIME ERROR
| input |
|---|
| upfasuzkjuwhrnajgmitgysvil 467... |
| correct output |
|---|
| impossible |
| user output |
|---|
| (empty) |
Test 30
Verdict: ACCEPTED
| input |
|---|
| bemlodzqjgixuksatvyfcpnhrw 1 zdaaskooqkzzifuzspzayokihzxqhf... |
| correct output |
|---|
| gfpponeehnggktmgovgpsenkxglhxt... |
| user output |
|---|
| gfpponeehnggktmgovgpsenkxglhxt... |
