Submission #652748

# Submission time Handle Problem Language Result Execution time Memory
652748 2022-10-24T07:27:12 Z XCAC197 Hamburg Steak (JOI20_hamburg) C++14
100 / 100
2539 ms 186296 KB
#include <iostream>
#include <vector>
#include <map>
#include <stack>
#include <assert.h>

#define maxn 2000000
using namespace std;







int low [maxn];
int dfn [maxn];
bool instack [maxn];
stack <int> s;
vector <int> edgs [maxn];
int sccid [maxn];
int t = 0;
int sccct = 0;
int n;
 
void dfs(int u){
    low[u] = ++t;
    dfn[u] = t;
    s.push(u);
    instack[u] = true;
    for(int i = 0; i < edgs[u].size(); i++){
        if(dfn[edgs[u][i]] == 0){
            dfs(edgs[u][i]);
            low[u] = min(low[edgs[u][i]], low[u]);
        }else if(instack[edgs[u][i]]){
            low[u] = min(low[u], dfn[edgs[u][i]]);
        }
    }
    if(low[u] == dfn[u]){
        ++sccct;
        while(!s.empty()){
            int x = s.top();
            sccid[x] = sccct;
            s.pop();
            instack[x] = false;
            if(x == u){
                break;
            }
        }
    }
    
}
 
int neg(int x){
    if(x <= n){
        return x + n;
    }else{
        return x - n;
    }
}












struct rect{
    int l, r, d, u;
    rect(int lin, int rin, int din, int uin){
        l = lin;
        r = rin;
        d = din;
        u = uin;
    }
};

struct point{
    int x, y;
    point(int xin, int yin){
        x = xin;
        y = yin;
    }
};

bool in(point p, rect r){
    return (r.l <= p.x && p.x <= r.r && r.d <= p.y && p.y <= r.u);
}

vector <rect> removeSkewered(vector <rect> v, point p){
    vector <rect> vv;
    for(int i = 0; i < v.size(); i++){
        if(!in(p, v[i])){
            vv.push_back(v[i]);
        }
    }
    return vv;
}

vector <point> ans;

bool solveCorners(vector <rect> v, int k){
    if(k == 0){
        if(v.size() != 0){
            return false;
        }else{
            return true;
        }
    }else{
        if(v.size() != 0){
            int maxL = 1;
            int minR = 1e9;
            int maxD = 1;
            int minU = 1e9;
            for(int i = 0; i < v.size(); i++){
                maxL = max(maxL, v[i].l);
                minR = min(minR, v[i].r);
                maxD = max(maxD, v[i].d);
                minU = min(minU, v[i].u);
            }
            vector <point> testPoints;
            if(maxL <= minR){
                minR = maxL;
            }
            if(maxD <= minU){
                minU = maxD;
            }
            int possX [2] = {maxL, minR};
            int possY [2] = {maxD, minU};
            int itr1 = 2;
            int itr2 = 2;
            if(possX[0] == possX[1]){
                itr1 = 1;
            }
            if(possY[0] == possY[1]){
                itr2 = 1;
            }
            for(int i = 0; i < itr1; i++){
                for(int j = 0; j < itr2; j++){
                    if(solveCorners(removeSkewered(v, point(possX[i], possY[j])), k-1)){
                        ans.push_back(point(possX[i], possY[j]));
                        return true;
                    }
                }
            }
            return false;
        }else{
            return true;
        }
    }
}

bool solveSides(vector <rect> v){
    int maxL = 1;
    int minR = 1e9;
    int maxD = 1;
    int minU = 1e9;
    for(int i = 0; i < v.size(); i++){
        maxL = max(maxL, v[i].l);
        minR = min(minR, v[i].r);
        maxD = max(maxD, v[i].d);
        minU = min(minU, v[i].u);
    }
   // cout << maxL << "-" << minR << " " << maxD << " " << minU << endl;
    if(minR+1 < maxL && minU+1 < maxD){
        map <pair<int,int>, int> mp;
        vector <pair<pair<bool, pair<int,int>>, pair<bool, pair<int,int>>>> edgesList;
        for(int i = 0; i < v.size(); i++){
            int ll = v[i].l;
            int rr = v[i].r;
            int dd = v[i].d;
            int uu = v[i].u;
           // cout << ll << " " << rr << " " << dd << " " << uu << endl;
            if(rr < minR || maxL < ll || uu < minU || maxD < dd){
                //outside the rectangle: do nothing
            }else{
                vector <pair<int, pair <int, int>>> inter;
                if(ll <= minR && minR <= rr){
                    if((minU+1) <= uu && dd <= (maxD-1)){
                        inter.push_back(make_pair(1, make_pair(max(minU+1, dd), min(maxD-1, uu))));
                    }
                }
                if(ll <= maxL && maxL <= rr){
                    if((minU+1) <= uu && dd <= (maxD-1)){
                       // cout << minU+1 << " " << dd << "***" << maxD-1 << " " << uu << endl;
                        inter.push_back(make_pair(2, make_pair(max(minU+1, dd), min(maxD-1, uu))));
                    }
                }
                if(dd <= minU && minU <= uu){
                   // cout << "-" << endl;
                    if((minR+1) <= rr && ll <= (maxL+1)){
                        inter.push_back(make_pair(3, make_pair(max(minR+1, ll), min(maxL-1, rr))));
                    }
                }
                if(dd <= maxD && maxD <= uu){
                   // cout << "-" << endl;
                    if((minR+1) <= rr && ll <= (maxL+1)){
                        inter.push_back(make_pair(4, make_pair(max(minR+1, ll), min(maxL-1, rr))));
                    }
                }
                if(inter.size() >= 3){
                    //do nothing
                }else if(inter.size() == 0){
                 //   cout << "Nothing" << (dd <= minU && minU <= uu) << endl;
                    //do nothing
                }else if(inter.size() == 1){
                   // cout << "IS SINGLE" << endl;
                    int side = inter[0].first;
                    int left = inter[0].second.first-1;
                    int right = inter[0].second.second;
                    if(mp.find(make_pair(side,left)) == mp.end()){
                        mp[make_pair(side, left)] = ++n;
                    }
                    if(mp.find(make_pair(side,right)) == mp.end()){
                        mp[make_pair(side, right)] = ++n;
                    }
                 //   cout << i << " " << side << " " << inter[0].second.first << "/" << inter[0].second.second << endl;
                    edgesList.push_back(make_pair(make_pair(true, make_pair(side, left)), make_pair(false, make_pair(side, left))));
                    edgesList.push_back(make_pair(make_pair(false, make_pair(side, right)), make_pair(true, make_pair(side, right))));
                }else{
                    int side0 = inter[0].first;
                    int left0 = inter[0].second.first-1;
                    int right0 = inter[0].second.second;
                    int side1 = inter[1].first;
                    int left1 = inter[1].second.first-1;
                    int right1 = inter[1].second.second;
                    if(mp.find(make_pair(side0,left0)) == mp.end()){
                        mp[make_pair(side0, left0)] = ++n;
                    }
                    if(mp.find(make_pair(side0,right0)) == mp.end()){
                        mp[make_pair(side0, right0)] = ++n;
                    }
                    
                    if(mp.find(make_pair(side1,left1)) == mp.end()){
                        mp[make_pair(side1, left1)] = ++n;
                    }
                    if(mp.find(make_pair(side1,right1)) == mp.end()){
                        mp[make_pair(side1, right1)] = ++n;
                    }
                  //  cout << "IS DOUBLE" << endl;
                    edgesList.push_back(make_pair(make_pair(true, make_pair(side0, left0)), make_pair(false, make_pair(side1, left1))));
                    edgesList.push_back(make_pair(make_pair(true, make_pair(side1, left1)), make_pair(false, make_pair(side0, left0))));
                    
                    edgesList.push_back(make_pair(make_pair(false, make_pair(side0, right0)), make_pair(false, make_pair(side1, left1))));
                    edgesList.push_back(make_pair(make_pair(true, make_pair(side1, left1)), make_pair(true, make_pair(side0, right0))));
                    
                    edgesList.push_back(make_pair(make_pair(true, make_pair(side0, left0)), make_pair(true, make_pair(side1, right1))));
                    edgesList.push_back(make_pair(make_pair(false, make_pair(side1, right1)), make_pair(false, make_pair(side0, left0))));
                    
                    edgesList.push_back(make_pair(make_pair(false, make_pair(side0, right0)), make_pair(true, make_pair(side1, right1))));
                    edgesList.push_back(make_pair(make_pair(false, make_pair(side1, right1)), make_pair(true, make_pair(side0, right0))));
                }
                
            }
        }
        if(mp.find(make_pair(1, maxD-1)) == mp.end()){
            mp[make_pair(1, maxD-1)] = ++n;
        }
        edgesList.push_back(make_pair(make_pair(false, make_pair(1, maxD-1)), make_pair(true, make_pair(1, maxD-1))));
        
        if(mp.find(make_pair(2, maxD-1)) == mp.end()){
            mp[make_pair(2, maxD-1)] = ++n;
        }
        edgesList.push_back(make_pair(make_pair(false, make_pair(2, maxD-1)), make_pair(true, make_pair(2, maxD-1))));
        
        if(mp.find(make_pair(3, maxL-1)) == mp.end()){
            mp[make_pair(3, maxL-1)] = ++n;
        }
        edgesList.push_back(make_pair(make_pair(false, make_pair(3, maxL-1)), make_pair(true, make_pair(3, maxL-1))));
        
        if(mp.find(make_pair(4, maxL-1)) == mp.end()){
            mp[make_pair(4, maxL-1)] = ++n;
        }
        edgesList.push_back(make_pair(make_pair(false, make_pair(4, maxL-1)), make_pair(true, make_pair(4, maxL-1))));

        vector <pair<int,int>> sides [4];
        
        int prevSide = 0;
        int prevCord = 0;
        for(auto i = mp.begin(); i != mp.end(); i++){
            pair<pair <int,int>, int> pii = *i;
           // cout << pii.first.first << " " << pii.first.second << " " << pii.second << endl;
            sides[pii.first.first-1].push_back(make_pair(pii.first.second, pii.second));
            if(pii.first.first == prevSide){
                edgesList.push_back(make_pair(make_pair(true, make_pair(prevSide, prevCord)), make_pair(true, pii.first)));
                edgesList.push_back(make_pair(make_pair(false, pii.first), make_pair(false, make_pair(prevSide, prevCord))));
            }
            prevSide = pii.first.first;
            prevCord = pii.first.second;
        }
     //   cout << n << endl;
        for(int i = 0; i < edgesList.size(); i++){
         //   cout << edgesList[i].first.first << " " << edgesList[i].first.second.first << " " << edgesList[i].first.second.second;
          //  cout << " -- ";
         //   cout << edgesList[i].second.first << " " << edgesList[i].second.second.first << " " << edgesList[i].second.second.second;
         //   cout << endl;
            pair<bool,pair<int,int>> v1 = edgesList[i].first;
            pair<bool,pair<int,int>> v2 = edgesList[i].second;
            int v1id = mp[v1.second];
            if(!v1.first){
                v1id = neg(v1id);
            }
            int v2id = mp[v2.second];
            if(!v2.first){
                v2id = neg(v2id);
            }
            edgs[v1id].push_back(v2id);
        }
        for(int i = 1; i <= 2*n; i++){
            if(dfn[i] == 0){
                dfs(i);
            }
        }
        bool pos = true;
        for(int i = 1; i <= n; i++){
           //     cout << sccid[i] << " " << sccid[i+n] << endl;
            if(sccid[i] == sccid[i+n]){
                pos = false;
            }
        }
        if(!pos){
        //    cout << "***" << endl;
            return false;
        }
        for(int i = 0; i < 4; i++){
            for(int j = 0; j < sides[i].size(); j++){
                if(sccid[sides[i][j].second] < sccid[sides[i][j].second+n]){
                   if(i == 0){
                       ans.push_back(point(minR, sides[i][j].first));
                   }else if(i == 1){
                       ans.push_back(point(maxL, sides[i][j].first));
                   }else if(i == 2){
                       ans.push_back(point(sides[i][j].first, minU));
                   }else{
                       ans.push_back(point(sides[i][j].first, maxD));
                   }
                   break;
                }
            }
       //     cout << endl;
        }  
        if(ans.size() != 4){
            assert(0);
            cout << "??? 319" << endl;
            return false;
        }else{
            return true;
        }
    }else{
        return false;
    }
}

int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    int N, K;
    cin >> N >> K;
    vector <rect> rectArr;
    for(int i = 0; i < N; i++){
        int ll, rr, dd, uu;
        cin >> ll >> dd >> rr >> uu;
        rectArr.push_back(rect(ll, rr, dd, uu));
    }
    if(solveCorners(rectArr,K)){
        for(int i = 0; i < ans.size(); i++){
            cout << ans[i].x << " " << ans[i].y << endl;
        }
    }else if(K == 4 && solveSides(rectArr)){
      //  cout << "***" << endl;
        for(int i = 0; i < ans.size(); i++){
            cout << ans[i].x << " " << ans[i].y << endl;
        }
    }else{
        cout << "I GIVE UP GOODBYE" << endl;
    }
    
      //  vector <rect> rekt = rectArr;
      //  for(int i = 0; i < ans.size(); i++){
     //       rekt = removeSkewered(rekt, ans[i]);
       // }
       // cout << rekt.size() << endl;
      //  for(int i = 0; i < rekt.size(); i++){
           // cout << rekt[i].l << " " << rekt[i].r << " " << rekt[i].d << " " << rekt[i].u << endl;
      //  }
      //  cout << endl;
}

Compilation message

hamburg.cpp: In function 'void dfs(int)':
hamburg.cpp:31:22: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   31 |     for(int i = 0; i < edgs[u].size(); i++){
      |                    ~~^~~~~~~~~~~~~~~~
hamburg.cpp: In function 'std::vector<rect> removeSkewered(std::vector<rect>, point)':
hamburg.cpp:97:22: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<rect>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   97 |     for(int i = 0; i < v.size(); i++){
      |                    ~~^~~~~~~~~~
hamburg.cpp: In function 'bool solveCorners(std::vector<rect>, int)':
hamburg.cpp:120:30: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<rect>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
  120 |             for(int i = 0; i < v.size(); i++){
      |                            ~~^~~~~~~~~~
hamburg.cpp: In function 'bool solveSides(std::vector<rect>)':
hamburg.cpp:163:22: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<rect>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
  163 |     for(int i = 0; i < v.size(); i++){
      |                    ~~^~~~~~~~~~
hamburg.cpp:173:26: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<rect>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
  173 |         for(int i = 0; i < v.size(); i++){
      |                        ~~^~~~~~~~~~
hamburg.cpp:297:26: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<std::pair<std::pair<bool, std::pair<int, int> >, std::pair<bool, std::pair<int, int> > > >::size_type' {aka 'long unsigned int'} [-Wsign-compare]
  297 |         for(int i = 0; i < edgesList.size(); i++){
      |                        ~~^~~~~~~~~~~~~~~~~~
hamburg.cpp:331:30: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<std::pair<int, int> >::size_type' {aka 'long unsigned int'} [-Wsign-compare]
  331 |             for(int j = 0; j < sides[i].size(); j++){
      |                            ~~^~~~~~~~~~~~~~~~~
hamburg.cpp: In function 'int main()':
hamburg.cpp:371:26: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<point>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
  371 |         for(int i = 0; i < ans.size(); i++){
      |                        ~~^~~~~~~~~~~~
hamburg.cpp:376:26: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<point>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
  376 |         for(int i = 0; i < ans.size(); i++){
      |                        ~~^~~~~~~~~~~~
# Verdict Execution time Memory Grader output
1 Correct 27 ms 47484 KB Output is correct
2 Correct 25 ms 47384 KB Output is correct
3 Correct 24 ms 47444 KB Output is correct
4 Correct 25 ms 47516 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 28 ms 47368 KB Output is correct
2 Correct 25 ms 47456 KB Output is correct
3 Correct 25 ms 47444 KB Output is correct
4 Correct 27 ms 47572 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 30 ms 47444 KB Output is correct
2 Correct 27 ms 47444 KB Output is correct
3 Correct 29 ms 47460 KB Output is correct
4 Correct 26 ms 47432 KB Output is correct
5 Correct 27 ms 47524 KB Output is correct
6 Correct 29 ms 47428 KB Output is correct
7 Correct 25 ms 47448 KB Output is correct
8 Correct 30 ms 47632 KB Output is correct
9 Correct 25 ms 47504 KB Output is correct
10 Correct 26 ms 47656 KB Output is correct
11 Correct 27 ms 47624 KB Output is correct
12 Correct 27 ms 47644 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 26 ms 47496 KB Output is correct
2 Correct 27 ms 47452 KB Output is correct
3 Correct 27 ms 47508 KB Output is correct
4 Correct 28 ms 47444 KB Output is correct
5 Correct 33 ms 47436 KB Output is correct
6 Correct 27 ms 47440 KB Output is correct
7 Correct 26 ms 47444 KB Output is correct
8 Correct 30 ms 47700 KB Output is correct
9 Correct 27 ms 47556 KB Output is correct
10 Correct 27 ms 47632 KB Output is correct
11 Correct 28 ms 47688 KB Output is correct
12 Correct 26 ms 47560 KB Output is correct
13 Correct 26 ms 47532 KB Output is correct
14 Correct 30 ms 48096 KB Output is correct
15 Correct 27 ms 47444 KB Output is correct
16 Correct 30 ms 47504 KB Output is correct
17 Correct 31 ms 48232 KB Output is correct
18 Correct 28 ms 47600 KB Output is correct
19 Correct 26 ms 47492 KB Output is correct
20 Correct 34 ms 48372 KB Output is correct
21 Correct 27 ms 47556 KB Output is correct
22 Correct 26 ms 47652 KB Output is correct
23 Correct 37 ms 48492 KB Output is correct
24 Correct 27 ms 47700 KB Output is correct
25 Correct 27 ms 47680 KB Output is correct
26 Correct 29 ms 47656 KB Output is correct
27 Correct 27 ms 47664 KB Output is correct
28 Correct 26 ms 47688 KB Output is correct
29 Correct 28 ms 47648 KB Output is correct
30 Correct 28 ms 47692 KB Output is correct
31 Correct 32 ms 48032 KB Output is correct
32 Correct 31 ms 47944 KB Output is correct
33 Correct 31 ms 48064 KB Output is correct
34 Correct 30 ms 48004 KB Output is correct
35 Correct 36 ms 48560 KB Output is correct
36 Correct 33 ms 48012 KB Output is correct
37 Correct 42 ms 48488 KB Output is correct
38 Correct 39 ms 48576 KB Output is correct
39 Correct 33 ms 48336 KB Output is correct
40 Correct 31 ms 48040 KB Output is correct
41 Correct 34 ms 48276 KB Output is correct
42 Correct 41 ms 48384 KB Output is correct
43 Correct 34 ms 48196 KB Output is correct
44 Correct 44 ms 48320 KB Output is correct
45 Correct 31 ms 47760 KB Output is correct
46 Correct 37 ms 48416 KB Output is correct
47 Correct 35 ms 48236 KB Output is correct
48 Correct 38 ms 48480 KB Output is correct
49 Correct 34 ms 48276 KB Output is correct
50 Correct 33 ms 48176 KB Output is correct
51 Correct 38 ms 48504 KB Output is correct
52 Correct 34 ms 47996 KB Output is correct
53 Correct 34 ms 48332 KB Output is correct
54 Correct 37 ms 48432 KB Output is correct
55 Correct 33 ms 48308 KB Output is correct
56 Correct 32 ms 48256 KB Output is correct
57 Correct 31 ms 48204 KB Output is correct
58 Correct 35 ms 48292 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 27 ms 47484 KB Output is correct
2 Correct 25 ms 47384 KB Output is correct
3 Correct 24 ms 47444 KB Output is correct
4 Correct 25 ms 47516 KB Output is correct
5 Correct 114 ms 60204 KB Output is correct
6 Correct 115 ms 60092 KB Output is correct
7 Correct 135 ms 60140 KB Output is correct
8 Correct 112 ms 60208 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 28 ms 47368 KB Output is correct
2 Correct 25 ms 47456 KB Output is correct
3 Correct 25 ms 47444 KB Output is correct
4 Correct 27 ms 47572 KB Output is correct
5 Correct 109 ms 63568 KB Output is correct
6 Correct 123 ms 67332 KB Output is correct
7 Correct 132 ms 63488 KB Output is correct
8 Correct 139 ms 70764 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 30 ms 47444 KB Output is correct
2 Correct 27 ms 47444 KB Output is correct
3 Correct 29 ms 47460 KB Output is correct
4 Correct 26 ms 47432 KB Output is correct
5 Correct 27 ms 47524 KB Output is correct
6 Correct 29 ms 47428 KB Output is correct
7 Correct 25 ms 47448 KB Output is correct
8 Correct 30 ms 47632 KB Output is correct
9 Correct 25 ms 47504 KB Output is correct
10 Correct 26 ms 47656 KB Output is correct
11 Correct 27 ms 47624 KB Output is correct
12 Correct 27 ms 47644 KB Output is correct
13 Correct 121 ms 65180 KB Output is correct
14 Correct 117 ms 65192 KB Output is correct
15 Correct 122 ms 65788 KB Output is correct
16 Correct 133 ms 63508 KB Output is correct
17 Correct 116 ms 64192 KB Output is correct
18 Correct 135 ms 62420 KB Output is correct
19 Correct 118 ms 66180 KB Output is correct
20 Correct 231 ms 76752 KB Output is correct
21 Correct 115 ms 67368 KB Output is correct
22 Correct 164 ms 76416 KB Output is correct
23 Correct 185 ms 75956 KB Output is correct
24 Correct 190 ms 75584 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 26 ms 47496 KB Output is correct
2 Correct 27 ms 47452 KB Output is correct
3 Correct 27 ms 47508 KB Output is correct
4 Correct 28 ms 47444 KB Output is correct
5 Correct 33 ms 47436 KB Output is correct
6 Correct 27 ms 47440 KB Output is correct
7 Correct 26 ms 47444 KB Output is correct
8 Correct 30 ms 47700 KB Output is correct
9 Correct 27 ms 47556 KB Output is correct
10 Correct 27 ms 47632 KB Output is correct
11 Correct 28 ms 47688 KB Output is correct
12 Correct 26 ms 47560 KB Output is correct
13 Correct 26 ms 47532 KB Output is correct
14 Correct 30 ms 48096 KB Output is correct
15 Correct 27 ms 47444 KB Output is correct
16 Correct 30 ms 47504 KB Output is correct
17 Correct 31 ms 48232 KB Output is correct
18 Correct 28 ms 47600 KB Output is correct
19 Correct 26 ms 47492 KB Output is correct
20 Correct 34 ms 48372 KB Output is correct
21 Correct 27 ms 47556 KB Output is correct
22 Correct 26 ms 47652 KB Output is correct
23 Correct 37 ms 48492 KB Output is correct
24 Correct 27 ms 47700 KB Output is correct
25 Correct 27 ms 47680 KB Output is correct
26 Correct 29 ms 47656 KB Output is correct
27 Correct 27 ms 47664 KB Output is correct
28 Correct 26 ms 47688 KB Output is correct
29 Correct 28 ms 47648 KB Output is correct
30 Correct 28 ms 47692 KB Output is correct
31 Correct 32 ms 48032 KB Output is correct
32 Correct 31 ms 47944 KB Output is correct
33 Correct 31 ms 48064 KB Output is correct
34 Correct 30 ms 48004 KB Output is correct
35 Correct 36 ms 48560 KB Output is correct
36 Correct 33 ms 48012 KB Output is correct
37 Correct 42 ms 48488 KB Output is correct
38 Correct 39 ms 48576 KB Output is correct
39 Correct 33 ms 48336 KB Output is correct
40 Correct 31 ms 48040 KB Output is correct
41 Correct 34 ms 48276 KB Output is correct
42 Correct 41 ms 48384 KB Output is correct
43 Correct 34 ms 48196 KB Output is correct
44 Correct 44 ms 48320 KB Output is correct
45 Correct 31 ms 47760 KB Output is correct
46 Correct 37 ms 48416 KB Output is correct
47 Correct 35 ms 48236 KB Output is correct
48 Correct 38 ms 48480 KB Output is correct
49 Correct 34 ms 48276 KB Output is correct
50 Correct 33 ms 48176 KB Output is correct
51 Correct 38 ms 48504 KB Output is correct
52 Correct 34 ms 47996 KB Output is correct
53 Correct 34 ms 48332 KB Output is correct
54 Correct 37 ms 48432 KB Output is correct
55 Correct 33 ms 48308 KB Output is correct
56 Correct 32 ms 48256 KB Output is correct
57 Correct 31 ms 48204 KB Output is correct
58 Correct 35 ms 48292 KB Output is correct
59 Correct 121 ms 70728 KB Output is correct
60 Correct 146 ms 71476 KB Output is correct
61 Correct 113 ms 70576 KB Output is correct
62 Correct 135 ms 70528 KB Output is correct
63 Correct 122 ms 70084 KB Output is correct
64 Correct 134 ms 66024 KB Output is correct
65 Correct 147 ms 72480 KB Output is correct
66 Correct 543 ms 83940 KB Output is correct
67 Correct 242 ms 79980 KB Output is correct
68 Correct 565 ms 89472 KB Output is correct
69 Correct 717 ms 89816 KB Output is correct
70 Correct 469 ms 87572 KB Output is correct
71 Correct 119 ms 74556 KB Output is correct
72 Correct 1927 ms 162372 KB Output is correct
73 Correct 151 ms 77784 KB Output is correct
74 Correct 302 ms 89164 KB Output is correct
75 Correct 1117 ms 119860 KB Output is correct
76 Correct 305 ms 87380 KB Output is correct
77 Correct 142 ms 73952 KB Output is correct
78 Correct 2266 ms 167760 KB Output is correct
79 Correct 148 ms 78644 KB Output is correct
80 Correct 228 ms 79812 KB Output is correct
81 Correct 1878 ms 161508 KB Output is correct
82 Correct 278 ms 86140 KB Output is correct
83 Correct 304 ms 84640 KB Output is correct
84 Correct 353 ms 87888 KB Output is correct
85 Correct 522 ms 89780 KB Output is correct
86 Correct 204 ms 80044 KB Output is correct
87 Correct 567 ms 90280 KB Output is correct
88 Correct 367 ms 89824 KB Output is correct
89 Correct 1437 ms 138988 KB Output is correct
90 Correct 2198 ms 167376 KB Output is correct
91 Correct 1305 ms 133140 KB Output is correct
92 Correct 2539 ms 186296 KB Output is correct
93 Correct 1905 ms 165352 KB Output is correct
94 Correct 2053 ms 163580 KB Output is correct
95 Correct 2210 ms 168404 KB Output is correct
96 Correct 1692 ms 155060 KB Output is correct
97 Correct 1943 ms 163372 KB Output is correct
98 Correct 1714 ms 157208 KB Output is correct
99 Correct 1322 ms 136572 KB Output is correct
100 Correct 2040 ms 168384 KB Output is correct
101 Correct 2299 ms 169632 KB Output is correct
102 Correct 1109 ms 110592 KB Output is correct
103 Correct 2387 ms 170980 KB Output is correct
104 Correct 1223 ms 130488 KB Output is correct
105 Correct 2194 ms 174960 KB Output is correct
106 Correct 2044 ms 163456 KB Output is correct
107 Correct 1766 ms 156572 KB Output is correct
108 Correct 2129 ms 172724 KB Output is correct
109 Correct 2125 ms 169924 KB Output is correct
110 Correct 1958 ms 165808 KB Output is correct
111 Correct 1686 ms 156728 KB Output is correct
112 Correct 2154 ms 173196 KB Output is correct
113 Correct 1258 ms 143408 KB Output is correct
114 Correct 1319 ms 144364 KB Output is correct
115 Correct 1258 ms 143284 KB Output is correct
116 Correct 1254 ms 142584 KB Output is correct
117 Correct 1566 ms 158948 KB Output is correct
118 Correct 1483 ms 158932 KB Output is correct
119 Correct 1538 ms 158916 KB Output is correct
120 Correct 1710 ms 159112 KB Output is correct
121 Correct 1635 ms 159080 KB Output is correct
122 Correct 1545 ms 159016 KB Output is correct
123 Correct 1543 ms 159068 KB Output is correct
124 Correct 1529 ms 158932 KB Output is correct
125 Correct 1540 ms 158932 KB Output is correct
126 Correct 1523 ms 159044 KB Output is correct