Submission #704601

#TimeUsernameProblemLanguageResultExecution timeMemory
704601bin9638Parrots (IOI11_parrots)C++17
88 / 100
10 ms1380 KiB
#ifndef SKY #include "encoder.h" #include "encoderlib.h" #endif // SKY #include <bits/stdc++.h> using namespace std; #ifdef SKY vector<int> tokens; void send(int x) { tokens.push_back(x); } #endif // SKY void sub64(int N, int M[]) { for(int i=0;i<N;i++) { int u=M[i]; for(int j=0;j<4;j++) { for(int t=1;t<=u%4;t++) send((i<<2)+j); u>>=2; } } } void encode(int N, int M[]) { if(N>32) { sub64(N,M); return; } for(int i=0;i<N;i++) for(int j=0;j<8;j++) if((M[i]>>j)&1) { send((i<<3)+j); } } #ifdef SKY int main(void) { freopen("ENCODE.inp","r",stdin); freopen("ENCODE.out","w",stdout); srand(time(0)); int n; cin >> n; int a[n]; for (int i = 0; i < n; i++) cin >> a[i]; encode(n, a); cout << n << endl; cout << tokens.size() << endl; for (int x : tokens) cout << x << " " ; cout << endl; return 0; } #endif // SKY
#ifndef SKY #include "decoder.h" #include "decoderlib.h" #endif // SKY #include <bits/stdc++.h> using namespace std; #ifdef SKY vector<int> tokens; void output(int b) { cout<<b<<" "; } #endif // SKY void decode(int n, int l,int X[]) { int kq[n]={}; if(n>32) { int kq[n][4]={}; for(int i=0;i<l;i++) { int vt=(X[i]>>2),j=(X[i]&3); // cout<<vt<<" "<<j<<endl; kq[vt][j]++; } for(int i=0;i<n;i++) { int res=0; for(int j=0;j<4;j++) { res+=(kq[i][j]<<(j*2)); } output(res); } return; } for(int i=0; i<l; i++) kq[X[i]>>3]+=(1<<(X[i]&((1<<3)-1))); for(int i=0;i<n;i++) output(kq[i]); } __int128_t S; #ifdef SKY int main(void) { freopen("DECODE.inp","r",stdin); freopen("DECODE.out","w",stdout); int n,l; cin>>n>>l; int a[l]; for(int i=0;i<l;i++) cin>>a[i]; decode(n,l,a); return 0; } #endif // SKY
#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...