| Task: | Flash memory |
| Sender: | MojoLake |
| Submission time: | 2023-04-18 17:35:57 +0300 |
| Language: | C++ (C++17) |
| Status: | READY |
| Result: | 0 |
| group | verdict | score |
|---|---|---|
| #1 | RUNTIME ERROR | 0 |
| test | verdict | time | score | |
|---|---|---|---|---|
| #1 | RUNTIME ERROR | 0.02 s | 0 | details |
| #2 | RUNTIME ERROR | 0.02 s | 0 | details |
| #3 | TIME LIMIT EXCEEDED | -- | 0 | details |
| #4 | RUNTIME ERROR | 0.02 s | 0 | details |
| #5 | TIME LIMIT EXCEEDED | -- | 0 | details |
| #6 | TIME LIMIT EXCEEDED | -- | 0 | details |
| #7 | RUNTIME ERROR | 0.02 s | 0 | details |
| #8 | TIME LIMIT EXCEEDED | -- | 0 | details |
| #9 | TIME LIMIT EXCEEDED | -- | 0 | details |
| #10 | TIME LIMIT EXCEEDED | -- | 0 | details |
| #11 | RUNTIME ERROR | 0.01 s | 0 | details |
| #12 | TIME LIMIT EXCEEDED | -- | 0 | details |
| #13 | TIME LIMIT EXCEEDED | -- | 0 | details |
| #14 | TIME LIMIT EXCEEDED | -- | 0 | details |
| #15 | TIME LIMIT EXCEEDED | -- | 0 | details |
| #16 | TIME LIMIT EXCEEDED | -- | 0 | details |
| #17 | TIME LIMIT EXCEEDED | -- | 0 | details |
| #18 | TIME LIMIT EXCEEDED | -- | 0 | details |
| #19 | TIME LIMIT EXCEEDED | -- | 0 | details |
| #20 | TIME LIMIT EXCEEDED | -- | 0 | details |
Compiler report
input/code.cpp: In function 'void decode()':
input/code.cpp:59:13: warning: unused variable 'ans' [-Wunused-variable]
59 | int ans = 0;
| ^~~Code
#include <bits/stdc++.h>
#define debug(x) cout << #x << ": " << x << "\n"
#define all(x) x.begin(), x.end()
using namespace std;
using ll = long long;
const int N = 101;
const int M = 101;
const int inf = 1e9;
const ll LLinf = 1e16;
void encode(){
int b, m;
cin >> b >> m;
while(1){
int c;
cin >> c;
if(c == 0)exit(0);
string s; cin >> s;
string val; cin >> val;
int start = 0;
for(int i = 0; i < b/2; ++i){
if(s[i] == '1')start = b/2;
}
if(start != 0){
bool need_new = 0;
for(int i = start; i < b; ++i){
if(s[i] == '1')need_new = 1;
}
if(need_new){
cout << 0 << endl;
continue;
}
}
for(int i = 0; i < m; ++i){
s[i+start] = val[i];
}
cout << s << endl;
}
}
void decode(){
int b, m;
cin >> b >> m;
while(1){
int c;
cin >> c;
if(c == 0)exit(0);
string s; cin >> s;
int ans = 0;
bool zero = 1;
for(int i = 0; i < b; ++i){
if(s[i] == '1')zero = 0;
}
if(zero){
cout << string(m, '0') << endl;
continue;
}
int start = 0;
for(int i = b/2; i < b; ++i){
if(s[i] == '1')start = b/2;
}
string ret = "";
for(int i = start; i < start + m; ++i){
ret += string(1, s[i]);
}
cout << ret << endl;
}
}
int main(){
int t;
cin >> t;
if(t == 1)encode();
else decode();
}Test details
Test 1
Verdict: RUNTIME ERROR
| input |
|---|
| 16 8 4.062445024495069624056 |
| correct output |
|---|
| (empty) |
| user output |
|---|
| Activating encoder mode 0 16 8 1 0000000000000000 10111110 ... Truncated |
Test 2
Verdict: RUNTIME ERROR
| input |
|---|
| 32 8 12.264904841300964834177 |
| correct output |
|---|
| (empty) |
| user output |
|---|
| Activating encoder mode 0 32 8 1 000000000000000000000000000000... Truncated |
Test 3
Verdict: TIME LIMIT EXCEEDED
| input |
|---|
| 32 16 4.129591513707784802006 |
| correct output |
|---|
| (empty) |
| user output |
|---|
| (empty) |
Test 4
Verdict: RUNTIME ERROR
| input |
|---|
| 64 8 30.039277894268828900030 |
| correct output |
|---|
| (empty) |
| user output |
|---|
| Activating encoder mode 0 64 8 1 000000000000000000000000000000... Truncated |
Test 5
Verdict: TIME LIMIT EXCEEDED
| input |
|---|
| 64 16 12.953148094217360432715 |
| correct output |
|---|
| (empty) |
| user output |
|---|
| (empty) |
Test 6
Verdict: TIME LIMIT EXCEEDED
| input |
|---|
| 64 32 4.073559788233661501537 |
| correct output |
|---|
| (empty) |
| user output |
|---|
| (empty) |
Test 7
Verdict: RUNTIME ERROR
| input |
|---|
| 128 8 69.777892228928747548775 |
| correct output |
|---|
| (empty) |
| user output |
|---|
| Activating encoder mode 0 128 8 1 000000000000000000000000000000... Truncated |
Test 8
Verdict: TIME LIMIT EXCEEDED
| input |
|---|
| 128 16 34.73179127514363524097... |
| correct output |
|---|
| (empty) |
| user output |
|---|
| (empty) |
Test 9
Verdict: TIME LIMIT EXCEEDED
| input |
|---|
| 128 32 13.95078898770563890866... |
| correct output |
|---|
| (empty) |
| user output |
|---|
| (empty) |
Test 10
Verdict: TIME LIMIT EXCEEDED
| input |
|---|
| 128 64 4.039918210604800133907 |
| correct output |
|---|
| (empty) |
| user output |
|---|
| (empty) |
Test 11
Verdict: RUNTIME ERROR
| input |
|---|
| 256 8 174.46804708607103851145... |
| correct output |
|---|
| (empty) |
| user output |
|---|
| Activating encoder mode 0 256 8 1 000000000000000000000000000000... Truncated |
Test 12
Verdict: TIME LIMIT EXCEEDED
| input |
|---|
| 256 16 82.22261415140417733455... |
| correct output |
|---|
| (empty) |
| user output |
|---|
| (empty) |
Test 13
Verdict: TIME LIMIT EXCEEDED
| input |
|---|
| 256 32 37.62938226976920648891... |
| correct output |
|---|
| (empty) |
| user output |
|---|
| (empty) |
Test 14
Verdict: TIME LIMIT EXCEEDED
| input |
|---|
| 256 64 14.26346228205414057768... |
| correct output |
|---|
| (empty) |
| user output |
|---|
| (empty) |
Test 15
Verdict: TIME LIMIT EXCEEDED
| input |
|---|
| 256 128 4.01556909389394343085... |
| correct output |
|---|
| (empty) |
| user output |
|---|
| (empty) |
Test 16
Verdict: TIME LIMIT EXCEEDED
| input |
|---|
| 512 16 204.7462421274103461702... |
| correct output |
|---|
| (empty) |
| user output |
|---|
| (empty) |
Test 17
Verdict: TIME LIMIT EXCEEDED
| input |
|---|
| 512 32 91.77859514807311153984... |
| correct output |
|---|
| (empty) |
| user output |
|---|
| (empty) |
Test 18
Verdict: TIME LIMIT EXCEEDED
| input |
|---|
| 512 64 39.23027924214593871262... |
| correct output |
|---|
| (empty) |
| user output |
|---|
| (empty) |
Test 19
Verdict: TIME LIMIT EXCEEDED
| input |
|---|
| 512 128 15.0000000021676722686... |
| correct output |
|---|
| (empty) |
| user output |
|---|
| (empty) |
Test 20
Verdict: TIME LIMIT EXCEEDED
| input |
|---|
| 512 256 4.00542327711105546887... |
| correct output |
|---|
| (empty) |
| user output |
|---|
| (empty) |
