Submission #363310

#TimeUsernameProblemLanguageResultExecution timeMemory
363310beksultan04Parrots (IOI11_parrots)C++14
99 / 100
9 ms1656 KiB
#include "encoder.h" #include "encoderlib.h" #include <bits/stdc++.h> using namespace std; #define lol long long #define pii pair<int,int> #define OK puts("OK"); #define NO puts("NO"); #define YES puts("YES"); #define fr first #define sc second #define ret return #define scanl(a) scanf("%lld",&a); #define scanll(a,b) scanf("%lld %lld",&a, &b); #define scanlll(a,b,c) scanf("%lld %lld %lld",&a,&b,&c); #define scan1(a) scanf("%d",&a); #define scan2(a,b) scanf("%d %d",&a, &b); #define scan3(a,b,c) scanf("%d %d %d",&a,&b,&c); #define all(s) s.begin(),s.end() #define allr(s) s.rbegin(),s.rend() #define pb push_back #define sz(v) (int)v.size() #define endi puts(""); #define eps 1e-12 void encode(int N, int M[]){ int i,j,xr=0; for (i=0;i<8;++i){ int a=0,b=0; for (j=0;j<N;++j){ if ((M[j]&(1<<i)))a++; else b++; } if (a > b)xr|=(1<<i); } send(xr); send(xr); send(xr); send(xr); for(i=0; i<N; i++){ int x = (i<<2); int m = M[i]; m ^= xr; for (int f=0;f<4;f++){ int a = (m&1); m = (m>>1); int b = (m&1); m = (m>>1); if (a == 1)send(x); if (b == 1){ send(x); send(x); } x++; } } }
#include "decoder.h" #include "decoderlib.h" #include <bits/stdc++.h> using namespace std; #define lol long long #define pii pair<int,int> #define OK puts("OK"); #define NO puts("NO"); #define YES puts("YES"); #define fr first #define sc second #define ret return #define scanl(a) scanf("%lld",&a); #define scanll(a,b) scanf("%lld %lld",&a, &b); #define scanlll(a,b,c) scanf("%lld %lld %lld",&a,&b,&c); #define scan1(a) scanf("%d",&a); #define scan2(a,b) scanf("%d %d",&a, &b); #define scan3(a,b,c) scanf("%d %d %d",&a,&b,&c); #define all(s) s.begin(),s.end() #define allr(s) s.rbegin(),s.rend() #define pb push_back #define sz(v) (int)v.size() #define endi puts(""); #define eps 1e-12 int cnt[256],ans[256]; void decode(int N, int L, int X[]){ int i,xr=0; for (i=0;i<L;++i) cnt[X[i]]++; for (i=0;i<L;++i){ if (cnt[X[i]] >= 4){ xr = X[i]; cnt[X[i]]-=4; break; } } for (i=0;i<256;++i){ if (cnt[i] > 0){ int x = (i&3); ans[(i>>2)] += (cnt[i] <<(x*2)); } } int n = N; vector <int> v; for (i=0;i<n;++i){ output(ans[i]^xr); } for (i=0;i<256;++i)cnt[i] = ans[i] = 0; }
#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...