Submission #1008416

#TimeUsernameProblemLanguageResultExecution timeMemory
1008416FaggiParrots (IOI11_parrots)C++11
81 / 100
2 ms1356 KiB
#include "encoder.h" #include "encoderlib.h" #include <bits/stdc++.h> using namespace std; void encode2(int N, int M[]) { int i, j, pot, part,num; for(i=0; i<N; i++) { num=0; pot=1; for(j=0; j<8; j++) { num=i; num=num<<3; num+=j; if((M[i]&pot)>0) send(num); pot*=2; num=0; } }}void encode(int N, int M[]){ if(N<=32) { encode2(N,M); return; } int i, j, pot, part,num; for(i=0; i<N; i++) { num=0; pot=1; if(M[i]==255) { num=0; num=num<<2; num+=0; send(num); send(num); send(num); send(num); continue; } for(j=0; j<4; j++) { num=i; num=num<<2; num+=j; if((M[i]&pot)>0&&(M[i]&(pot*2))>0) { send(num); send(num); send(num); } else if((M[i]&pot)>0) { send(num); } else if((M[i]&(pot*2))>0) { send(num); send(num); } pot*=2; pot*=2; } }}
#include "decoder.h" #include "decoderlib.h" #include <bits/stdc++.h> using namespace std; void decode2(int N, int L, int X[]) { int i,j,a,b,pos,par,num; vector<vector<int>>v(N,vector<int>(8,0)); for(i=0; i<L; i++) { pos=X[i]>>3; par=((pos<<3)^X[i]); v[pos][par]=1; } for(i=0; i<N; i++) { num=0; for(j=7; j>=0; j--) { num=num<<1; num+=v[i][j]; } output(num); }}void decode(int N, int L, int X[]){ if(N<=32) { decode2(N,L,X); return; } int i,j,a,b,pos,par,num; vector<vector<int>>v(N,vector<int>(4,0)); for(i=0; i<L; i++) { pos=X[i]; pos=pos>>2; par=(X[i]^(pos<<2)); v[pos][par]++; } for(i=0; i<N; i++) { num=0; for(j=3; j>=0; j--) { if(v[i][j]==4) { num=255; break; } if(v[i][j]==3) { num=num<<1; num++; num=num<<1; num++; } else if(v[i][j]==1) { num=num<<2; num++; } else if(v[i][j]==2) { num=num<<1; num++; num=num<<1; } else { num=num<<2; } } output(num); }}

Compilation message (stderr)

encoder.cpp: In function 'void encode2(int, int*)':
encoder.cpp:5:50: warning: unused variable 'part' [-Wunused-variable]
    5 | void encode2(int N, int M[]) {    int i, j, pot, part,num;    for(i=0; i<N; i++)    {        num=0;        pot=1;        for(j=0; j<8; j++)        {            num=i;            num=num<<3;            num+=j;            if((M[i]&pot)>0)                send(num);            pot*=2;            num=0;        }    }}void encode(int N, int M[]){    if(N<=32)    {        encode2(N,M);        return;    }    int i, j, pot, part,num;    for(i=0; i<N; i++)    {        num=0;        pot=1;        if(M[i]==255)        {            num=0;            num=num<<2;            num+=0;            send(num);            send(num);            send(num);            send(num);            continue;        }        for(j=0; j<4; j++)        {            num=i;            num=num<<2;            num+=j;            if((M[i]&pot)>0&&(M[i]&(pot*2))>0)            {                send(num);                send(num);                send(num);            }            else if((M[i]&pot)>0)            {                send(num);            }            else if((M[i]&(pot*2))>0)            {                send(num);                send(num);            }            pot*=2;            pot*=2;        }    }}
      |                                                  ^~~~
encoder.cpp: In function 'void encode(int, int*)':
encoder.cpp:5:421: warning: unused variable 'part' [-Wunused-variable]
    5 | void encode2(int N, int M[]) {    int i, j, pot, part,num;    for(i=0; i<N; i++)    {        num=0;        pot=1;        for(j=0; j<8; j++)        {            num=i;            num=num<<3;            num+=j;            if((M[i]&pot)>0)                send(num);            pot*=2;            num=0;        }    }}void encode(int N, int M[]){    if(N<=32)    {        encode2(N,M);        return;    }    int i, j, pot, part,num;    for(i=0; i<N; i++)    {        num=0;        pot=1;        if(M[i]==255)        {            num=0;            num=num<<2;            num+=0;            send(num);            send(num);            send(num);            send(num);            continue;        }        for(j=0; j<4; j++)        {            num=i;            num=num<<2;            num+=j;            if((M[i]&pot)>0&&(M[i]&(pot*2))>0)            {                send(num);                send(num);                send(num);            }            else if((M[i]&pot)>0)            {                send(num);            }            else if((M[i]&(pot*2))>0)            {                send(num);                send(num);            }            pot*=2;            pot*=2;        }    }}
      |                                                                                                                                                                                                                                                                                                                                                                                                                                     ^~~~

decoder.cpp: In function 'void decode2(int, int, int*)':
decoder.cpp:5:50: warning: unused variable 'a' [-Wunused-variable]
    5 | void decode2(int N, int L, int X[]) {    int i,j,a,b,pos,par,num;    vector<vector<int>>v(N,vector<int>(8,0));    for(i=0; i<L; i++)    {        pos=X[i]>>3;        par=((pos<<3)^X[i]);        v[pos][par]=1;    }    for(i=0; i<N; i++)    {        num=0;        for(j=7; j>=0; j--)        {            num=num<<1;            num+=v[i][j];        }        output(num);    }}void decode(int N, int L, int X[]){    if(N<=32)    {        decode2(N,L,X);        return;    }    int i,j,a,b,pos,par,num;    vector<vector<int>>v(N,vector<int>(4,0));    for(i=0; i<L; i++)    {        pos=X[i];        pos=pos>>2;        par=(X[i]^(pos<<2));        v[pos][par]++;    }    for(i=0; i<N; i++)    {        num=0;        for(j=3; j>=0; j--)        {            if(v[i][j]==4)            {                num=255;                break;            }            if(v[i][j]==3)            {                num=num<<1;                num++;                num=num<<1;                num++;            }            else if(v[i][j]==1)            {                num=num<<2;                num++;            }            else if(v[i][j]==2)            {                num=num<<1;                num++;                num=num<<1;            }            else            {                num=num<<2;            }        }        output(num);    }}
      |                                                  ^
decoder.cpp:5:52: warning: unused variable 'b' [-Wunused-variable]
    5 | void decode2(int N, int L, int X[]) {    int i,j,a,b,pos,par,num;    vector<vector<int>>v(N,vector<int>(8,0));    for(i=0; i<L; i++)    {        pos=X[i]>>3;        par=((pos<<3)^X[i]);        v[pos][par]=1;    }    for(i=0; i<N; i++)    {        num=0;        for(j=7; j>=0; j--)        {            num=num<<1;            num+=v[i][j];        }        output(num);    }}void decode(int N, int L, int X[]){    if(N<=32)    {        decode2(N,L,X);        return;    }    int i,j,a,b,pos,par,num;    vector<vector<int>>v(N,vector<int>(4,0));    for(i=0; i<L; i++)    {        pos=X[i];        pos=pos>>2;        par=(X[i]^(pos<<2));        v[pos][par]++;    }    for(i=0; i<N; i++)    {        num=0;        for(j=3; j>=0; j--)        {            if(v[i][j]==4)            {                num=255;                break;            }            if(v[i][j]==3)            {                num=num<<1;                num++;                num=num<<1;                num++;            }            else if(v[i][j]==1)            {                num=num<<2;                num++;            }            else if(v[i][j]==2)            {                num=num<<1;                num++;                num=num<<1;            }            else            {                num=num<<2;            }        }        output(num);    }}
      |                                                    ^
decoder.cpp: In function 'void decode(int, int, int*)':
decoder.cpp:5:481: warning: unused variable 'a' [-Wunused-variable]
    5 | void decode2(int N, int L, int X[]) {    int i,j,a,b,pos,par,num;    vector<vector<int>>v(N,vector<int>(8,0));    for(i=0; i<L; i++)    {        pos=X[i]>>3;        par=((pos<<3)^X[i]);        v[pos][par]=1;    }    for(i=0; i<N; i++)    {        num=0;        for(j=7; j>=0; j--)        {            num=num<<1;            num+=v[i][j];        }        output(num);    }}void decode(int N, int L, int X[]){    if(N<=32)    {        decode2(N,L,X);        return;    }    int i,j,a,b,pos,par,num;    vector<vector<int>>v(N,vector<int>(4,0));    for(i=0; i<L; i++)    {        pos=X[i];        pos=pos>>2;        par=(X[i]^(pos<<2));        v[pos][par]++;    }    for(i=0; i<N; i++)    {        num=0;        for(j=3; j>=0; j--)        {            if(v[i][j]==4)            {                num=255;                break;            }            if(v[i][j]==3)            {                num=num<<1;                num++;                num=num<<1;                num++;            }            else if(v[i][j]==1)            {                num=num<<2;                num++;            }            else if(v[i][j]==2)            {                num=num<<1;                num++;                num=num<<1;            }            else            {                num=num<<2;            }        }        output(num);    }}
      |                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                 ^
decoder.cpp:5:483: warning: unused variable 'b' [-Wunused-variable]
    5 | void decode2(int N, int L, int X[]) {    int i,j,a,b,pos,par,num;    vector<vector<int>>v(N,vector<int>(8,0));    for(i=0; i<L; i++)    {        pos=X[i]>>3;        par=((pos<<3)^X[i]);        v[pos][par]=1;    }    for(i=0; i<N; i++)    {        num=0;        for(j=7; j>=0; j--)        {            num=num<<1;            num+=v[i][j];        }        output(num);    }}void decode(int N, int L, int X[]){    if(N<=32)    {        decode2(N,L,X);        return;    }    int i,j,a,b,pos,par,num;    vector<vector<int>>v(N,vector<int>(4,0));    for(i=0; i<L; i++)    {        pos=X[i];        pos=pos>>2;        par=(X[i]^(pos<<2));        v[pos][par]++;    }    for(i=0; i<N; i++)    {        num=0;        for(j=3; j>=0; j--)        {            if(v[i][j]==4)            {                num=255;                break;            }            if(v[i][j]==3)            {                num=num<<1;                num++;                num=num<<1;                num++;            }            else if(v[i][j]==1)            {                num=num<<2;                num++;            }            else if(v[i][j]==2)            {                num=num<<1;                num++;                num=num<<1;            }            else            {                num=num<<2;            }        }        output(num);    }}
      |                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                   ^
#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...