Submission #351706

#TimeUsernameProblemLanguageResultExecution timeMemory
351706tengiz05Parrots (IOI11_parrots)C++17
17 / 100
11 ms1528 KiB
#include "encoder.h" #include "encoderlib.h" #include <bits/stdc++.h> using namespace std; void print(int x){ for(int i=256;i>0;i>>=1){ cout << ((x>>i)&1); }cout << '\n'; } void encode(int n, int A[]){ if(n > 32){ for(int i=0;i<n;i++){ while(A[i] >= 64){ A[i] -= 64; send(i | (3<<6)); } while(A[i] >= 16){ A[i] -= 16; send(i | (2<<6)); } while(A[i] >= 4){ A[i] -= 4; send(i | (1<<6)); } while(A[i] >= 1){ A[i] -= 1; send(i | (0<<6)); } } }else { for(int i=0;i<n;i++){ while(A[i] >= 128){ A[i] -= 128; send(i | (3|4<<5)); } while(A[i] >= 32){ A[i] -= 32; send(i | (2|4<<5)); } while(A[i] >= 8){ A[i] -= 8; send(i | (1|4<<5)); } while(A[i] >= 2){ A[i] -= 2; send(i | (0|4<<5)); } //asdsdafasdgjaklsdf while(A[i] >= 64){ A[i] -= 64; send(i | (3<<5)); } while(A[i] >= 16){ A[i] -= 16; send(i | (2<<5)); } while(A[i] >= 4){ A[i] -= 4; send(i | (1<<5)); } while(A[i] >= 1){ A[i] -= 1; send(i | (0<<5)); } } } }
#include "decoder.h" #include "decoderlib.h" #include <bits/stdc++.h> using namespace std; int a[100]; void decode(int n, int len, int x[]){ for(int i=0;i<n;i++)a[i]= 0 ; if(n > 32){ for(int i=0;i<len;i++){ int type = (x[i] & 192)>>6; int ind = x[i] & 63; if(type == 3)a[ind] += 64; if(type == 2)a[ind] += 16; if(type == 1)a[ind] += 4; if(type == 0)a[ind] += 1; } }else { for(int i=0;i<len;i++){ int type = (x[i] & (192>>1))>>5; int ind = x[i] & 31; if(x[i] & (1<<7)){ if(type == 3)a[ind] += 128; if(type == 2)a[ind] += 32; if(type == 1)a[ind] += 8; if(type == 0)a[ind] += 2; }else { if(type == 3)a[ind] += 64; if(type == 2)a[ind] += 16; if(type == 1)a[ind] += 4; if(type == 0)a[ind] += 1; } } } //~ for(int i=0;i<n;i++)cout << a[i] << ' ';cout << '\n'; for(int i=0;i<n;i++)output(a[i]); }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...