Task: | Flash memory |
Sender: | a256 |
Submission time: | 2023-04-18 14:02:57 +0300 |
Language: | C++ (C++11) |
Status: | READY |
Result: | 22 |
group | verdict | score |
---|---|---|
#1 | ACCEPTED | 22.3 |
test | verdict | time | score | |
---|---|---|---|---|
#1 | ACCEPTED | 0.33 s | 1.2 | details |
#2 | ACCEPTED | 0.21 s | 1.35 | details |
#3 | ACCEPTED | 0.18 s | 1.2 | details |
#4 | ACCEPTED | 0.12 s | 1.25 | details |
#5 | ACCEPTED | 0.12 s | 1.3 | details |
#6 | ACCEPTED | 0.11 s | 1.2 | details |
#7 | ACCEPTED | 0.08 s | 1.15 | details |
#8 | ACCEPTED | 0.08 s | 1.1 | details |
#9 | ACCEPTED | 0.08 s | 1.2 | details |
#10 | ACCEPTED | 0.07 s | 1.2 | details |
#11 | ACCEPTED | 0.05 s | 0.95 | details |
#12 | ACCEPTED | 0.05 s | 0.95 | details |
#13 | ACCEPTED | 0.05 s | 1 | details |
#14 | ACCEPTED | 0.05 s | 1.15 | details |
#15 | ACCEPTED | 0.05 s | 1.2 | details |
#16 | ACCEPTED | 0.03 s | 0.8 | details |
#17 | ACCEPTED | 0.03 s | 0.85 | details |
#18 | ACCEPTED | 0.03 s | 0.95 | details |
#19 | ACCEPTED | 0.04 s | 1.1 | details |
#20 | ACCEPTED | 0.03 s | 1.2 | details |
Code
#include <bits/stdc++.h> using namespace std; int T,B,M,C; string s,t; void lue(){ for(;;){ cin>>C; if(!C) return; cin>>s; for(int i=s.size()-1;i>=M;--i){ if(s[i]=='1'){ for(int j=i-M;j<i;++j) cout<<s[j]; cout<<endl; break; } } } } void kirjoita(){ for(;;){ cin>>C; if(!C) return; cin>>s>>t; int i; for(i=s.size()-1;i>=0&&s[i]=='0';--i){ ; } i+=1; if(B-i < M+1){ cout<<'0'<<endl; } else { cout<<"1\n"; if(i-1-M>=0&&strncmp(s.c_str()+i-1-M,t.c_str(),t.size())==0){ ; } else { int p=0; for(int j=1;j<(int)t.size()&&i-j>=0;++j){ bool b=1; for(int k=0;k<j;++k){ if(t[k]!=s[i-j+k]){ b=0; break; } } if(b) p=j; } copy(t.begin()+p,t.end(),s.begin()+i); s[i+M-p]='1'; } cout<<s<<endl; } } } int main(){ cin>>T>>B>>M; if(T==0) kirjoita(); else lue(); }
Test details
Test 1
Verdict: ACCEPTED
input |
---|
16 8 4.062445024495069624056 |
correct output |
---|
(empty) |
user output |
---|
Activating encoder mode 0 16 8 1 0000000000000000 10110000 ... Truncated |
Error:
1 1 24 0
Test 2
Verdict: ACCEPTED
input |
---|
32 8 12.264904841300964834177 |
correct output |
---|
(empty) |
user output |
---|
Activating encoder mode 0 32 8 1 000000000000000000000000000000... Truncated |
Error:
1 1 27 0
Test 3
Verdict: ACCEPTED
input |
---|
32 16 4.129591513707784802006 |
correct output |
---|
(empty) |
user output |
---|
Activating encoder mode 0 32 16 1 000000000000000000000000000000... Truncated |
Error:
1 1 24 0
Test 4
Verdict: ACCEPTED
input |
---|
64 8 30.039277894268828900030 |
correct output |
---|
(empty) |
user output |
---|
Activating encoder mode 0 64 8 1 000000000000000000000000000000... Truncated |
Error:
1 1 25 0
Test 5
Verdict: ACCEPTED
input |
---|
64 16 12.953148094217360432715 |
correct output |
---|
(empty) |
user output |
---|
Activating encoder mode 0 64 16 1 000000000000000000000000000000... Truncated |
Error:
1 1 26 0
Test 6
Verdict: ACCEPTED
input |
---|
64 32 4.073559788233661501537 |
correct output |
---|
(empty) |
user output |
---|
Activating encoder mode 0 64 32 1 000000000000000000000000000000... Truncated |
Error:
1 1 24 0
Test 7
Verdict: ACCEPTED
input |
---|
128 8 69.777892228928747548775 |
correct output |
---|
(empty) |
user output |
---|
Activating encoder mode 0 128 8 1 000000000000000000000000000000... Truncated |
Error:
1 1 23 0
Test 8
Verdict: ACCEPTED
input |
---|
128 16 34.73179127514363524097... |
correct output |
---|
(empty) |
user output |
---|
Activating encoder mode 0 128 16 1 000000000000000000000000000000... Truncated |
Error:
1 1 22 0
Test 9
Verdict: ACCEPTED
input |
---|
128 32 13.95078898770563890866... |
correct output |
---|
(empty) |
user output |
---|
Activating encoder mode 0 128 32 1 000000000000000000000000000000... Truncated |
Error:
1 1 24 0
Test 10
Verdict: ACCEPTED
input |
---|
128 64 4.039918210604800133907 |
correct output |
---|
(empty) |
user output |
---|
Activating encoder mode 0 128 64 1 000000000000000000000000000000... Truncated |
Error:
1 1 24 0
Test 11
Verdict: ACCEPTED
input |
---|
256 8 174.46804708607103851145... |
correct output |
---|
(empty) |
user output |
---|
Activating encoder mode 0 256 8 1 000000000000000000000000000000... Truncated |
Error:
1 1 19 0
Test 12
Verdict: ACCEPTED
input |
---|
256 16 82.22261415140417733455... |
correct output |
---|
(empty) |
user output |
---|
Activating encoder mode 0 256 16 1 000000000000000000000000000000... Truncated |
Error:
1 1 19 0
Test 13
Verdict: ACCEPTED
input |
---|
256 32 37.62938226976920648891... |
correct output |
---|
(empty) |
user output |
---|
Activating encoder mode 0 256 32 1 000000000000000000000000000000... Truncated |
Error:
1 1 20 0
Test 14
Verdict: ACCEPTED
input |
---|
256 64 14.26346228205414057768... |
correct output |
---|
(empty) |
user output |
---|
Activating encoder mode 0 256 64 1 000000000000000000000000000000... Truncated |
Error:
1 1 23 0
Test 15
Verdict: ACCEPTED
input |
---|
256 128 4.01556909389394343085... |
correct output |
---|
(empty) |
user output |
---|
Activating encoder mode 0 256 128 1 000000000000000000000000000000... Truncated |
Error:
1 1 24 0
Test 16
Verdict: ACCEPTED
input |
---|
512 16 204.7462421274103461702... |
correct output |
---|
(empty) |
user output |
---|
Activating encoder mode 0 512 16 1 000000000000000000000000000000... Truncated |
Error:
1 1 16 0
Test 17
Verdict: ACCEPTED
input |
---|
512 32 91.77859514807311153984... |
correct output |
---|
(empty) |
user output |
---|
Activating encoder mode 0 512 32 1 000000000000000000000000000000... Truncated |
Error:
1 1 17 0
Test 18
Verdict: ACCEPTED
input |
---|
512 64 39.23027924214593871262... |
correct output |
---|
(empty) |
user output |
---|
Activating encoder mode 0 512 64 1 000000000000000000000000000000... Truncated |
Error:
1 1 19 0
Test 19
Verdict: ACCEPTED
input |
---|
512 128 15.0000000021676722686... |
correct output |
---|
(empty) |
user output |
---|
Activating encoder mode 0 512 128 1 000000000000000000000000000000... Truncated |
Error:
1 1 22 0
Test 20
Verdict: ACCEPTED
input |
---|
512 256 4.00542327711105546887... |
correct output |
---|
(empty) |
user output |
---|
Activating encoder mode 0 512 256 1 000000000000000000000000000000... Truncated |
Error:
1 1 24 0