답안 #573878

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
573878 2022-06-07T11:16:05 Z somethingnew 화성 (APIO22_mars) C++17
100 / 100
1275 ms 4784 KB
#include "mars.h"
#include <iostream>
#include "vector"
#include "algorithm"
#include "numeric"
#include "climits"
#include "iomanip"
#include "bitset"
#include "cmath"
#include "map"
#include "deque"
#include "array"
#include "set"
#define all(x) x.begin(), x.end()
using namespace std;
pair<string, string> topairstr(vector<int> nums, string line) {
    string opn(line.size(), '0'), cls(line.size(), '0');
    int ind = 0;
    map<int, int> lstps;
    for (int i = 0; i < nums.size(); ++i) {
        //cout << nums[i] << ' ';
        if (line[i] == '1' and (i == 0 or line[i-1] != '1')) {
            if (lstps.find(nums[i]) != lstps.end()) {
                cls[ind] = '1';
                opn[lstps[nums[i]]] = '1';
            }
            lstps[nums[i]] = ind;
            ind++;
        }
    }
    //cout << endl;
    //cout << opn << endl << cls << endl << line << ' ' << "AMOG" << endl;
    return {opn, cls};
}
vector<int> tovec(pair<string, string> ss, string line) {
    auto [opn, cls] = ss;
    vector<int> a(line.size());
    vector<int> stk;
    int nm = 0;
    int ind = 0;
    for (int i = 0; i < line.size(); ++i) {
        if (line[i] == '1' and (i == 0 or line[i-1] != '1')) {
            int thisnum;
            if (cls[ind] == '1') {
                thisnum = stk.back();
                stk.pop_back();
            } else {
                thisnum = nm++;
            }
            a[i] = thisnum;
            if (opn[ind] == '1')
                stk.push_back(thisnum);
            ind++;
        } else if (line[i] == '1') {
            a[i] = a[i - 1];
        }
    }
    return a;
}
int getnuminstr(string a) {
    int res = 0;
    for (int i = 90; i < 100; ++i) {
        res += (a[i] == '1') << (i - 90);
    }
    return res;
}
void chnuminstr(string &a, int res) {
    for (int i = 90; i < 100; ++i) {
        if (res & (1 << (i - 90)))
            a[i] = '1';
        else
            a[i] = '0';
    }
}
string get1str(string a) {
    string b;
    for (int i = 1; i < 45; ++i) {
        b += a[i];
    }
    return b;
}
string get2str(string a) {
    string b;
    for (int i = 45; i < 90; ++i) {
        b += a[i];
    }
    return b;
}

void ch1str(string &a, string b) {
    for (int i = 1; i < 45; ++i) {
        if (b.size() <= i - 1)
            continue;
        a[i] = b[i-1];
    }
}
void ch2str(string &a, string b) {
    for (int i = 45; i < 90; ++i) {
        if (b.size() <= i - 45)
            continue;
        a[i] = b[i-45];
    }
}
struct snm{
    vector<int> p;
    int cnt;
    void init(int n) {
        cnt = n;
        p.assign(n, {});
        for (int i = 0; i < n; ++i) {
            p[i] = i;
        }
    }
    int getv(int v) {
        if (p[v] == v)
            return v;
        return p[v] = getv(p[v]);
    }
    void merge(int a, int b) {
        a = getv(a);b = getv(b);
        if (a != b) {
            cnt--;
            p[a] = b;
        }
    }
};
string resstring(string a) {
    string s(100, '0');
    for (int i = 90; i < 100; ++i) {
        s[i-90] = a[i];
    }
    return s;
}
string solvepole(int n, vector<vector<string>> a, int iszero) {
    vector<vector<int>> pole(n, vector<int>(n)), pole2(n, vector<int>(n, -1));
    for (int i = 0; i < 3; ++i) {
        for (int j = 0; j < 3; ++j) {
            pole[i][j] = a[i][j][0] - '0';
        }
    }
    string si0 = get1str(a[2][0]);
    string si1 = get1str(a[2][1]);
    string si2 = get2str(a[2][1]);
    string s0j = get1str(a[0][2]);
    string s1j = get1str(a[1][2]);
    string s2j = get2str(a[1][2]);
    for (int i = 3; i < n; ++i) {
        int pstr = n - 1 - i;
        pole[i][0] = si0[pstr] - '0';
        pole[i][1] = si1[pstr] - '0';
        pole[i][2] = si2[pstr] - '0';
        pole[0][i] = s0j[pstr] - '0';
        pole[1][i] = s1j[pstr] - '0';
        pole[2][i] = s2j[pstr] - '0';
    }

    //cout << a[2][2] << endl;
    string opn = get1str(a[2][2]), cls = get2str(a[2][2]);
    string zeroone;
    for (int i = n - 1; i >= 2; --i) {
        zeroone.push_back(pole[i][2] + '0');
    }
    for (int j = 3; j < n; ++j) {
        zeroone.push_back(pole[2][j] + '0');
    }
    //cout << opn << endl;
    //cout << cls << endl;
    //cout << zeroone << endl;
    vector<int> nums = tovec({opn, cls}, zeroone);
    snm sm;
    int res = getnuminstr(a[2][2]);
    //cout << res << endl;
    int sled = 0;
    //cout << "NUMS ";
    //for (auto i : nums)
    //    cout << i << ' ';
    //cout << endl;
    for (int i = 0; i < zeroone.size(); ++i) {
        if (zeroone[i] == '1')
            sled = max(sled, nums[i] + 1);
    }
    reverse(all(nums));
    for (int i = n - 1; i >= 2; --i) {
        if (pole[i][2] == 1) {
            pole2[i][2] = nums.back();
        }
        nums.pop_back();
    }
    for (int j = 3; j < n; ++j) {
        if (pole[2][j] == 1) {
            pole2[2][j] = nums.back();
        }
        nums.pop_back();
    }
    for (int i = 0; i < n; ++i) {
        for (int j = 0; j < n; ++j) {
            if (pole[i][j] == 1) {
                if (pole2[i][j] == -1) {
                    pole2[i][j] = sled++;
                }
            }
        }
    }
    snm dsu;
    dsu.init(sled);
    for (int i = 0; i < n; ++i) {
        for (int j = 0; j < n; ++j) {
            if (pole[i][j] == 1) {
                if (i+1 != n and pole[i+1][j] == 1) {
                    dsu.merge(pole2[i][j], pole2[i+1][j]);
                }
                if (j+1 != n and pole[i][j+1] == 1) {
                    dsu.merge(pole2[i][j], pole2[i][j+1]);
                }
            }
        }
    }
    res += dsu.cnt;
    set<int> kr;
    for (int i = 0; i < n; ++i) {
        for (int j = 0; j < n; ++j) {
            if (pole[i][j]) {
                pole2[i][j] = dsu.getv(pole2[i][j]);
                if (i == 0 or j == 0)
                    kr.insert(pole2[i][j]);
            }
        }
    }
    if (!iszero)
        res -= kr.size();
    chnuminstr(a[0][0], res);
    zeroone.clear();
    nums.clear();
    for (int i = n - 1; i >= 0; --i) {
        zeroone.push_back(pole[i][0] + '0');
        nums.push_back(pole2[i][0]);
    }
    for (int j = 1; j < n; ++j) {
        zeroone.push_back(pole[0][j] + '0');
        nums.push_back(pole2[0][j]);
    }

    if (iszero)
        return resstring(a[0][0]);
    auto [opn2, cls2] = topairstr(nums, zeroone);
    ch1str(a[0][0], opn2);
    ch2str(a[0][0], cls2);
    return a[0][0];
}
string process(vector <vector<string>> a, int i, int j, int k, int n) {
    if (((n - k - 1) * 2 + 1 > i and (n - k - 2) * 2 + 1 < i) or ((n - k - 1) * 2 + 1 > j and (n - k - 2) * 2 + 1 < j)) {
        //cerr << i << ' ' << j << ' ' << k << endl;
        if (i == j) {
            string s = solvepole(2 * n + 1 - i, a, i == 0);
            return s;
        }
        if (i < j) {
            string s1 = get1str(a[0][2]);
            string s2 = get2str(a[0][2]);
            s1[2*(n-1)-j] = a[0][2][0];
            s1[2*(n-1)-j+1] = a[0][1][0];
            s2[2*(n-1)-j] = a[1][2][0];
            s2[2*(n-1)-j+1] = a[1][1][0];
            ch1str(a[0][0], s1);
            ch2str(a[0][0], s2);
        } else {
            string s1 = get1str(a[2][0]);
            string s2 = get2str(a[2][0]);
            s1[2*(n-1)-i] = a[2][0][0];
            s1[2*(n-1)-i+1] = a[1][0][0];
            s2[2*(n-1)-i] = a[2][1][0];
            s2[2*(n-1)-i+1] = a[1][1][0];
            ch1str(a[0][0], s1);
            ch2str(a[0][0], s2);
        }
        return a[0][0];
    } else {
        return a[0][0];
    }
}

Compilation message

mars.cpp: In function 'std::pair<std::__cxx11::basic_string<char>, std::__cxx11::basic_string<char> > topairstr(std::vector<int>, std::string)':
mars.cpp:20:23: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   20 |     for (int i = 0; i < nums.size(); ++i) {
      |                     ~~^~~~~~~~~~~~~
mars.cpp: In function 'std::vector<int> tovec(std::pair<std::__cxx11::basic_string<char>, std::__cxx11::basic_string<char> >, std::string)':
mars.cpp:41:23: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   41 |     for (int i = 0; i < line.size(); ++i) {
      |                     ~~^~~~~~~~~~~~~
mars.cpp: In function 'void ch1str(std::string&, std::string)':
mars.cpp:92:22: warning: comparison of integer expressions of different signedness: 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} and 'int' [-Wsign-compare]
   92 |         if (b.size() <= i - 1)
      |             ~~~~~~~~~^~~~~~~~
mars.cpp: In function 'void ch2str(std::string&, std::string)':
mars.cpp:99:22: warning: comparison of integer expressions of different signedness: 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} and 'int' [-Wsign-compare]
   99 |         if (b.size() <= i - 45)
      |             ~~~~~~~~~^~~~~~~~~
mars.cpp: In function 'std::string solvepole(int, std::vector<std::vector<std::__cxx11::basic_string<char> > >, int)':
mars.cpp:178:23: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
  178 |     for (int i = 0; i < zeroone.size(); ++i) {
      |                     ~~^~~~~~~~~~~~~~~~
# 결과 실행 시간 메모리 Grader output
1 Correct 9 ms 1704 KB Output is correct
2 Correct 8 ms 2276 KB Output is correct
3 Correct 8 ms 2044 KB Output is correct
4 Correct 8 ms 2156 KB Output is correct
5 Correct 8 ms 2056 KB Output is correct
6 Correct 8 ms 1988 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 9 ms 1704 KB Output is correct
2 Correct 8 ms 2276 KB Output is correct
3 Correct 8 ms 2044 KB Output is correct
4 Correct 8 ms 2156 KB Output is correct
5 Correct 8 ms 2056 KB Output is correct
6 Correct 8 ms 1988 KB Output is correct
7 Correct 14 ms 2016 KB Output is correct
8 Correct 16 ms 2092 KB Output is correct
9 Correct 18 ms 1968 KB Output is correct
10 Correct 17 ms 2032 KB Output is correct
11 Correct 16 ms 2144 KB Output is correct
12 Correct 16 ms 1968 KB Output is correct
13 Correct 18 ms 2340 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 9 ms 1704 KB Output is correct
2 Correct 8 ms 2276 KB Output is correct
3 Correct 8 ms 2044 KB Output is correct
4 Correct 8 ms 2156 KB Output is correct
5 Correct 8 ms 2056 KB Output is correct
6 Correct 8 ms 1988 KB Output is correct
7 Correct 14 ms 2016 KB Output is correct
8 Correct 16 ms 2092 KB Output is correct
9 Correct 18 ms 1968 KB Output is correct
10 Correct 17 ms 2032 KB Output is correct
11 Correct 16 ms 2144 KB Output is correct
12 Correct 16 ms 1968 KB Output is correct
13 Correct 18 ms 2340 KB Output is correct
14 Correct 28 ms 2468 KB Output is correct
15 Correct 41 ms 2476 KB Output is correct
16 Correct 40 ms 2524 KB Output is correct
17 Correct 44 ms 2572 KB Output is correct
18 Correct 41 ms 2464 KB Output is correct
19 Correct 45 ms 2616 KB Output is correct
20 Correct 41 ms 2540 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 9 ms 1704 KB Output is correct
2 Correct 8 ms 2276 KB Output is correct
3 Correct 8 ms 2044 KB Output is correct
4 Correct 8 ms 2156 KB Output is correct
5 Correct 8 ms 2056 KB Output is correct
6 Correct 8 ms 1988 KB Output is correct
7 Correct 14 ms 2016 KB Output is correct
8 Correct 16 ms 2092 KB Output is correct
9 Correct 18 ms 1968 KB Output is correct
10 Correct 17 ms 2032 KB Output is correct
11 Correct 16 ms 2144 KB Output is correct
12 Correct 16 ms 1968 KB Output is correct
13 Correct 18 ms 2340 KB Output is correct
14 Correct 28 ms 2468 KB Output is correct
15 Correct 41 ms 2476 KB Output is correct
16 Correct 40 ms 2524 KB Output is correct
17 Correct 44 ms 2572 KB Output is correct
18 Correct 41 ms 2464 KB Output is correct
19 Correct 45 ms 2616 KB Output is correct
20 Correct 41 ms 2540 KB Output is correct
21 Correct 66 ms 2568 KB Output is correct
22 Correct 85 ms 2664 KB Output is correct
23 Correct 85 ms 2680 KB Output is correct
24 Correct 84 ms 2636 KB Output is correct
25 Correct 88 ms 2668 KB Output is correct
26 Correct 83 ms 2564 KB Output is correct
27 Correct 84 ms 2680 KB Output is correct
28 Correct 94 ms 2668 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 9 ms 1704 KB Output is correct
2 Correct 8 ms 2276 KB Output is correct
3 Correct 8 ms 2044 KB Output is correct
4 Correct 8 ms 2156 KB Output is correct
5 Correct 8 ms 2056 KB Output is correct
6 Correct 8 ms 1988 KB Output is correct
7 Correct 14 ms 2016 KB Output is correct
8 Correct 16 ms 2092 KB Output is correct
9 Correct 18 ms 1968 KB Output is correct
10 Correct 17 ms 2032 KB Output is correct
11 Correct 16 ms 2144 KB Output is correct
12 Correct 16 ms 1968 KB Output is correct
13 Correct 18 ms 2340 KB Output is correct
14 Correct 28 ms 2468 KB Output is correct
15 Correct 41 ms 2476 KB Output is correct
16 Correct 40 ms 2524 KB Output is correct
17 Correct 44 ms 2572 KB Output is correct
18 Correct 41 ms 2464 KB Output is correct
19 Correct 45 ms 2616 KB Output is correct
20 Correct 41 ms 2540 KB Output is correct
21 Correct 66 ms 2568 KB Output is correct
22 Correct 85 ms 2664 KB Output is correct
23 Correct 85 ms 2680 KB Output is correct
24 Correct 84 ms 2636 KB Output is correct
25 Correct 88 ms 2668 KB Output is correct
26 Correct 83 ms 2564 KB Output is correct
27 Correct 84 ms 2680 KB Output is correct
28 Correct 94 ms 2668 KB Output is correct
29 Correct 118 ms 2756 KB Output is correct
30 Correct 163 ms 2800 KB Output is correct
31 Correct 170 ms 2824 KB Output is correct
32 Correct 156 ms 2836 KB Output is correct
33 Correct 163 ms 2836 KB Output is correct
34 Correct 167 ms 2924 KB Output is correct
35 Correct 158 ms 2964 KB Output is correct
36 Correct 154 ms 2832 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 9 ms 1704 KB Output is correct
2 Correct 8 ms 2276 KB Output is correct
3 Correct 8 ms 2044 KB Output is correct
4 Correct 8 ms 2156 KB Output is correct
5 Correct 8 ms 2056 KB Output is correct
6 Correct 8 ms 1988 KB Output is correct
7 Correct 14 ms 2016 KB Output is correct
8 Correct 16 ms 2092 KB Output is correct
9 Correct 18 ms 1968 KB Output is correct
10 Correct 17 ms 2032 KB Output is correct
11 Correct 16 ms 2144 KB Output is correct
12 Correct 16 ms 1968 KB Output is correct
13 Correct 18 ms 2340 KB Output is correct
14 Correct 28 ms 2468 KB Output is correct
15 Correct 41 ms 2476 KB Output is correct
16 Correct 40 ms 2524 KB Output is correct
17 Correct 44 ms 2572 KB Output is correct
18 Correct 41 ms 2464 KB Output is correct
19 Correct 45 ms 2616 KB Output is correct
20 Correct 41 ms 2540 KB Output is correct
21 Correct 66 ms 2568 KB Output is correct
22 Correct 85 ms 2664 KB Output is correct
23 Correct 85 ms 2680 KB Output is correct
24 Correct 84 ms 2636 KB Output is correct
25 Correct 88 ms 2668 KB Output is correct
26 Correct 83 ms 2564 KB Output is correct
27 Correct 84 ms 2680 KB Output is correct
28 Correct 94 ms 2668 KB Output is correct
29 Correct 118 ms 2756 KB Output is correct
30 Correct 163 ms 2800 KB Output is correct
31 Correct 170 ms 2824 KB Output is correct
32 Correct 156 ms 2836 KB Output is correct
33 Correct 163 ms 2836 KB Output is correct
34 Correct 167 ms 2924 KB Output is correct
35 Correct 158 ms 2964 KB Output is correct
36 Correct 154 ms 2832 KB Output is correct
37 Correct 220 ms 3212 KB Output is correct
38 Correct 263 ms 3472 KB Output is correct
39 Correct 290 ms 3220 KB Output is correct
40 Correct 269 ms 3220 KB Output is correct
41 Correct 289 ms 3216 KB Output is correct
42 Correct 266 ms 3232 KB Output is correct
43 Correct 273 ms 3212 KB Output is correct
44 Correct 293 ms 3324 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 9 ms 1704 KB Output is correct
2 Correct 8 ms 2276 KB Output is correct
3 Correct 8 ms 2044 KB Output is correct
4 Correct 8 ms 2156 KB Output is correct
5 Correct 8 ms 2056 KB Output is correct
6 Correct 8 ms 1988 KB Output is correct
7 Correct 14 ms 2016 KB Output is correct
8 Correct 16 ms 2092 KB Output is correct
9 Correct 18 ms 1968 KB Output is correct
10 Correct 17 ms 2032 KB Output is correct
11 Correct 16 ms 2144 KB Output is correct
12 Correct 16 ms 1968 KB Output is correct
13 Correct 18 ms 2340 KB Output is correct
14 Correct 28 ms 2468 KB Output is correct
15 Correct 41 ms 2476 KB Output is correct
16 Correct 40 ms 2524 KB Output is correct
17 Correct 44 ms 2572 KB Output is correct
18 Correct 41 ms 2464 KB Output is correct
19 Correct 45 ms 2616 KB Output is correct
20 Correct 41 ms 2540 KB Output is correct
21 Correct 66 ms 2568 KB Output is correct
22 Correct 85 ms 2664 KB Output is correct
23 Correct 85 ms 2680 KB Output is correct
24 Correct 84 ms 2636 KB Output is correct
25 Correct 88 ms 2668 KB Output is correct
26 Correct 83 ms 2564 KB Output is correct
27 Correct 84 ms 2680 KB Output is correct
28 Correct 94 ms 2668 KB Output is correct
29 Correct 118 ms 2756 KB Output is correct
30 Correct 163 ms 2800 KB Output is correct
31 Correct 170 ms 2824 KB Output is correct
32 Correct 156 ms 2836 KB Output is correct
33 Correct 163 ms 2836 KB Output is correct
34 Correct 167 ms 2924 KB Output is correct
35 Correct 158 ms 2964 KB Output is correct
36 Correct 154 ms 2832 KB Output is correct
37 Correct 220 ms 3212 KB Output is correct
38 Correct 263 ms 3472 KB Output is correct
39 Correct 290 ms 3220 KB Output is correct
40 Correct 269 ms 3220 KB Output is correct
41 Correct 289 ms 3216 KB Output is correct
42 Correct 266 ms 3232 KB Output is correct
43 Correct 273 ms 3212 KB Output is correct
44 Correct 293 ms 3324 KB Output is correct
45 Correct 343 ms 3236 KB Output is correct
46 Correct 446 ms 3488 KB Output is correct
47 Correct 438 ms 3520 KB Output is correct
48 Correct 447 ms 3400 KB Output is correct
49 Correct 425 ms 3596 KB Output is correct
50 Correct 445 ms 3344 KB Output is correct
51 Correct 452 ms 3484 KB Output is correct
52 Correct 437 ms 3524 KB Output is correct
53 Correct 418 ms 3352 KB Output is correct
54 Correct 445 ms 3380 KB Output is correct
55 Correct 428 ms 3488 KB Output is correct
56 Correct 429 ms 3480 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 9 ms 1704 KB Output is correct
2 Correct 8 ms 2276 KB Output is correct
3 Correct 8 ms 2044 KB Output is correct
4 Correct 8 ms 2156 KB Output is correct
5 Correct 8 ms 2056 KB Output is correct
6 Correct 8 ms 1988 KB Output is correct
7 Correct 14 ms 2016 KB Output is correct
8 Correct 16 ms 2092 KB Output is correct
9 Correct 18 ms 1968 KB Output is correct
10 Correct 17 ms 2032 KB Output is correct
11 Correct 16 ms 2144 KB Output is correct
12 Correct 16 ms 1968 KB Output is correct
13 Correct 18 ms 2340 KB Output is correct
14 Correct 28 ms 2468 KB Output is correct
15 Correct 41 ms 2476 KB Output is correct
16 Correct 40 ms 2524 KB Output is correct
17 Correct 44 ms 2572 KB Output is correct
18 Correct 41 ms 2464 KB Output is correct
19 Correct 45 ms 2616 KB Output is correct
20 Correct 41 ms 2540 KB Output is correct
21 Correct 66 ms 2568 KB Output is correct
22 Correct 85 ms 2664 KB Output is correct
23 Correct 85 ms 2680 KB Output is correct
24 Correct 84 ms 2636 KB Output is correct
25 Correct 88 ms 2668 KB Output is correct
26 Correct 83 ms 2564 KB Output is correct
27 Correct 84 ms 2680 KB Output is correct
28 Correct 94 ms 2668 KB Output is correct
29 Correct 118 ms 2756 KB Output is correct
30 Correct 163 ms 2800 KB Output is correct
31 Correct 170 ms 2824 KB Output is correct
32 Correct 156 ms 2836 KB Output is correct
33 Correct 163 ms 2836 KB Output is correct
34 Correct 167 ms 2924 KB Output is correct
35 Correct 158 ms 2964 KB Output is correct
36 Correct 154 ms 2832 KB Output is correct
37 Correct 220 ms 3212 KB Output is correct
38 Correct 263 ms 3472 KB Output is correct
39 Correct 290 ms 3220 KB Output is correct
40 Correct 269 ms 3220 KB Output is correct
41 Correct 289 ms 3216 KB Output is correct
42 Correct 266 ms 3232 KB Output is correct
43 Correct 273 ms 3212 KB Output is correct
44 Correct 293 ms 3324 KB Output is correct
45 Correct 343 ms 3236 KB Output is correct
46 Correct 446 ms 3488 KB Output is correct
47 Correct 438 ms 3520 KB Output is correct
48 Correct 447 ms 3400 KB Output is correct
49 Correct 425 ms 3596 KB Output is correct
50 Correct 445 ms 3344 KB Output is correct
51 Correct 452 ms 3484 KB Output is correct
52 Correct 437 ms 3524 KB Output is correct
53 Correct 418 ms 3352 KB Output is correct
54 Correct 445 ms 3380 KB Output is correct
55 Correct 428 ms 3488 KB Output is correct
56 Correct 429 ms 3480 KB Output is correct
57 Correct 534 ms 3880 KB Output is correct
58 Correct 656 ms 4104 KB Output is correct
59 Correct 665 ms 4036 KB Output is correct
60 Correct 650 ms 3992 KB Output is correct
61 Correct 637 ms 3944 KB Output is correct
62 Correct 634 ms 4200 KB Output is correct
63 Correct 657 ms 3964 KB Output is correct
64 Correct 663 ms 3912 KB Output is correct
65 Correct 669 ms 4076 KB Output is correct
66 Correct 632 ms 4084 KB Output is correct
67 Correct 641 ms 4280 KB Output is correct
68 Correct 661 ms 4088 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 9 ms 1704 KB Output is correct
2 Correct 8 ms 2276 KB Output is correct
3 Correct 8 ms 2044 KB Output is correct
4 Correct 8 ms 2156 KB Output is correct
5 Correct 8 ms 2056 KB Output is correct
6 Correct 8 ms 1988 KB Output is correct
7 Correct 14 ms 2016 KB Output is correct
8 Correct 16 ms 2092 KB Output is correct
9 Correct 18 ms 1968 KB Output is correct
10 Correct 17 ms 2032 KB Output is correct
11 Correct 16 ms 2144 KB Output is correct
12 Correct 16 ms 1968 KB Output is correct
13 Correct 18 ms 2340 KB Output is correct
14 Correct 28 ms 2468 KB Output is correct
15 Correct 41 ms 2476 KB Output is correct
16 Correct 40 ms 2524 KB Output is correct
17 Correct 44 ms 2572 KB Output is correct
18 Correct 41 ms 2464 KB Output is correct
19 Correct 45 ms 2616 KB Output is correct
20 Correct 41 ms 2540 KB Output is correct
21 Correct 66 ms 2568 KB Output is correct
22 Correct 85 ms 2664 KB Output is correct
23 Correct 85 ms 2680 KB Output is correct
24 Correct 84 ms 2636 KB Output is correct
25 Correct 88 ms 2668 KB Output is correct
26 Correct 83 ms 2564 KB Output is correct
27 Correct 84 ms 2680 KB Output is correct
28 Correct 94 ms 2668 KB Output is correct
29 Correct 118 ms 2756 KB Output is correct
30 Correct 163 ms 2800 KB Output is correct
31 Correct 170 ms 2824 KB Output is correct
32 Correct 156 ms 2836 KB Output is correct
33 Correct 163 ms 2836 KB Output is correct
34 Correct 167 ms 2924 KB Output is correct
35 Correct 158 ms 2964 KB Output is correct
36 Correct 154 ms 2832 KB Output is correct
37 Correct 220 ms 3212 KB Output is correct
38 Correct 263 ms 3472 KB Output is correct
39 Correct 290 ms 3220 KB Output is correct
40 Correct 269 ms 3220 KB Output is correct
41 Correct 289 ms 3216 KB Output is correct
42 Correct 266 ms 3232 KB Output is correct
43 Correct 273 ms 3212 KB Output is correct
44 Correct 293 ms 3324 KB Output is correct
45 Correct 343 ms 3236 KB Output is correct
46 Correct 446 ms 3488 KB Output is correct
47 Correct 438 ms 3520 KB Output is correct
48 Correct 447 ms 3400 KB Output is correct
49 Correct 425 ms 3596 KB Output is correct
50 Correct 445 ms 3344 KB Output is correct
51 Correct 452 ms 3484 KB Output is correct
52 Correct 437 ms 3524 KB Output is correct
53 Correct 418 ms 3352 KB Output is correct
54 Correct 445 ms 3380 KB Output is correct
55 Correct 428 ms 3488 KB Output is correct
56 Correct 429 ms 3480 KB Output is correct
57 Correct 534 ms 3880 KB Output is correct
58 Correct 656 ms 4104 KB Output is correct
59 Correct 665 ms 4036 KB Output is correct
60 Correct 650 ms 3992 KB Output is correct
61 Correct 637 ms 3944 KB Output is correct
62 Correct 634 ms 4200 KB Output is correct
63 Correct 657 ms 3964 KB Output is correct
64 Correct 663 ms 3912 KB Output is correct
65 Correct 669 ms 4076 KB Output is correct
66 Correct 632 ms 4084 KB Output is correct
67 Correct 641 ms 4280 KB Output is correct
68 Correct 661 ms 4088 KB Output is correct
69 Correct 764 ms 4148 KB Output is correct
70 Correct 914 ms 4264 KB Output is correct
71 Correct 944 ms 4364 KB Output is correct
72 Correct 924 ms 4272 KB Output is correct
73 Correct 929 ms 4332 KB Output is correct
74 Correct 930 ms 4188 KB Output is correct
75 Correct 941 ms 4384 KB Output is correct
76 Correct 940 ms 4308 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 9 ms 1704 KB Output is correct
2 Correct 8 ms 2276 KB Output is correct
3 Correct 8 ms 2044 KB Output is correct
4 Correct 8 ms 2156 KB Output is correct
5 Correct 8 ms 2056 KB Output is correct
6 Correct 8 ms 1988 KB Output is correct
7 Correct 14 ms 2016 KB Output is correct
8 Correct 16 ms 2092 KB Output is correct
9 Correct 18 ms 1968 KB Output is correct
10 Correct 17 ms 2032 KB Output is correct
11 Correct 16 ms 2144 KB Output is correct
12 Correct 16 ms 1968 KB Output is correct
13 Correct 18 ms 2340 KB Output is correct
14 Correct 28 ms 2468 KB Output is correct
15 Correct 41 ms 2476 KB Output is correct
16 Correct 40 ms 2524 KB Output is correct
17 Correct 44 ms 2572 KB Output is correct
18 Correct 41 ms 2464 KB Output is correct
19 Correct 45 ms 2616 KB Output is correct
20 Correct 41 ms 2540 KB Output is correct
21 Correct 66 ms 2568 KB Output is correct
22 Correct 85 ms 2664 KB Output is correct
23 Correct 85 ms 2680 KB Output is correct
24 Correct 84 ms 2636 KB Output is correct
25 Correct 88 ms 2668 KB Output is correct
26 Correct 83 ms 2564 KB Output is correct
27 Correct 84 ms 2680 KB Output is correct
28 Correct 94 ms 2668 KB Output is correct
29 Correct 118 ms 2756 KB Output is correct
30 Correct 163 ms 2800 KB Output is correct
31 Correct 170 ms 2824 KB Output is correct
32 Correct 156 ms 2836 KB Output is correct
33 Correct 163 ms 2836 KB Output is correct
34 Correct 167 ms 2924 KB Output is correct
35 Correct 158 ms 2964 KB Output is correct
36 Correct 154 ms 2832 KB Output is correct
37 Correct 220 ms 3212 KB Output is correct
38 Correct 263 ms 3472 KB Output is correct
39 Correct 290 ms 3220 KB Output is correct
40 Correct 269 ms 3220 KB Output is correct
41 Correct 289 ms 3216 KB Output is correct
42 Correct 266 ms 3232 KB Output is correct
43 Correct 273 ms 3212 KB Output is correct
44 Correct 293 ms 3324 KB Output is correct
45 Correct 343 ms 3236 KB Output is correct
46 Correct 446 ms 3488 KB Output is correct
47 Correct 438 ms 3520 KB Output is correct
48 Correct 447 ms 3400 KB Output is correct
49 Correct 425 ms 3596 KB Output is correct
50 Correct 445 ms 3344 KB Output is correct
51 Correct 452 ms 3484 KB Output is correct
52 Correct 437 ms 3524 KB Output is correct
53 Correct 418 ms 3352 KB Output is correct
54 Correct 445 ms 3380 KB Output is correct
55 Correct 428 ms 3488 KB Output is correct
56 Correct 429 ms 3480 KB Output is correct
57 Correct 534 ms 3880 KB Output is correct
58 Correct 656 ms 4104 KB Output is correct
59 Correct 665 ms 4036 KB Output is correct
60 Correct 650 ms 3992 KB Output is correct
61 Correct 637 ms 3944 KB Output is correct
62 Correct 634 ms 4200 KB Output is correct
63 Correct 657 ms 3964 KB Output is correct
64 Correct 663 ms 3912 KB Output is correct
65 Correct 669 ms 4076 KB Output is correct
66 Correct 632 ms 4084 KB Output is correct
67 Correct 641 ms 4280 KB Output is correct
68 Correct 661 ms 4088 KB Output is correct
69 Correct 764 ms 4148 KB Output is correct
70 Correct 914 ms 4264 KB Output is correct
71 Correct 944 ms 4364 KB Output is correct
72 Correct 924 ms 4272 KB Output is correct
73 Correct 929 ms 4332 KB Output is correct
74 Correct 930 ms 4188 KB Output is correct
75 Correct 941 ms 4384 KB Output is correct
76 Correct 940 ms 4308 KB Output is correct
77 Correct 964 ms 4304 KB Output is correct
78 Correct 1258 ms 4712 KB Output is correct
79 Correct 1242 ms 4784 KB Output is correct
80 Correct 1245 ms 4636 KB Output is correct
81 Correct 1252 ms 4588 KB Output is correct
82 Correct 1269 ms 4656 KB Output is correct
83 Correct 1275 ms 4664 KB Output is correct
84 Correct 1264 ms 4604 KB Output is correct