Submission #476628

# Submission time Handle Problem Language Result Execution time Memory
476628 2021-09-27T19:40:02 Z TlenekWodoru Saveit (IOI10_saveit) C++14
50 / 100
366 ms 14248 KB
#include <bits/stdc++.h>
#include "grader.h"
#include "encoder.h"
using namespace std;
vector<int>D[1009];
vector<int>XD[1009];
int zaj[40][1009];
int vv1[7],vv2[7];
void encode(int nv, int nh, int ne, int *v1, int *v2)
{
    for(int i=0;i<ne;i++)
    {
        int a=v1[i];
        int b=v2[i];
        D[a].push_back(b);
        D[b].push_back(a);
    }
    for(int l=0;l<nh;l++)
    {
        XD[0].push_back(l);
        zaj[l][l]=1;
        for(int i=1;true;i++)
        {
            for(int j=0;j<XD[i-1].size();j++)
            {
                int ziom=XD[i-1][j];
                for(int k=0;k<D[ziom].size();k++)
                {
                    int somsiad=D[ziom][k];
                    if(zaj[l][somsiad]==0)
                    {
                        zaj[l][somsiad]=i;
                        XD[i].push_back(somsiad);
                    }
                }
            }
            if(XD[i-1].size()==0){zaj[l][l]=0;break;}
            XD[i-1].clear();
        }
    }
    vector<int>A;
    for(int i=nh-1;i>=0;i--)
    {
        for(int j=nv-1;j>=0;j--)
        {
            int u=zaj[i][j];
            for(int k=1;k<=10;k++)
            {
                A.push_back(u%2);
                u=u/2;
            }
        }
    }
    reverse(A.begin(),A.end());
    for(int i=0;i<A.size();i++)
    {
        encode_bit(A[i]);
    }
}
/**int main()
{ ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
    vv1[0]=0;vv2[0]=1;
    vv1[1]=0;vv2[1]=2;
    vv1[2]=0;vv2[2]=4;
    vv1[3]=2;vv2[3]=1;
    vv1[4]=3;vv2[4]=1;
    vv1[5]=0;vv2[5]=3;
    vv1[6]=1;vv2[6]=4;
    encode(5,3,7,vv1,vv2);
    return 0;
}**/
#include <bits/stdc++.h>
#include "grader.h"
#include "encoder.h"
using namespace std;
void decode(int nv, int nh) 
{
   for(int i=0;i<nh;i++)
   {
       for(int j=0;j<nv;j++)
       {
           int u=0;
           for(int k=1;k<=10;k++)
           {
               u=(u*2)+decode_bit();
           }
           hops(i,j,u); 
       }
   }
}

Compilation message

encoder.cpp: In function 'void encode(int, int, int, int*, int*)':
encoder.cpp:24:26: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   24 |             for(int j=0;j<XD[i-1].size();j++)
      |                         ~^~~~~~~~~~~~~~~
encoder.cpp:27:30: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   27 |                 for(int k=0;k<D[ziom].size();k++)
      |                             ~^~~~~~~~~~~~~~~
encoder.cpp:55:18: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   55 |     for(int i=0;i<A.size();i++)
      |                 ~^~~~~~~~~
# Verdict Execution time Memory Grader output
1 Correct 366 ms 14248 KB Output is partially correct - 360000 call(s) of encode_bit()
2 Correct 3 ms 4580 KB Output is correct - 150 call(s) of encode_bit()
3 Correct 84 ms 8832 KB Output is partially correct - 324000 call(s) of encode_bit()
4 Correct 3 ms 4580 KB Output is correct - 250 call(s) of encode_bit()
5 Correct 78 ms 8980 KB Output is partially correct - 324000 call(s) of encode_bit()
6 Correct 83 ms 9360 KB Output is partially correct - 360000 call(s) of encode_bit()
7 Correct 103 ms 9672 KB Output is partially correct - 360000 call(s) of encode_bit()
8 Correct 74 ms 9060 KB Output is partially correct - 345960 call(s) of encode_bit()
9 Correct 77 ms 9212 KB Output is partially correct - 360000 call(s) of encode_bit()
10 Correct 76 ms 9216 KB Output is partially correct - 360000 call(s) of encode_bit()
11 Correct 90 ms 9468 KB Output is partially correct - 360000 call(s) of encode_bit()
12 Correct 88 ms 9400 KB Output is partially correct - 360000 call(s) of encode_bit()
13 Correct 104 ms 10004 KB Output is partially correct - 360000 call(s) of encode_bit()
14 Correct 93 ms 9220 KB Output is partially correct - 360000 call(s) of encode_bit()
15 Correct 77 ms 9308 KB Output is partially correct - 360000 call(s) of encode_bit()
16 Correct 94 ms 9792 KB Output is partially correct - 360000 call(s) of encode_bit()
17 Correct 107 ms 9616 KB Output is partially correct - 360000 call(s) of encode_bit()
18 Correct 120 ms 10064 KB Output is partially correct - 360000 call(s) of encode_bit()
19 Correct 95 ms 9524 KB Output is partially correct - 360000 call(s) of encode_bit()
20 Correct 114 ms 10192 KB Output is partially correct - 360000 call(s) of encode_bit()
21 Correct 148 ms 10428 KB Output is partially correct - 360000 call(s) of encode_bit()
22 Correct 111 ms 9856 KB Output is partially correct - 360000 call(s) of encode_bit()
23 Correct 124 ms 10756 KB Output is partially correct - 360000 call(s) of encode_bit()
# Verdict Execution time Memory Grader output
1 Correct 366 ms 14248 KB Output is partially correct - 360000 call(s) of encode_bit()
2 Correct 3 ms 4580 KB Output is correct - 150 call(s) of encode_bit()
3 Correct 84 ms 8832 KB Output is partially correct - 324000 call(s) of encode_bit()
4 Correct 3 ms 4580 KB Output is correct - 250 call(s) of encode_bit()
5 Correct 78 ms 8980 KB Output is partially correct - 324000 call(s) of encode_bit()
6 Correct 83 ms 9360 KB Output is partially correct - 360000 call(s) of encode_bit()
7 Correct 103 ms 9672 KB Output is partially correct - 360000 call(s) of encode_bit()
8 Correct 74 ms 9060 KB Output is partially correct - 345960 call(s) of encode_bit()
9 Correct 77 ms 9212 KB Output is partially correct - 360000 call(s) of encode_bit()
10 Correct 76 ms 9216 KB Output is partially correct - 360000 call(s) of encode_bit()
11 Correct 90 ms 9468 KB Output is partially correct - 360000 call(s) of encode_bit()
12 Correct 88 ms 9400 KB Output is partially correct - 360000 call(s) of encode_bit()
13 Correct 104 ms 10004 KB Output is partially correct - 360000 call(s) of encode_bit()
14 Correct 93 ms 9220 KB Output is partially correct - 360000 call(s) of encode_bit()
15 Correct 77 ms 9308 KB Output is partially correct - 360000 call(s) of encode_bit()
16 Correct 94 ms 9792 KB Output is partially correct - 360000 call(s) of encode_bit()
17 Correct 107 ms 9616 KB Output is partially correct - 360000 call(s) of encode_bit()
18 Correct 120 ms 10064 KB Output is partially correct - 360000 call(s) of encode_bit()
19 Correct 95 ms 9524 KB Output is partially correct - 360000 call(s) of encode_bit()
20 Correct 114 ms 10192 KB Output is partially correct - 360000 call(s) of encode_bit()
21 Correct 148 ms 10428 KB Output is partially correct - 360000 call(s) of encode_bit()
22 Correct 111 ms 9856 KB Output is partially correct - 360000 call(s) of encode_bit()
23 Correct 124 ms 10756 KB Output is partially correct - 360000 call(s) of encode_bit()
# Verdict Execution time Memory Grader output
1 Correct 366 ms 14248 KB Output is partially correct - 360000 call(s) of encode_bit()
2 Correct 3 ms 4580 KB Output is correct - 150 call(s) of encode_bit()
3 Correct 84 ms 8832 KB Output is partially correct - 324000 call(s) of encode_bit()
4 Correct 3 ms 4580 KB Output is correct - 250 call(s) of encode_bit()
5 Correct 78 ms 8980 KB Output is partially correct - 324000 call(s) of encode_bit()
6 Correct 83 ms 9360 KB Output is partially correct - 360000 call(s) of encode_bit()
7 Correct 103 ms 9672 KB Output is partially correct - 360000 call(s) of encode_bit()
8 Correct 74 ms 9060 KB Output is partially correct - 345960 call(s) of encode_bit()
9 Correct 77 ms 9212 KB Output is partially correct - 360000 call(s) of encode_bit()
10 Correct 76 ms 9216 KB Output is partially correct - 360000 call(s) of encode_bit()
11 Correct 90 ms 9468 KB Output is partially correct - 360000 call(s) of encode_bit()
12 Correct 88 ms 9400 KB Output is partially correct - 360000 call(s) of encode_bit()
13 Correct 104 ms 10004 KB Output is partially correct - 360000 call(s) of encode_bit()
14 Correct 93 ms 9220 KB Output is partially correct - 360000 call(s) of encode_bit()
15 Correct 77 ms 9308 KB Output is partially correct - 360000 call(s) of encode_bit()
16 Correct 94 ms 9792 KB Output is partially correct - 360000 call(s) of encode_bit()
17 Correct 107 ms 9616 KB Output is partially correct - 360000 call(s) of encode_bit()
18 Correct 120 ms 10064 KB Output is partially correct - 360000 call(s) of encode_bit()
19 Correct 95 ms 9524 KB Output is partially correct - 360000 call(s) of encode_bit()
20 Correct 114 ms 10192 KB Output is partially correct - 360000 call(s) of encode_bit()
21 Correct 148 ms 10428 KB Output is partially correct - 360000 call(s) of encode_bit()
22 Correct 111 ms 9856 KB Output is partially correct - 360000 call(s) of encode_bit()
23 Correct 124 ms 10756 KB Output is partially correct - 360000 call(s) of encode_bit()
# Verdict Execution time Memory Grader output
1 Correct 366 ms 14248 KB Output is partially correct - 360000 call(s) of encode_bit()
2 Correct 3 ms 4580 KB Output is correct - 150 call(s) of encode_bit()
3 Correct 84 ms 8832 KB Output is partially correct - 324000 call(s) of encode_bit()
4 Correct 3 ms 4580 KB Output is correct - 250 call(s) of encode_bit()
5 Correct 78 ms 8980 KB Output is partially correct - 324000 call(s) of encode_bit()
6 Correct 83 ms 9360 KB Output is partially correct - 360000 call(s) of encode_bit()
7 Correct 103 ms 9672 KB Output is partially correct - 360000 call(s) of encode_bit()
8 Correct 74 ms 9060 KB Output is partially correct - 345960 call(s) of encode_bit()
9 Correct 77 ms 9212 KB Output is partially correct - 360000 call(s) of encode_bit()
10 Correct 76 ms 9216 KB Output is partially correct - 360000 call(s) of encode_bit()
11 Correct 90 ms 9468 KB Output is partially correct - 360000 call(s) of encode_bit()
12 Correct 88 ms 9400 KB Output is partially correct - 360000 call(s) of encode_bit()
13 Correct 104 ms 10004 KB Output is partially correct - 360000 call(s) of encode_bit()
14 Correct 93 ms 9220 KB Output is partially correct - 360000 call(s) of encode_bit()
15 Correct 77 ms 9308 KB Output is partially correct - 360000 call(s) of encode_bit()
16 Correct 94 ms 9792 KB Output is partially correct - 360000 call(s) of encode_bit()
17 Correct 107 ms 9616 KB Output is partially correct - 360000 call(s) of encode_bit()
18 Correct 120 ms 10064 KB Output is partially correct - 360000 call(s) of encode_bit()
19 Correct 95 ms 9524 KB Output is partially correct - 360000 call(s) of encode_bit()
20 Correct 114 ms 10192 KB Output is partially correct - 360000 call(s) of encode_bit()
21 Correct 148 ms 10428 KB Output is partially correct - 360000 call(s) of encode_bit()
22 Correct 111 ms 9856 KB Output is partially correct - 360000 call(s) of encode_bit()
23 Correct 124 ms 10756 KB Output is partially correct - 360000 call(s) of encode_bit()