Submission #824852

# Submission time Handle Problem Language Result Execution time Memory
824852 2023-08-14T11:11:10 Z andrei_boaca Fountain Parks (IOI21_parks) C++17
70 / 100
578 ms 109408 KB
#include "parks.h"
#include <bits/stdc++.h>
//#include "grader.cpp"
using namespace std;

typedef pair<int,int> pii;
map<pii,int> ind;
map<pii,int> ocup;
map<pii,int> match;
struct point
{
    int x,y;
} v[200005];
int k;
vector<int> myy[200005];
vector<int> muchii[200005];
vector<pii> edges;
bool have[11][200005];
bool use[200005];
void dfs(int nod)
{
    use[nod]=1;
    for(int i:muchii[nod])
        if(!use[i])
            dfs(i);
}
int c[11][200005];
vector<int> U,V,A,B;
void addedge(int xa,int ya,int xb,int yb,int xc,int yc)
{
    int a=ind[{xa,ya}];
    int b=ind[{xb,yb}];
    U.push_back(a);
    V.push_back(b);
    muchii[a].push_back(b);
    muchii[b].push_back(a);
    A.push_back(xc);
    B.push_back(yc);
}
int diri[5]={-2,2,0,0};
int dirj[5]={0,0,-2,2};
int nr;
vector<int> cedge[800005];
int l[800005],r[800005];
vector<pii> who;
bool pairup(int nod)
{
    if(use[nod])
        return 0;
    use[nod]=1;
    for(int i:cedge[nod])
        if(r[i]==0)
        {
            l[nod]=i;
            r[i]=nod;
            return 1;
        }
    for(int i:cedge[nod])
        if(pairup(r[i]))
        {
            l[nod]=i;
            r[i]=nod;
            return 1;
        }
    return 0;
}
int construct_roads(std::vector<int> X, std::vector<int> Y)
{
    k=X.size();
    int xmax=0;
    for(int i=0;i<k;i++)
    {
        v[i]={X[i],Y[i]};
        ind[{X[i],Y[i]}]=i;
        xmax=max(xmax,X[i]);
        if(X[i]<=6)
        {
            myy[X[i]].push_back(Y[i]);
            have[X[i]][Y[i]]=1;
        }
    }
    if(xmax<=2)
    {
        sort(myy[2].begin(),myy[2].end());
        vector<int> U,V,a,b;
        for(int i=1;i<myy[2].size();i++)
        {
            if(myy[2][i]-myy[2][i-1]!=2)
                return 0;
            int x=2;
            int yu=myy[2][i-1];
            int yv=myy[2][i];
            U.push_back(ind[{x,yu}]);
            V.push_back(ind[{x,yv}]);
            a.push_back(x-1);
            b.push_back(yv-1);
        }
        build(U,V,a,b);
        return 1;
    }
    if(xmax<=4)
    {
        sort(myy[2].begin(),myy[2].end());
        sort(myy[4].begin(),myy[4].end());
        vector<int> U,V,A,B;
        for(int i=2;i<=200000;i+=2)
            if(have[2][i]&&have[2][i-2])
            {
                int a=ind[{2,i}];
                int b=ind[{2,i-2}];
                U.push_back(a);
                V.push_back(b);
                muchii[a].push_back(b);
                muchii[b].push_back(a);
                A.push_back(1);
                B.push_back(i-1);
            }
        for(int i=2;i<=200000;i+=2)
            if(have[4][i]&&have[4][i-2])
            {
                int a=ind[{4,i}];
                int b=ind[{4,i-2}];
                U.push_back(a);
                V.push_back(b);
                muchii[a].push_back(b);
                muchii[b].push_back(a);
                A.push_back(5);
                B.push_back(i-1);
            }
        for(int i=2;i<=200000;i+=2)
            if(have[2][i]&&have[4][i])
            {
                int a=ind[{2,i}];
                int b=ind[{4,i}];
                U.push_back(a);
                V.push_back(b);
                muchii[a].push_back(b);
                muchii[b].push_back(a);
                A.push_back(3);
                B.push_back(i+1);
            }
        dfs(0);
        for(int i=0;i<k;i++)
            if(!use[i])
                return 0;
        build(U,V,A,B);
        return 1;
    }
    if(xmax<=6)
    {
        sort(myy[2].begin(),myy[2].end());
        sort(myy[4].begin(),myy[4].end());
        sort(myy[6].begin(),myy[6].end());
        int nr=0;
        for(int i=2;i<=200000;i+=2)
            if(have[2][i])
            {
                if(have[2][i-2])
                {
                    addedge(2,i,2,i-2,1,i-1);
                    c[2][i]=c[2][i-2];
                }
                else
                {
                    nr++;
                    c[2][i]=nr;
                }
            }
        for(int i=2;i<=200000;i+=2)
            if(have[6][i])
            {
                if(have[6][i-2])
                {
                    addedge(6,i,6,i-2,7,i-1);
                    c[6][i]=c[6][i-2];
                }
                else
                {
                    nr++;
                    c[6][i]=nr;
                }
            }
        int lft=1;
        for(int i=2;i<=200000;i+=2)
            if(have[4][i])
            {
                if(have[4][i-2])
                {
                    if(lft==1)
                    {
                        addedge(4,i,4,i-2,3,i-1);
                        ocup[{3,i-1}]=1;
                    }
                    else
                    {
                        addedge(4,i,4,i-2,5,i-1);
                        ocup[{5,i-1}]=1;
                    }
                    lft^=1;
                    c[4][i]=c[4][i-2];
                }
                else
                {
                    lft=1;
                    nr++;
                    c[4][i]=nr;
                }
            }
        for(int i=2;i<=200000;i+=2)
            if(have[2][i]&&have[4][i])
            {
                int a=c[2][i];
                int b=c[4][i];
                if(match[{a,b}]==0)
                    {
                        match[{a,b}]=1;
                        if(!ocup[{3,i-1}])
                            {
                                addedge(2,i,4,i,3,i-1);
                                ocup[{3,i-1}]=1;
                            }
                        else
                        {
                            addedge(2,i,4,i,3,i+1);
                            ocup[{3,i+1}]=1;
                        }
                    }
            }
        for(int i=2;i<=200000;i+=2)
            if(have[4][i]&&have[6][i])
            {
                int a=c[4][i];
                int b=c[6][i];
                if(match[{a,b}]==0)
                    {
                        match[{a,b}]=1;
                        if(!ocup[{5,i-1}])
                            {
                                addedge(4,i,6,i,5,i-1);
                                ocup[{5,i-1}]=1;
                            }
                        else
                        {
                            addedge(4,i,6,i,5,i+1);
                            ocup[{5,i+1}]=1;
                        }
                    }
            }
        dfs(0);
        for(int i=0;i<k;i++)
            if(!use[i])
                return 0;
        build(U,V,A,B);
        return 1;
    }
    for(auto p:ind)
    {
        int x=p.first.first;
        int y=p.first.second;
        int nod=p.second;
        for(int z=0;z<4;z++)
        {
            int lin=x+diri[z];
            int col=y+dirj[z];
            if(ind.count({lin,col})!=0)
                {
                    int w=ind[{lin,col}];
                    muchii[nod].push_back(w);
                    muchii[w].push_back(nod);
                    if(nod<w)
                        edges.push_back({nod,w});
                }
        }
    }
    dfs(0);
    for(int i=0;i<k;i++)
        if(!use[i])
            return 0;
    nr=0;
    who.push_back({0,0});
    for(int i=0;i<edges.size();i++)
    {
        int a=edges[i].first;
        int b=edges[i].second;
        int xa=X[a],ya=Y[a],xb=X[b],yb=Y[b];
        if(xa==xb)
        {
            int x=xa+1;
            int y=(ya+yb)/2;
            if(ind[{x,y}]==0)
                {
                    nr++;
                    ind[{x,y}]=nr;
                    who.push_back({x,y});
                }
            int nrm=ind[{x,y}];
            cedge[i+1].push_back(nrm);

            x=xa-1;
            y=(ya+yb)/2;
            if(ind[{x,y}]==0)
                {
                    nr++;
                    ind[{x,y}]=nr;
                    who.push_back({x,y});
                }
            nrm=ind[{x,y}];
            cedge[i+1].push_back(nrm);
        }
        else
        {
            int x=(xa+xb)/2;
            int y=ya-1;
            if(ind[{x,y}]==0)
                {
                    nr++;
                    ind[{x,y}]=nr;
                    who.push_back({x,y});
                }
            int nrm=ind[{x,y}];
            cedge[i+1].push_back(nrm);

            x=(xa+xb)/2;
            y=ya+1;
            if(ind[{x,y}]==0)
                {
                    nr++;
                    ind[{x,y}]=nr;
                    who.push_back({x,y});
                }
            nrm=ind[{x,y}];
            cedge[i+1].push_back(nrm);
        }
    }
    bool ok=0;
    do
    {
        ok=0;
        for(int i=1;i<=edges.size();i++)
            use[i]=0;
        for(int i=1;i<=edges.size();i++)
            if(l[i]==0)
                ok|=pairup(i);
    }while(ok);
    for(int i=1;i<=edges.size();i++)
        if(l[i]==0)
            return 0;
    for(int i=1;i<=edges.size();i++)
    {
        U.push_back(edges[i-1].first);
        V.push_back(edges[i-1].second);
        A.push_back(who[l[i]].first);
        B.push_back(who[l[i]].second);
    }
    build(U,V,A,B);
    return 1;
}

Compilation message

parks.cpp: In function 'int construct_roads(std::vector<int>, std::vector<int>)':
parks.cpp:86:22: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   86 |         for(int i=1;i<myy[2].size();i++)
      |                     ~^~~~~~~~~~~~~~
parks.cpp:281:18: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<std::pair<int, int> >::size_type' {aka 'long unsigned int'} [-Wsign-compare]
  281 |     for(int i=0;i<edges.size();i++)
      |                 ~^~~~~~~~~~~~~
parks.cpp:339:22: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<std::pair<int, int> >::size_type' {aka 'long unsigned int'} [-Wsign-compare]
  339 |         for(int i=1;i<=edges.size();i++)
      |                     ~^~~~~~~~~~~~~~
parks.cpp:341:22: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<std::pair<int, int> >::size_type' {aka 'long unsigned int'} [-Wsign-compare]
  341 |         for(int i=1;i<=edges.size();i++)
      |                     ~^~~~~~~~~~~~~~
parks.cpp:345:18: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<std::pair<int, int> >::size_type' {aka 'long unsigned int'} [-Wsign-compare]
  345 |     for(int i=1;i<=edges.size();i++)
      |                 ~^~~~~~~~~~~~~~
parks.cpp:348:18: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<std::pair<int, int> >::size_type' {aka 'long unsigned int'} [-Wsign-compare]
  348 |     for(int i=1;i<=edges.size();i++)
      |                 ~^~~~~~~~~~~~~~
# Verdict Execution time Memory Grader output
1 Correct 16 ms 28500 KB Output is correct
2 Correct 15 ms 28396 KB Output is correct
3 Correct 18 ms 28416 KB Output is correct
4 Correct 16 ms 28496 KB Output is correct
5 Correct 14 ms 28500 KB Output is correct
6 Correct 15 ms 28508 KB Output is correct
7 Correct 14 ms 28508 KB Output is correct
8 Correct 15 ms 28500 KB Output is correct
9 Correct 113 ms 43076 KB Output is correct
10 Correct 21 ms 30180 KB Output is correct
11 Correct 53 ms 36612 KB Output is correct
12 Correct 29 ms 30984 KB Output is correct
13 Correct 33 ms 33664 KB Output is correct
14 Correct 15 ms 28508 KB Output is correct
15 Correct 15 ms 28644 KB Output is correct
16 Correct 105 ms 43112 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 16 ms 28500 KB Output is correct
2 Correct 15 ms 28396 KB Output is correct
3 Correct 18 ms 28416 KB Output is correct
4 Correct 16 ms 28496 KB Output is correct
5 Correct 14 ms 28500 KB Output is correct
6 Correct 15 ms 28508 KB Output is correct
7 Correct 14 ms 28508 KB Output is correct
8 Correct 15 ms 28500 KB Output is correct
9 Correct 113 ms 43076 KB Output is correct
10 Correct 21 ms 30180 KB Output is correct
11 Correct 53 ms 36612 KB Output is correct
12 Correct 29 ms 30984 KB Output is correct
13 Correct 33 ms 33664 KB Output is correct
14 Correct 15 ms 28508 KB Output is correct
15 Correct 15 ms 28644 KB Output is correct
16 Correct 105 ms 43112 KB Output is correct
17 Correct 14 ms 28500 KB Output is correct
18 Correct 15 ms 28464 KB Output is correct
19 Correct 14 ms 28500 KB Output is correct
20 Correct 14 ms 28480 KB Output is correct
21 Correct 14 ms 28508 KB Output is correct
22 Correct 14 ms 28500 KB Output is correct
23 Correct 319 ms 71260 KB Output is correct
24 Correct 19 ms 28500 KB Output is correct
25 Correct 18 ms 28804 KB Output is correct
26 Correct 17 ms 29020 KB Output is correct
27 Correct 18 ms 29216 KB Output is correct
28 Correct 115 ms 45916 KB Output is correct
29 Correct 185 ms 54332 KB Output is correct
30 Correct 246 ms 62864 KB Output is correct
31 Correct 344 ms 71404 KB Output is correct
32 Correct 17 ms 28500 KB Output is correct
33 Correct 15 ms 28500 KB Output is correct
34 Correct 15 ms 28492 KB Output is correct
35 Correct 16 ms 28512 KB Output is correct
36 Correct 15 ms 28520 KB Output is correct
37 Correct 15 ms 28500 KB Output is correct
38 Correct 15 ms 28500 KB Output is correct
39 Correct 15 ms 28508 KB Output is correct
40 Correct 15 ms 28500 KB Output is correct
41 Correct 15 ms 28492 KB Output is correct
42 Correct 16 ms 28508 KB Output is correct
43 Correct 16 ms 28776 KB Output is correct
44 Correct 19 ms 28940 KB Output is correct
45 Correct 144 ms 47140 KB Output is correct
46 Correct 192 ms 55660 KB Output is correct
47 Correct 197 ms 55548 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 16 ms 28500 KB Output is correct
2 Correct 15 ms 28396 KB Output is correct
3 Correct 18 ms 28416 KB Output is correct
4 Correct 16 ms 28496 KB Output is correct
5 Correct 14 ms 28500 KB Output is correct
6 Correct 15 ms 28508 KB Output is correct
7 Correct 14 ms 28508 KB Output is correct
8 Correct 15 ms 28500 KB Output is correct
9 Correct 113 ms 43076 KB Output is correct
10 Correct 21 ms 30180 KB Output is correct
11 Correct 53 ms 36612 KB Output is correct
12 Correct 29 ms 30984 KB Output is correct
13 Correct 33 ms 33664 KB Output is correct
14 Correct 15 ms 28508 KB Output is correct
15 Correct 15 ms 28644 KB Output is correct
16 Correct 105 ms 43112 KB Output is correct
17 Correct 14 ms 28500 KB Output is correct
18 Correct 15 ms 28464 KB Output is correct
19 Correct 14 ms 28500 KB Output is correct
20 Correct 14 ms 28480 KB Output is correct
21 Correct 14 ms 28508 KB Output is correct
22 Correct 14 ms 28500 KB Output is correct
23 Correct 319 ms 71260 KB Output is correct
24 Correct 19 ms 28500 KB Output is correct
25 Correct 18 ms 28804 KB Output is correct
26 Correct 17 ms 29020 KB Output is correct
27 Correct 18 ms 29216 KB Output is correct
28 Correct 115 ms 45916 KB Output is correct
29 Correct 185 ms 54332 KB Output is correct
30 Correct 246 ms 62864 KB Output is correct
31 Correct 344 ms 71404 KB Output is correct
32 Correct 17 ms 28500 KB Output is correct
33 Correct 15 ms 28500 KB Output is correct
34 Correct 15 ms 28492 KB Output is correct
35 Correct 16 ms 28512 KB Output is correct
36 Correct 15 ms 28520 KB Output is correct
37 Correct 15 ms 28500 KB Output is correct
38 Correct 15 ms 28500 KB Output is correct
39 Correct 15 ms 28508 KB Output is correct
40 Correct 15 ms 28500 KB Output is correct
41 Correct 15 ms 28492 KB Output is correct
42 Correct 16 ms 28508 KB Output is correct
43 Correct 16 ms 28776 KB Output is correct
44 Correct 19 ms 28940 KB Output is correct
45 Correct 144 ms 47140 KB Output is correct
46 Correct 192 ms 55660 KB Output is correct
47 Correct 197 ms 55548 KB Output is correct
48 Correct 15 ms 28500 KB Output is correct
49 Correct 17 ms 28504 KB Output is correct
50 Correct 15 ms 28548 KB Output is correct
51 Correct 15 ms 28460 KB Output is correct
52 Correct 15 ms 28500 KB Output is correct
53 Correct 15 ms 28500 KB Output is correct
54 Correct 17 ms 28464 KB Output is correct
55 Correct 285 ms 70928 KB Output is correct
56 Correct 14 ms 28500 KB Output is correct
57 Correct 19 ms 28896 KB Output is correct
58 Correct 24 ms 29900 KB Output is correct
59 Correct 25 ms 30420 KB Output is correct
60 Correct 132 ms 49440 KB Output is correct
61 Correct 172 ms 58116 KB Output is correct
62 Correct 229 ms 63604 KB Output is correct
63 Correct 270 ms 70480 KB Output is correct
64 Correct 15 ms 28500 KB Output is correct
65 Correct 15 ms 28500 KB Output is correct
66 Correct 15 ms 28504 KB Output is correct
67 Correct 259 ms 67176 KB Output is correct
68 Correct 259 ms 67192 KB Output is correct
69 Correct 263 ms 67648 KB Output is correct
70 Correct 18 ms 29396 KB Output is correct
71 Correct 23 ms 30324 KB Output is correct
72 Correct 151 ms 53320 KB Output is correct
73 Correct 263 ms 65872 KB Output is correct
74 Correct 391 ms 77708 KB Output is correct
75 Correct 364 ms 79844 KB Output is correct
76 Correct 258 ms 68136 KB Output is correct
77 Correct 19 ms 29644 KB Output is correct
78 Correct 23 ms 30540 KB Output is correct
79 Correct 167 ms 54216 KB Output is correct
80 Correct 284 ms 66904 KB Output is correct
81 Correct 368 ms 79748 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 16 ms 28500 KB Output is correct
2 Correct 15 ms 28396 KB Output is correct
3 Correct 18 ms 28416 KB Output is correct
4 Correct 16 ms 28496 KB Output is correct
5 Correct 14 ms 28500 KB Output is correct
6 Correct 15 ms 28508 KB Output is correct
7 Correct 14 ms 28508 KB Output is correct
8 Correct 15 ms 28500 KB Output is correct
9 Correct 113 ms 43076 KB Output is correct
10 Correct 21 ms 30180 KB Output is correct
11 Correct 53 ms 36612 KB Output is correct
12 Correct 29 ms 30984 KB Output is correct
13 Correct 33 ms 33664 KB Output is correct
14 Correct 15 ms 28508 KB Output is correct
15 Correct 15 ms 28644 KB Output is correct
16 Correct 105 ms 43112 KB Output is correct
17 Correct 14 ms 28500 KB Output is correct
18 Correct 15 ms 28416 KB Output is correct
19 Correct 17 ms 28500 KB Output is correct
20 Correct 423 ms 95280 KB Output is correct
21 Correct 470 ms 94412 KB Output is correct
22 Correct 479 ms 93744 KB Output is correct
23 Correct 432 ms 96656 KB Output is correct
24 Correct 162 ms 47464 KB Output is correct
25 Correct 271 ms 55356 KB Output is correct
26 Correct 222 ms 55356 KB Output is correct
27 Correct 418 ms 104928 KB Output is correct
28 Correct 431 ms 104896 KB Output is correct
29 Correct 472 ms 104976 KB Output is correct
30 Correct 511 ms 105096 KB Output is correct
31 Correct 15 ms 28500 KB Output is correct
32 Correct 42 ms 33500 KB Output is correct
33 Correct 85 ms 38356 KB Output is correct
34 Correct 419 ms 94764 KB Output is correct
35 Correct 25 ms 29836 KB Output is correct
36 Correct 69 ms 35648 KB Output is correct
37 Correct 122 ms 42696 KB Output is correct
38 Correct 173 ms 55672 KB Output is correct
39 Correct 235 ms 65092 KB Output is correct
40 Correct 324 ms 76340 KB Output is correct
41 Correct 404 ms 85896 KB Output is correct
42 Correct 463 ms 95528 KB Output is correct
43 Correct 19 ms 28500 KB Output is correct
44 Correct 15 ms 28396 KB Output is correct
45 Correct 15 ms 28508 KB Output is correct
46 Correct 15 ms 28500 KB Output is correct
47 Correct 14 ms 28500 KB Output is correct
48 Correct 18 ms 28504 KB Output is correct
49 Correct 15 ms 28500 KB Output is correct
50 Correct 15 ms 28508 KB Output is correct
51 Correct 15 ms 28492 KB Output is correct
52 Correct 14 ms 28456 KB Output is correct
53 Correct 14 ms 28440 KB Output is correct
54 Correct 15 ms 28772 KB Output is correct
55 Correct 16 ms 28908 KB Output is correct
56 Correct 122 ms 47548 KB Output is correct
57 Correct 191 ms 56496 KB Output is correct
58 Correct 188 ms 56344 KB Output is correct
59 Correct 18 ms 28500 KB Output is correct
60 Correct 15 ms 28456 KB Output is correct
61 Correct 15 ms 28500 KB Output is correct
62 Correct 253 ms 68404 KB Output is correct
63 Correct 275 ms 68480 KB Output is correct
64 Correct 272 ms 68676 KB Output is correct
65 Correct 18 ms 29344 KB Output is correct
66 Correct 22 ms 30308 KB Output is correct
67 Correct 153 ms 53648 KB Output is correct
68 Correct 270 ms 66912 KB Output is correct
69 Correct 364 ms 79000 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 16 ms 28500 KB Output is correct
2 Correct 15 ms 28396 KB Output is correct
3 Correct 18 ms 28416 KB Output is correct
4 Correct 16 ms 28496 KB Output is correct
5 Correct 14 ms 28500 KB Output is correct
6 Correct 15 ms 28508 KB Output is correct
7 Correct 14 ms 28508 KB Output is correct
8 Correct 15 ms 28500 KB Output is correct
9 Correct 113 ms 43076 KB Output is correct
10 Correct 21 ms 30180 KB Output is correct
11 Correct 53 ms 36612 KB Output is correct
12 Correct 29 ms 30984 KB Output is correct
13 Correct 33 ms 33664 KB Output is correct
14 Correct 15 ms 28508 KB Output is correct
15 Correct 15 ms 28644 KB Output is correct
16 Correct 105 ms 43112 KB Output is correct
17 Correct 513 ms 107976 KB Output is correct
18 Correct 543 ms 109408 KB Output is correct
19 Correct 491 ms 99244 KB Output is correct
20 Correct 578 ms 103476 KB Output is correct
21 Correct 422 ms 96984 KB Output is correct
22 Correct 15 ms 28500 KB Output is correct
23 Correct 81 ms 40156 KB Output is correct
24 Correct 35 ms 31448 KB Output is correct
25 Correct 107 ms 38892 KB Output is correct
26 Correct 151 ms 46448 KB Output is correct
27 Correct 244 ms 66084 KB Output is correct
28 Correct 308 ms 77020 KB Output is correct
29 Correct 379 ms 86172 KB Output is correct
30 Correct 442 ms 94564 KB Output is correct
31 Correct 531 ms 104116 KB Output is correct
32 Correct 360 ms 81140 KB Output is correct
33 Correct 289 ms 69408 KB Output is correct
34 Correct 19 ms 29652 KB Output is correct
35 Correct 24 ms 30672 KB Output is correct
36 Correct 155 ms 54600 KB Output is correct
37 Correct 242 ms 67780 KB Output is correct
38 Correct 356 ms 80844 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 16 ms 28500 KB Output is correct
2 Correct 15 ms 28396 KB Output is correct
3 Correct 18 ms 28416 KB Output is correct
4 Correct 16 ms 28496 KB Output is correct
5 Correct 14 ms 28500 KB Output is correct
6 Correct 15 ms 28508 KB Output is correct
7 Correct 14 ms 28508 KB Output is correct
8 Correct 15 ms 28500 KB Output is correct
9 Correct 113 ms 43076 KB Output is correct
10 Correct 21 ms 30180 KB Output is correct
11 Correct 53 ms 36612 KB Output is correct
12 Correct 29 ms 30984 KB Output is correct
13 Correct 33 ms 33664 KB Output is correct
14 Correct 15 ms 28508 KB Output is correct
15 Correct 15 ms 28644 KB Output is correct
16 Correct 105 ms 43112 KB Output is correct
17 Correct 14 ms 28500 KB Output is correct
18 Correct 15 ms 28464 KB Output is correct
19 Correct 14 ms 28500 KB Output is correct
20 Correct 14 ms 28480 KB Output is correct
21 Correct 14 ms 28508 KB Output is correct
22 Correct 14 ms 28500 KB Output is correct
23 Correct 319 ms 71260 KB Output is correct
24 Correct 19 ms 28500 KB Output is correct
25 Correct 18 ms 28804 KB Output is correct
26 Correct 17 ms 29020 KB Output is correct
27 Correct 18 ms 29216 KB Output is correct
28 Correct 115 ms 45916 KB Output is correct
29 Correct 185 ms 54332 KB Output is correct
30 Correct 246 ms 62864 KB Output is correct
31 Correct 344 ms 71404 KB Output is correct
32 Correct 17 ms 28500 KB Output is correct
33 Correct 15 ms 28500 KB Output is correct
34 Correct 15 ms 28492 KB Output is correct
35 Correct 16 ms 28512 KB Output is correct
36 Correct 15 ms 28520 KB Output is correct
37 Correct 15 ms 28500 KB Output is correct
38 Correct 15 ms 28500 KB Output is correct
39 Correct 15 ms 28508 KB Output is correct
40 Correct 15 ms 28500 KB Output is correct
41 Correct 15 ms 28492 KB Output is correct
42 Correct 16 ms 28508 KB Output is correct
43 Correct 16 ms 28776 KB Output is correct
44 Correct 19 ms 28940 KB Output is correct
45 Correct 144 ms 47140 KB Output is correct
46 Correct 192 ms 55660 KB Output is correct
47 Correct 197 ms 55548 KB Output is correct
48 Correct 15 ms 28500 KB Output is correct
49 Correct 17 ms 28504 KB Output is correct
50 Correct 15 ms 28548 KB Output is correct
51 Correct 15 ms 28460 KB Output is correct
52 Correct 15 ms 28500 KB Output is correct
53 Correct 15 ms 28500 KB Output is correct
54 Correct 17 ms 28464 KB Output is correct
55 Correct 285 ms 70928 KB Output is correct
56 Correct 14 ms 28500 KB Output is correct
57 Correct 19 ms 28896 KB Output is correct
58 Correct 24 ms 29900 KB Output is correct
59 Correct 25 ms 30420 KB Output is correct
60 Correct 132 ms 49440 KB Output is correct
61 Correct 172 ms 58116 KB Output is correct
62 Correct 229 ms 63604 KB Output is correct
63 Correct 270 ms 70480 KB Output is correct
64 Correct 15 ms 28500 KB Output is correct
65 Correct 15 ms 28500 KB Output is correct
66 Correct 15 ms 28504 KB Output is correct
67 Correct 259 ms 67176 KB Output is correct
68 Correct 259 ms 67192 KB Output is correct
69 Correct 263 ms 67648 KB Output is correct
70 Correct 18 ms 29396 KB Output is correct
71 Correct 23 ms 30324 KB Output is correct
72 Correct 151 ms 53320 KB Output is correct
73 Correct 263 ms 65872 KB Output is correct
74 Correct 391 ms 77708 KB Output is correct
75 Correct 364 ms 79844 KB Output is correct
76 Correct 258 ms 68136 KB Output is correct
77 Correct 19 ms 29644 KB Output is correct
78 Correct 23 ms 30540 KB Output is correct
79 Correct 167 ms 54216 KB Output is correct
80 Correct 284 ms 66904 KB Output is correct
81 Correct 368 ms 79748 KB Output is correct
82 Correct 14 ms 28500 KB Output is correct
83 Correct 15 ms 28416 KB Output is correct
84 Correct 17 ms 28500 KB Output is correct
85 Correct 423 ms 95280 KB Output is correct
86 Correct 470 ms 94412 KB Output is correct
87 Correct 479 ms 93744 KB Output is correct
88 Correct 432 ms 96656 KB Output is correct
89 Correct 162 ms 47464 KB Output is correct
90 Correct 271 ms 55356 KB Output is correct
91 Correct 222 ms 55356 KB Output is correct
92 Correct 418 ms 104928 KB Output is correct
93 Correct 431 ms 104896 KB Output is correct
94 Correct 472 ms 104976 KB Output is correct
95 Correct 511 ms 105096 KB Output is correct
96 Correct 15 ms 28500 KB Output is correct
97 Correct 42 ms 33500 KB Output is correct
98 Correct 85 ms 38356 KB Output is correct
99 Correct 419 ms 94764 KB Output is correct
100 Correct 25 ms 29836 KB Output is correct
101 Correct 69 ms 35648 KB Output is correct
102 Correct 122 ms 42696 KB Output is correct
103 Correct 173 ms 55672 KB Output is correct
104 Correct 235 ms 65092 KB Output is correct
105 Correct 324 ms 76340 KB Output is correct
106 Correct 404 ms 85896 KB Output is correct
107 Correct 463 ms 95528 KB Output is correct
108 Correct 19 ms 28500 KB Output is correct
109 Correct 15 ms 28396 KB Output is correct
110 Correct 15 ms 28508 KB Output is correct
111 Correct 15 ms 28500 KB Output is correct
112 Correct 14 ms 28500 KB Output is correct
113 Correct 18 ms 28504 KB Output is correct
114 Correct 15 ms 28500 KB Output is correct
115 Correct 15 ms 28508 KB Output is correct
116 Correct 15 ms 28492 KB Output is correct
117 Correct 14 ms 28456 KB Output is correct
118 Correct 14 ms 28440 KB Output is correct
119 Correct 15 ms 28772 KB Output is correct
120 Correct 16 ms 28908 KB Output is correct
121 Correct 122 ms 47548 KB Output is correct
122 Correct 191 ms 56496 KB Output is correct
123 Correct 188 ms 56344 KB Output is correct
124 Correct 18 ms 28500 KB Output is correct
125 Correct 15 ms 28456 KB Output is correct
126 Correct 15 ms 28500 KB Output is correct
127 Correct 253 ms 68404 KB Output is correct
128 Correct 275 ms 68480 KB Output is correct
129 Correct 272 ms 68676 KB Output is correct
130 Correct 18 ms 29344 KB Output is correct
131 Correct 22 ms 30308 KB Output is correct
132 Correct 153 ms 53648 KB Output is correct
133 Correct 270 ms 66912 KB Output is correct
134 Correct 364 ms 79000 KB Output is correct
135 Correct 513 ms 107976 KB Output is correct
136 Correct 543 ms 109408 KB Output is correct
137 Correct 491 ms 99244 KB Output is correct
138 Correct 578 ms 103476 KB Output is correct
139 Correct 422 ms 96984 KB Output is correct
140 Correct 15 ms 28500 KB Output is correct
141 Correct 81 ms 40156 KB Output is correct
142 Correct 35 ms 31448 KB Output is correct
143 Correct 107 ms 38892 KB Output is correct
144 Correct 151 ms 46448 KB Output is correct
145 Correct 244 ms 66084 KB Output is correct
146 Correct 308 ms 77020 KB Output is correct
147 Correct 379 ms 86172 KB Output is correct
148 Correct 442 ms 94564 KB Output is correct
149 Correct 531 ms 104116 KB Output is correct
150 Correct 360 ms 81140 KB Output is correct
151 Correct 289 ms 69408 KB Output is correct
152 Correct 19 ms 29652 KB Output is correct
153 Correct 24 ms 30672 KB Output is correct
154 Correct 155 ms 54600 KB Output is correct
155 Correct 242 ms 67780 KB Output is correct
156 Correct 356 ms 80844 KB Output is correct
157 Correct 15 ms 28500 KB Output is correct
158 Correct 17 ms 28500 KB Output is correct
159 Correct 15 ms 28504 KB Output is correct
160 Correct 15 ms 28508 KB Output is correct
161 Incorrect 496 ms 93212 KB Solution announced impossible, but it is possible.
162 Halted 0 ms 0 KB -