Submission #363310

# Submission time Handle Problem Language Result Execution time Memory
363310 2021-02-05T13:21:57 Z beksultan04 Parrots (IOI11_parrots) C++14
99 / 100
9 ms 1656 KB
#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 time Memory Grader output
1 Correct 1 ms 880 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 2 ms 1136 KB Output is correct
2 Correct 2 ms 1336 KB Output is correct
3 Correct 3 ms 1144 KB Output is correct
4 Correct 3 ms 1144 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 2 ms 1336 KB Output is correct
2 Correct 2 ms 1140 KB Output is correct
3 Correct 3 ms 1372 KB Output is correct
4 Correct 3 ms 1144 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 2 ms 1284 KB Output is correct
2 Correct 3 ms 1316 KB Output is correct
3 Correct 3 ms 1364 KB Output is correct
4 Correct 4 ms 1360 KB Output is correct
5 Correct 4 ms 1304 KB Output is correct
6 Correct 7 ms 1316 KB Output is correct
# Verdict Execution time Memory Grader output
1 Partially correct 3 ms 1144 KB Output is partially correct - P = 5.750000
2 Partially correct 5 ms 1180 KB Output is partially correct - P = 5.718750
3 Partially correct 4 ms 1308 KB Output is partially correct - P = 5.696970
4 Partially correct 7 ms 1460 KB Output is partially correct - P = 5.920000
5 Partially correct 9 ms 1584 KB Output is partially correct - P = 5.750000
6 Partially correct 9 ms 1656 KB Output is partially correct - P = 5.841270
7 Partially correct 9 ms 1476 KB Output is partially correct - P = 5.906250