Submission #1048917

# Submission time Handle Problem Language Result Execution time Memory
1048917 2024-08-08T11:06:00 Z kostia244 Hamburg Steak (JOI20_hamburg) C++17
100 / 100
1435 ms 264420 KB
#include <bits/stdc++.h>
#define all(x) begin(x), end(x)
using namespace std;
using ll = long long;

const int inf = 1<<30;
struct Rect {
    array<array<int, 2>, 2> ranges;
    void rotate(int c) {
        while(c--) {
            for(int i = 0; i < 2; i++) {
                ranges[0][i] = -exchange(ranges[1][i], ranges[0][i]);
            }
            for(int i = 0; i < 2; i++) {
                if(ranges[i][0] > ranges[i][1])
                    swap(ranges[i][0], ranges[i][1]);
            }
        }
    }
    friend Rect intersect(const Rect &a, const Rect &b) {
        Rect res;
        for(int i = 0; i < 2; i++) {
            res.ranges[i][0] = max(a.ranges[i][0], b.ranges[i][0]);
            res.ranges[i][1] = min(a.ranges[i][1], b.ranges[i][1]);
        }
        return res;
    }
    bool contains(array<int, 2> P) {
        for(int i = 0; i < 2; i++) {
            if(P[i] < ranges[i][0] || P[i] > ranges[i][1])
                return false;
        }
        return true;
    }
    bool empty() {
        for(int i = 0; i < 2; i++) 
            if(ranges[i][0] > ranges[i][1])
                return true;
        return false;
    }
};

Rect intersectAll(vector<Rect> &v) {
    Rect res;
    res.ranges[0][0] = res.ranges[1][0] = -inf;
    res.ranges[0][1] = res.ranges[1][1] = inf;
    for(auto &i : v)
        res = intersect(res, i);
    return res;
}

vector<Rect> prune(vector<Rect> v, array<int, 2> P) {
    vector<Rect> res;
    for(auto i : v) if(!i.contains(P)) {
        res.push_back(i);
    }
    return res;
}

array<vector<int>, 2> compress(vector<Rect> &v) {
    array<vector<int>, 2> clist;
    for(auto r : v) {
        for(int i = 0; i < 2; i++) {
            for(int j = 0; j < 2; j++) {
                clist[i].push_back(r.ranges[i][j]);
            }
        }
    }
    for(auto &c : clist) sort(all(c)), c.erase(unique(all(c)), c.end());
    for(auto &r : v) {
        for(int i = 0; i < 2; i++) {
            for(int j = 0; j < 2; j++) {
                r.ranges[i][j] = lower_bound(all(clist[i]), r.ranges[i][j]) - clist[i].begin();
            }
        }
    }
    return clist;
}

// Solve k<=3 and k=4 if we use a corner or intersection is non-empty
vector<array<int, 2>> solve_corner(vector<Rect> rects, int k) {
    if(k < 1) return {};
    
    //All intersect use 1, not tested
    Rect I = intersectAll(rects);
    if(I.ranges[0][0] <= I.ranges[0][1] && I.ranges[1][0] <= I.ranges[1][1]) {
        return {{I.ranges[0][0], I.ranges[1][0]}};
    }
    
    // for(auto &c : I.ranges) {
    //     for(auto &v : c) cout << v << ", ";
    //     cout << endl;
    // }
    //1D case; not tested
    int rot = 0;
    if(I.ranges[1][0] <= I.ranges[1][1]) {
        rot++;
        I.rotate(1);
        for(auto &i : rects) i.rotate(1);
    }
    if(I.ranges[0][0] <= I.ranges[0][1]) {
        vector<array<int, 2>> segs;//{R, L}
        for(auto r : rects) {
            segs.push_back({r.ranges[1][1], r.ranges[1][0]});
        }
        sort(all(segs));
        int covered = -1;
        vector<array<int, 2>> sol;
        for(auto [r, l] : segs) {
            if(l <= covered) {
                assert(covered <= r);
            } else {
                sol.push_back({I.ranges[0][0], covered = r});
            }
        }
        if(sol.size() > k) return {};
        if(rot) {
            for(auto &[x, y] : sol) {
                y = -exchange(x, y);
            }
        }
        return sol;
    }
    
    assert(!rot);
    
    //Use corner case; not tested
    for(int i = 0; i < 2; i++) {
        for(int j = 0; j < 2; j++) {
            array<int, 2> P = {I.ranges[0][i], I.ranges[1][j]};
            auto tmp = solve_corner(prune(rects, P), k - 1);
            if(!tmp.empty()) {
                tmp.push_back(P);
                return tmp;
            }
        }
    }
    
    return {};
}

#define rep(i, a, b) for(int i = a; i < (b); ++i)
#define all(x) begin(x), end(x)
#define sz(x) (int)(x).size()
typedef long long ll;
typedef pair<int, int> pii;
typedef vector<int> vi;
struct TwoSat {
	int N;
	vector<vi> gr;
	vi values; // 0 = false, 1 = true

	TwoSat(int n = 0) : N(n), gr(2*n) {}

	int addVar() { // (optional)
		gr.emplace_back();
		gr.emplace_back();
		return N++;
	}

	void either(int f, int j) {
		f = max(2*f, -1-2*f);
		j = max(2*j, -1-2*j);
		gr[f].push_back(j^1);
		gr[j].push_back(f^1);
	}
	void setValue(int x) { either(x, x); }

	void atMostOne(const vi& li) { // (optional)
		if (sz(li) <= 1) return;
		int cur = ~li[0];
		rep(i,2,sz(li)) {
			int next = addVar();
			either(cur, ~li[i]);
			either(cur, next);
			either(~li[i], next);
			cur = ~next;
		}
		either(cur, ~li[1]);
	}

	vi val, comp, z; int time = 0;
	int dfs(int i) {
		int low = val[i] = ++time, x; z.push_back(i);
		for(int e : gr[i]) if (!comp[e])
			low = min(low, val[e] ?: dfs(e));
		if (low == val[i]) do {
			x = z.back(); z.pop_back();
			comp[x] = low;
			if (values[x>>1] == -1)
				values[x>>1] = x&1;
		} while (x != i);
		return val[i] = low;
	}

	bool solve() {
		values.assign(N, -1);
		val.assign(2*N, 0); comp = val;
		rep(i,0,2*N) if (!comp[i]) dfs(i);
		rep(i,0,N) if (comp[2*i] == comp[2*i+1]) return 0;
		return 1;
	}
};

//solve k=4, no point in the corner -> all on the perimeter
vector<array<int, 2>> solve_perim(vector<Rect> rects) {
    auto clist = compress(rects);
    
    Rect I = intersectAll(rects);
    swap(I.ranges[0][0], I.ranges[0][1]);
    swap(I.ranges[1][0], I.ranges[1][1]);
    for(int i = 0; i < 2; i++) assert(I.ranges[i][0] < I.ranges[i][1]);//because we already used the other function
    
    // cout << I.ranges[0][0] << " " << I.ranges[0][1] << endl;
    // cout << I.ranges[1][0] << " " << I.ranges[1][1] << endl;
    
    vector<vector<int>> myVars(rects.size());
    vector<int> starts;
    TwoSat sat;
    for(int c = 0; c < 2; c++) {
        for(int x = 0; x < 2; x++) {
            
            Rect l = I;
            l.ranges[c][x] = l.ranges[c][x^1];
            l.ranges[c^1][0]++;
            l.ranges[c^1][1]--;
            
            int len = l.ranges[c^1][1] - l.ranges[c^1][0] + 1;
                // cout << l.ranges[c][x] << " : " << l.ranges[c^1][0] << " " << l.ranges[c^1][1] << endl;
            
            int start = sat.addVar();
            starts.push_back(start);
            sat.setValue(~start);
            for(int i = 1; i <= len; i++) {
                assert(sat.addVar() == start + i);   
                sat.either(~(start + i - 1), (start + i));
            }
            int lid = 2*c+x;
            for(int i = 0; i < rects.size(); i++) {
                auto inter = intersect(l, rects[i]);
                // cout << "I" << inter.ranges[c][x] << " : " << inter.ranges[c^1][0] << " " << inter.ranges[c^1][1] << endl;
                if(inter.empty()) continue;
                int b = inter.ranges[c^1][0] - l.ranges[c^1][0] + 1;
                int e = inter.ranges[c^1][1] - l.ranges[c^1][0] + 1;
                int x = sat.addVar();
                myVars[i].push_back(x);
                sat.either(~x, ~(start + b - 1));
                sat.either(~x, start + e);
                // cout << "Line " << lid << "; Rect " << i << "_" << x << " : not " << start + b - 1 << " or " << start + e << endl;
            }
        }
    }
    
    for(auto v : myVars) {
        if(v.size() == 1) sat.setValue(v[0]);//, cout << "SET " << v[0] << endl;
        if(v.size() == 2) sat.either(v[0], v[1]);//, cout << "OR " << v[0] << " " << v[1] << endl;
    }
    
    assert(sat.solve());
    
    vector<array<int, 2>> ans;
    for(int c = 0; c < 2; c++) {
        for(int x = 0; x < 2; x++) {
            
            Rect l = I;
            l.ranges[c][x] = l.ranges[c][x^1];
            l.ranges[c^1][0]++;
            l.ranges[c^1][1]--;
            int len = l.ranges[c^1][1] - l.ranges[c^1][0] + 1;
            
            int start = starts[c*2+x];
            
            // for(int i = 0; i <= len; i++) {
            //     cout << sat.values[start+i] << " ";
            // }cout << endl;
            
            array<int, 2> pt;
            pt[c] = l.ranges[c][x];
            pt[c^1] = l.ranges[c^1][0] - 1;
            while(!sat.values[start]) {
                start++;
                pt[c^1]++;
            }
            ans.push_back(pt);
        }
    }
    
    for(auto &i : ans) {
        for(int c = 0; c < 2; c++) {
            i[c] = clist[c][i[c]];
        }
    }
    
    return ans;
}

vector<array<int, 2>> solve() {
    int n, k;
    cin >> n >> k;
    vector<Rect> rects(n);
    for(auto &r : rects) {
        // cin >> r.ranges[0][0] >> r[1][0] >> r[0][1] >> r[1][1];
        for(int i = 0; i < 2; i++)
            for(int j = 0; j < 2; j++)
                cin >> r.ranges[j][i];
        
    }
    
    auto res = solve_corner(rects, k);
    if(res.empty() && k == 4) {
        res = solve_perim(rects);
    }
    assert(!res.empty());
    while(res.size() < k) res.push_back(res.back());

    return res;
}

int main() {
    cin.tie(0)->sync_with_stdio(0);
    auto out = solve();
    for(auto [x, y] : out) {
        cout << x << " " << y << '\n';
    }
}

Compilation message

hamburg.cpp: In function 'std::vector<std::array<int, 2> > solve_corner(std::vector<Rect>, int)':
hamburg.cpp:116:23: warning: comparison of integer expressions of different signedness: 'std::vector<std::array<int, 2> >::size_type' {aka 'long unsigned int'} and 'int' [-Wsign-compare]
  116 |         if(sol.size() > k) return {};
      |            ~~~~~~~~~~~^~~
hamburg.cpp: In function 'std::vector<std::array<int, 2> > solve_perim(std::vector<Rect>)':
hamburg.cpp:239:30: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<Rect>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
  239 |             for(int i = 0; i < rects.size(); i++) {
      |                            ~~^~~~~~~~~~~~~~
hamburg.cpp:238:17: warning: unused variable 'lid' [-Wunused-variable]
  238 |             int lid = 2*c+x;
      |                 ^~~
hamburg.cpp:269:17: warning: unused variable 'len' [-Wunused-variable]
  269 |             int len = l.ranges[c^1][1] - l.ranges[c^1][0] + 1;
      |                 ^~~
hamburg.cpp: In function 'std::vector<std::array<int, 2> > solve()':
hamburg.cpp:314:22: warning: comparison of integer expressions of different signedness: 'std::vector<std::array<int, 2> >::size_type' {aka 'long unsigned int'} and 'int' [-Wsign-compare]
  314 |     while(res.size() < k) res.push_back(res.back());
      |           ~~~~~~~~~~~^~~
# Verdict Execution time Memory Grader output
1 Correct 1 ms 348 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Correct 0 ms 348 KB Output is correct
4 Correct 1 ms 348 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 348 KB Output is correct
2 Correct 1 ms 604 KB Output is correct
3 Correct 1 ms 348 KB Output is correct
4 Correct 1 ms 604 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 344 KB Output is correct
2 Correct 1 ms 348 KB Output is correct
3 Correct 1 ms 348 KB Output is correct
4 Correct 1 ms 348 KB Output is correct
5 Correct 1 ms 348 KB Output is correct
6 Correct 1 ms 348 KB Output is correct
7 Correct 1 ms 604 KB Output is correct
8 Correct 1 ms 604 KB Output is correct
9 Correct 1 ms 604 KB Output is correct
10 Correct 1 ms 604 KB Output is correct
11 Correct 1 ms 604 KB Output is correct
12 Correct 1 ms 604 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 348 KB Output is correct
2 Correct 1 ms 348 KB Output is correct
3 Correct 1 ms 348 KB Output is correct
4 Correct 1 ms 348 KB Output is correct
5 Correct 1 ms 348 KB Output is correct
6 Correct 1 ms 348 KB Output is correct
7 Correct 1 ms 604 KB Output is correct
8 Correct 3 ms 720 KB Output is correct
9 Correct 1 ms 604 KB Output is correct
10 Correct 2 ms 604 KB Output is correct
11 Correct 3 ms 720 KB Output is correct
12 Correct 1 ms 604 KB Output is correct
13 Correct 1 ms 604 KB Output is correct
14 Correct 5 ms 2064 KB Output is correct
15 Correct 1 ms 604 KB Output is correct
16 Correct 1 ms 604 KB Output is correct
17 Correct 6 ms 2368 KB Output is correct
18 Correct 1 ms 752 KB Output is correct
19 Correct 1 ms 604 KB Output is correct
20 Correct 7 ms 2504 KB Output is correct
21 Correct 2 ms 604 KB Output is correct
22 Correct 2 ms 824 KB Output is correct
23 Correct 10 ms 2420 KB Output is correct
24 Correct 3 ms 860 KB Output is correct
25 Correct 2 ms 804 KB Output is correct
26 Correct 3 ms 824 KB Output is correct
27 Correct 2 ms 824 KB Output is correct
28 Correct 2 ms 820 KB Output is correct
29 Correct 2 ms 812 KB Output is correct
30 Correct 2 ms 812 KB Output is correct
31 Correct 5 ms 2216 KB Output is correct
32 Correct 5 ms 2144 KB Output is correct
33 Correct 6 ms 2252 KB Output is correct
34 Correct 5 ms 2156 KB Output is correct
35 Correct 8 ms 2280 KB Output is correct
36 Correct 6 ms 2344 KB Output is correct
37 Correct 9 ms 2956 KB Output is correct
38 Correct 9 ms 2756 KB Output is correct
39 Correct 7 ms 2240 KB Output is correct
40 Correct 6 ms 2220 KB Output is correct
41 Correct 6 ms 2480 KB Output is correct
42 Correct 8 ms 2868 KB Output is correct
43 Correct 7 ms 2388 KB Output is correct
44 Correct 7 ms 2424 KB Output is correct
45 Correct 3 ms 860 KB Output is correct
46 Correct 7 ms 2516 KB Output is correct
47 Correct 6 ms 2312 KB Output is correct
48 Correct 9 ms 2716 KB Output is correct
49 Correct 7 ms 2296 KB Output is correct
50 Correct 6 ms 2204 KB Output is correct
51 Correct 9 ms 2588 KB Output is correct
52 Correct 6 ms 2180 KB Output is correct
53 Correct 7 ms 2328 KB Output is correct
54 Correct 8 ms 2752 KB Output is correct
55 Correct 6 ms 2324 KB Output is correct
56 Correct 5 ms 2324 KB Output is correct
57 Correct 6 ms 2324 KB Output is correct
58 Correct 5 ms 2324 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 348 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Correct 0 ms 348 KB Output is correct
4 Correct 1 ms 348 KB Output is correct
5 Correct 48 ms 6484 KB Output is correct
6 Correct 47 ms 6484 KB Output is correct
7 Correct 43 ms 6484 KB Output is correct
8 Correct 45 ms 6488 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 348 KB Output is correct
2 Correct 1 ms 604 KB Output is correct
3 Correct 1 ms 348 KB Output is correct
4 Correct 1 ms 604 KB Output is correct
5 Correct 47 ms 11984 KB Output is correct
6 Correct 54 ms 16328 KB Output is correct
7 Correct 56 ms 11904 KB Output is correct
8 Correct 57 ms 20680 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 344 KB Output is correct
2 Correct 1 ms 348 KB Output is correct
3 Correct 1 ms 348 KB Output is correct
4 Correct 1 ms 348 KB Output is correct
5 Correct 1 ms 348 KB Output is correct
6 Correct 1 ms 348 KB Output is correct
7 Correct 1 ms 604 KB Output is correct
8 Correct 1 ms 604 KB Output is correct
9 Correct 1 ms 604 KB Output is correct
10 Correct 1 ms 604 KB Output is correct
11 Correct 1 ms 604 KB Output is correct
12 Correct 1 ms 604 KB Output is correct
13 Correct 60 ms 8816 KB Output is correct
14 Correct 59 ms 8840 KB Output is correct
15 Correct 67 ms 8652 KB Output is correct
16 Correct 68 ms 8908 KB Output is correct
17 Correct 59 ms 8656 KB Output is correct
18 Correct 58 ms 8836 KB Output is correct
19 Correct 49 ms 14536 KB Output is correct
20 Correct 165 ms 30452 KB Output is correct
21 Correct 52 ms 18632 KB Output is correct
22 Correct 88 ms 29000 KB Output is correct
23 Correct 111 ms 28352 KB Output is correct
24 Correct 93 ms 27512 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 348 KB Output is correct
2 Correct 1 ms 348 KB Output is correct
3 Correct 1 ms 348 KB Output is correct
4 Correct 1 ms 348 KB Output is correct
5 Correct 1 ms 348 KB Output is correct
6 Correct 1 ms 348 KB Output is correct
7 Correct 1 ms 604 KB Output is correct
8 Correct 3 ms 720 KB Output is correct
9 Correct 1 ms 604 KB Output is correct
10 Correct 2 ms 604 KB Output is correct
11 Correct 3 ms 720 KB Output is correct
12 Correct 1 ms 604 KB Output is correct
13 Correct 1 ms 604 KB Output is correct
14 Correct 5 ms 2064 KB Output is correct
15 Correct 1 ms 604 KB Output is correct
16 Correct 1 ms 604 KB Output is correct
17 Correct 6 ms 2368 KB Output is correct
18 Correct 1 ms 752 KB Output is correct
19 Correct 1 ms 604 KB Output is correct
20 Correct 7 ms 2504 KB Output is correct
21 Correct 2 ms 604 KB Output is correct
22 Correct 2 ms 824 KB Output is correct
23 Correct 10 ms 2420 KB Output is correct
24 Correct 3 ms 860 KB Output is correct
25 Correct 2 ms 804 KB Output is correct
26 Correct 3 ms 824 KB Output is correct
27 Correct 2 ms 824 KB Output is correct
28 Correct 2 ms 820 KB Output is correct
29 Correct 2 ms 812 KB Output is correct
30 Correct 2 ms 812 KB Output is correct
31 Correct 5 ms 2216 KB Output is correct
32 Correct 5 ms 2144 KB Output is correct
33 Correct 6 ms 2252 KB Output is correct
34 Correct 5 ms 2156 KB Output is correct
35 Correct 8 ms 2280 KB Output is correct
36 Correct 6 ms 2344 KB Output is correct
37 Correct 9 ms 2956 KB Output is correct
38 Correct 9 ms 2756 KB Output is correct
39 Correct 7 ms 2240 KB Output is correct
40 Correct 6 ms 2220 KB Output is correct
41 Correct 6 ms 2480 KB Output is correct
42 Correct 8 ms 2868 KB Output is correct
43 Correct 7 ms 2388 KB Output is correct
44 Correct 7 ms 2424 KB Output is correct
45 Correct 3 ms 860 KB Output is correct
46 Correct 7 ms 2516 KB Output is correct
47 Correct 6 ms 2312 KB Output is correct
48 Correct 9 ms 2716 KB Output is correct
49 Correct 7 ms 2296 KB Output is correct
50 Correct 6 ms 2204 KB Output is correct
51 Correct 9 ms 2588 KB Output is correct
52 Correct 6 ms 2180 KB Output is correct
53 Correct 7 ms 2328 KB Output is correct
54 Correct 8 ms 2752 KB Output is correct
55 Correct 6 ms 2324 KB Output is correct
56 Correct 5 ms 2324 KB Output is correct
57 Correct 6 ms 2324 KB Output is correct
58 Correct 5 ms 2324 KB Output is correct
59 Correct 61 ms 16500 KB Output is correct
60 Correct 61 ms 16492 KB Output is correct
61 Correct 61 ms 16592 KB Output is correct
62 Correct 62 ms 16588 KB Output is correct
63 Correct 60 ms 16588 KB Output is correct
64 Correct 60 ms 16644 KB Output is correct
65 Correct 52 ms 25032 KB Output is correct
66 Correct 339 ms 41228 KB Output is correct
67 Correct 121 ms 34132 KB Output is correct
68 Correct 467 ms 45384 KB Output is correct
69 Correct 590 ms 45044 KB Output is correct
70 Correct 392 ms 41720 KB Output is correct
71 Correct 58 ms 27592 KB Output is correct
72 Correct 1244 ms 241272 KB Output is correct
73 Correct 78 ms 30200 KB Output is correct
74 Correct 235 ms 42296 KB Output is correct
75 Correct 898 ms 190340 KB Output is correct
76 Correct 260 ms 43288 KB Output is correct
77 Correct 66 ms 27844 KB Output is correct
78 Correct 1359 ms 253920 KB Output is correct
79 Correct 72 ms 32196 KB Output is correct
80 Correct 164 ms 32796 KB Output is correct
81 Correct 1217 ms 230804 KB Output is correct
82 Correct 196 ms 43064 KB Output is correct
83 Correct 264 ms 40400 KB Output is correct
84 Correct 342 ms 42872 KB Output is correct
85 Correct 436 ms 45444 KB Output is correct
86 Correct 150 ms 32596 KB Output is correct
87 Correct 471 ms 46872 KB Output is correct
88 Correct 252 ms 43380 KB Output is correct
89 Correct 1049 ms 209720 KB Output is correct
90 Correct 1241 ms 242196 KB Output is correct
91 Correct 1000 ms 213796 KB Output is correct
92 Correct 1343 ms 255148 KB Output is correct
93 Correct 1169 ms 227076 KB Output is correct
94 Correct 1313 ms 238076 KB Output is correct
95 Correct 1245 ms 241104 KB Output is correct
96 Correct 1134 ms 222028 KB Output is correct
97 Correct 1220 ms 233536 KB Output is correct
98 Correct 1160 ms 235128 KB Output is correct
99 Correct 1002 ms 195432 KB Output is correct
100 Correct 1345 ms 250652 KB Output is correct
101 Correct 1299 ms 233160 KB Output is correct
102 Correct 856 ms 183604 KB Output is correct
103 Correct 1435 ms 242940 KB Output is correct
104 Correct 982 ms 199276 KB Output is correct
105 Correct 1407 ms 244424 KB Output is correct
106 Correct 1282 ms 242108 KB Output is correct
107 Correct 1129 ms 208740 KB Output is correct
108 Correct 1345 ms 260148 KB Output is correct
109 Correct 1312 ms 246492 KB Output is correct
110 Correct 1298 ms 237544 KB Output is correct
111 Correct 1203 ms 225672 KB Output is correct
112 Correct 1365 ms 264420 KB Output is correct
113 Correct 954 ms 201428 KB Output is correct
114 Correct 956 ms 204020 KB Output is correct
115 Correct 961 ms 201020 KB Output is correct
116 Correct 959 ms 200712 KB Output is correct
117 Correct 920 ms 134316 KB Output is correct
118 Correct 890 ms 131828 KB Output is correct
119 Correct 888 ms 131380 KB Output is correct
120 Correct 866 ms 133288 KB Output is correct
121 Correct 897 ms 134376 KB Output is correct
122 Correct 898 ms 133392 KB Output is correct
123 Correct 890 ms 134692 KB Output is correct
124 Correct 882 ms 132580 KB Output is correct
125 Correct 914 ms 133092 KB Output is correct
126 Correct 897 ms 134384 KB Output is correct