# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
1049417 |
2024-08-08T18:13:38 Z |
Halit |
Rectangles (IOI19_rect) |
C++17 |
|
2652 ms |
1048576 KB |
#include "rect.h"
#include <bits/stdc++.h>
struct FenwickTree {
std::vector<int> bit;
int N;
FenwickTree(int n) {
N = n+1;
bit.resize(N+1);
}
int sum(int idx) {
int res = 0;
for (++idx; idx > 0; idx -= idx & -idx) {
res += bit[idx];
}
return res;
}
int get(int l, int r) {
return sum(r) - sum(l-1);
}
void add(int idx, int delta) {
for (++idx;idx < N; idx += idx & -idx) {
bit[idx] += delta;
}
}
};
struct SegmentTree {
int N;
std::vector<int> tree;
std::vector<int> lazy;
SegmentTree(int n) {
N = n;
tree.resize(4*N);
lazy.resize(4*N);
}
void push(int node, int left, int right) {
if (lazy[node]) {
tree[node] = 0;
}
if (left != right) {
lazy[node*2] |= lazy[node];
lazy[node*2+1] |= lazy[node];
}
lazy[node] = 0;
}
int get(int node, int left, int right, int tl, int tr) {
push(node, left, right);
if (left > tr || right < tl) {
return 0;
}
if (left >= tl && right <= tr) {
return tree[node];
}
return get(node*2, left, (left+right)/2, tl, tr) + get(node*2+1, (left+right)/2+1, right, tl, tr);
}
void add(int node, int left, int right, int idx) {
push(node, left, right);
if (left > idx || right < idx) {
return;
}
if (left == idx && right == idx) {
tree[node] += 1;
return;
}
add(node*2, left, (left+right)/2, idx);
add(node*2+1, (left+right)/2+1, right, idx);
tree[node] = tree[node*2] + tree[node*2+1];
}
void clear() {
lazy[1] = 1;
}
int get(int left, int right) {
return get(1, 0, N-1, left, right);
}
void add(int idx) {
add(1, 0, N-1, idx);
}
};
struct disjoint_sets {
int N;
std::vector<int> rank;
disjoint_sets(int n) {
N = n;
for (int i = 0;i < N; ++i) {
rank.push_back(i);
}
}
int get(int x) {
if (rank[x] == x) return x;
return rank[x] = get(rank[x]);
}
void merge(int x, int y) {
x = get(x);
y = get(y);
if (x == y) {
return;
}
rank[y] = rank[x];
}
void clear() {
for (int i = 0;i < N; ++i) {
rank[i] = i;
}
}
};
long long count_rectangles(std::vector<std::vector<int>> a) {
int N = a.size();
int M = a[0].size();
std::set<std::array<short, 3>> temp_valid_row, temp_valid_col;
{
std::vector<int> idx(M);
std::iota(idx.begin(), idx.end(), 0);
disjoint_sets left(M), right(M);
for (int i = 1;i < N-1; ++i) {
left.clear(); right.clear();
std::sort(idx.begin(), idx.end(), [&](int j, int k) { return a[i][j] < a[i][k]; });
int first = 0;
std::vector<bool> act(M);
for (int jj = 0;jj < M; ++jj) {
int j = idx[jj];
act[j] = true;
if (j > 0 && act[j-1]) {
left.merge(j-1, j);
right.merge(j, j-1);
}
if (j+1 < M && act[j+1]) {
right.merge(j+1, j);
left.merge(j, j+1);
}
if (jj+1 < M && a[i][idx[jj+1]] == a[i][j]) {
continue;
} else {
for (int k = first;k <= jj; ++k) {
if (left.get(idx[k]) > 0 && right.get(idx[k]) < M-1) {
temp_valid_row.insert({i, left.get(idx[k]), right.get(idx[k])});
}
}
first = jj+1;
}
}
}
}
/*
for (int val : num) {
for (int j : idx[val]) {
act[j] = true;
if (j > 0 && act[j-1]) {
left.merge(j-1, j);
right.merge(j, j-1);
}
if (j+1 < M && act[j+1]) {
right.merge(j+1, j);
left.merge(j, j+1);
}
}
for (int j : idx[val]) {
if (left.get(j) > 0 && right.get(j) < M-1) {
temp_valid_row.insert({i, left.get(j), right.get(j)});
}
}
}
*/
{
std::vector<int> idx(N);
std::iota(idx.begin(), idx.end(), 0);
disjoint_sets left(N), right(N);
for (int j = 1;j < M-1; ++j) {
left.clear(); right.clear();
std::sort(idx.begin(), idx.end(), [&](int i, int k) { return a[i][j] < a[k][j]; });
int first = 0;
std::vector<bool> act(N);
for (int imi = 0;imi < N; ++imi) {
int i = idx[imi];
act[i] = true;
if (i > 0 && act[i-1]) {
left.merge(i-1, i);
right.merge(i, i-1);
}
if (i+1 < N && act[i+1]) {
right.merge(i+1, i);
left.merge(i, i+1);
}
if (imi+1 < N && a[idx[imi+1]][j] == a[i][j]) {
continue;
} else {
for (int k = first;k <= imi; ++k) {
if (left.get(idx[k]) > 0 && right.get(idx[k]) < N-1) {
// std::cout << i+1 << ' ' << j+1 << ' ' << left.get(idx[k]) << ' ' << right.get(idx[k]) << std::endl;
temp_valid_col.insert({j, left.get(idx[k]), right.get(idx[k])});
}
}
first = imi+1;
}
}
}
}
/*
for (int j = 1;j < M-1; ++j) {
disjoint_sets up(N), down(N);
std::set<int> num;
std::map<int, std::vector<int>> idx;
for (int i = 0;i < N; ++i) {
num.insert(a[i][j]);
idx[a[i][j]].push_back(i);
}
std::vector<bool> act(N);
for (int val : num) {
for (int i : idx[val]) {
act[i] = true;
if (i > 0 && act[i-1]) {
up.merge(i-1, i);
down.merge(i, i-1);
}
if (i+1 < N && act[i+1]) {
down.merge(i+1, i);
up.merge(i, i+1);
}
}
for (int i : idx[val]) {
if (up.get(i) > 0 && down.get(i) < N-1) {
temp_valid_col.insert({j, up.get(i), down.get(i)});
}
}
}
}
*/
std::vector<std::array<short, 3>> valid_row(temp_valid_row.begin(), temp_valid_row.end());
std::vector<std::array<short, 3>> valid_col(temp_valid_col.begin(), temp_valid_col.end());
/*
std::cout << "Valid Rows" << std::endl;
for (auto [row, left, right] : valid_row) {
std::cout << row+1 << ' ' << left+1 << ' ' << right+1 << std::endl;
}
std::cout << "Valid Columns" << std::endl;
for (auto [col, up, down] : valid_col) {
std::cout << col+1 << ' ' << up+1 << ' ' << down+1 << std::endl;
}*/
std::reverse(valid_row.begin(), valid_row.end());
std::reverse(valid_col.begin(), valid_col.end());
std::vector<int> row_value(valid_row.size()), col_value(valid_col.size());
std::vector<std::vector<std::vector<std::vector<int>>>> start(2, std::vector<std::vector<std::vector<int>>>(std::max(N, M), std::vector<std::vector<int>>(std::max(N, M))));
{
std::vector<std::vector<int>> last(M+1, std::vector<int>(M+1, int(-1))), dp(M+1, std::vector<int>(M+1, int(0)));
for (int i = 0;i < valid_row.size(); ++i) {
auto [row, left, right] = valid_row[i];
row_value[i] = dp[left][right] = (last[left][right] != row+1 ? 1 : dp[left][right] + 1);
start[0][row][left].push_back(i);
last[left][right] = row;
// std::cout << row+1 << ' ' << left+1 << ' ' << right+1 << " -> row value " << row_value[i] << std::endl;
}
}
{
std::vector<std::vector<int>> last(N+1, std::vector<int>(N+1, int(-1))), dp(N+1, std::vector<int>(N+1, int(0)));
for (int i = 0;i < valid_col.size(); ++i) {
auto [col, up, down] = valid_col[i];
col_value[i] = dp[up][down] = (last[up][down] != col+1 ? 1 : dp[up][down] + 1);
start[1][up][col].push_back(i);
last[up][down] = col;
// std::cout << col+1 << ' ' << up+1 << ' ' << down+1 << " -> column value " << col_value[i] << std::endl;
}
}
int64_t ans = 0;
constexpr int MAX = 2500;
// SegmentTree st(MAX+1);
FenwickTree fenw(MAX);
for (int x = 1;x < N-1; ++x) {
for (int y = 1;y < M-1; ++y) {
// std::cout << "Current : " << x+1 << ' ' << y+1 << std::endl;
auto &row = start[0][x][y];
auto &col = start[1][x][y];
if (row.size() == 0 || col.size() == 0) {
continue;
}
std::vector<int> idx_row(row.size()), idx_col(col.size());
std::iota(idx_row.begin(), idx_row.end(), 0);
std::iota(idx_col.begin(), idx_col.end(), 0);
std::sort(idx_row.begin(), idx_row.end(), [&](int i, int j) { return row_value[row[i]] < row_value[row[j]]; });
std::sort(idx_col.begin(), idx_col.end(), [&](int i, int j) { return valid_col[col[i]][2] < valid_col[col[j]][2]; });
int j = -1;
int cnt = 0;
std::vector<int> rollback;
// std::cout << "#Rows : " << k_row << '\t' << "#Columns : " << k_col << std::endl;
for (int i : idx_row) {
// std::cout << "Current row : " << valid_row[start[0][x][y][i]][0]+1 << ' ' << valid_row[start[0][x][y][i]][1]+1 << ' ' << valid_row[start[0][x][y][i]][2]+1 << std::endl;
while (j+1 < col.size() && valid_col[col[idx_col[j+1]]][2] - valid_col[col[idx_col[j+1]]][1] + 1 <= row_value[row[i]]) {
j += 1;
// st.add(col_value[col[idx_col[j]]]);
fenw.add(col_value[col[idx_col[j]]], +1);
rollback.push_back(col_value[col[idx_col[j]]]);
// std::cout << j << "-th column to Segment Tree (value : " << col_value[j] << " )" << std::endl;
}
// cnt += st.get(valid_row[row[i]][2] - valid_row[row[i]][1] + 1, MAX);
cnt += fenw.get(valid_row[row[i]][2] - valid_row[row[i]][1] + 1, MAX);
}
ans += cnt;
for (int op : rollback) {
fenw.add(op, -1);
}
// st.clear();
}
}
/*
int ans = 0;
for (int i = 0;i < valid_row.size(); ++i) {
auto [row, left, right] = valid_row[i];
// std::cout << "Current row : " << row + 1 << ' ' << left + 1 << ' ' << right + 1 << std::endl;
for (int j : start[1][row][left]) {
// std::cout << "Testing..." << std::endl;
// std::cout << valid_col[j][0] + 1 << ' ' << valid_col[j][1] + 1 << ' ' << valid_col[j][2] + 1 << std::endl;
if (valid_col[j][2] - valid_col[j][1] + 1 <= row_value[i] && (right - left + 1 <= col_value[j])) {
ans += 1;
// std::cout << "OK!" << std::endl;
}
}
// std::cout << std::endl;
}*/
return ans;
}
Compilation message
rect.cpp: In function 'long long int count_rectangles(std::vector<std::vector<int> >)':
rect.cpp:137:38: warning: narrowing conversion of 'i' from 'int' to 'short int' [-Wnarrowing]
137 | temp_valid_row.insert({i, left.get(idx[k]), right.get(idx[k])});
| ^
rect.cpp:137:49: warning: narrowing conversion of 'left.disjoint_sets::get(idx.std::vector<int>::operator[](((std::vector<int>::size_type)k)))' from 'int' to 'short int' [-Wnarrowing]
137 | temp_valid_row.insert({i, left.get(idx[k]), right.get(idx[k])});
| ~~~~~~~~^~~~~~~~
rect.cpp:137:68: warning: narrowing conversion of 'right.disjoint_sets::get(idx.std::vector<int>::operator[](((std::vector<int>::size_type)k)))' from 'int' to 'short int' [-Wnarrowing]
137 | temp_valid_row.insert({i, left.get(idx[k]), right.get(idx[k])});
| ~~~~~~~~~^~~~~~~~
rect.cpp:191:38: warning: narrowing conversion of 'j' from 'int' to 'short int' [-Wnarrowing]
191 | temp_valid_col.insert({j, left.get(idx[k]), right.get(idx[k])});
| ^
rect.cpp:191:49: warning: narrowing conversion of 'left.disjoint_sets::get(idx.std::vector<int>::operator[](((std::vector<int>::size_type)k)))' from 'int' to 'short int' [-Wnarrowing]
191 | temp_valid_col.insert({j, left.get(idx[k]), right.get(idx[k])});
| ~~~~~~~~^~~~~~~~
rect.cpp:191:68: warning: narrowing conversion of 'right.disjoint_sets::get(idx.std::vector<int>::operator[](((std::vector<int>::size_type)k)))' from 'int' to 'short int' [-Wnarrowing]
191 | temp_valid_col.insert({j, left.get(idx[k]), right.get(idx[k])});
| ~~~~~~~~~^~~~~~~~
rect.cpp:246:22: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<std::array<short int, 3> >::size_type' {aka 'long unsigned int'} [-Wsign-compare]
246 | for (int i = 0;i < valid_row.size(); ++i) {
| ~~^~~~~~~~~~~~~~~~~~
rect.cpp:256:22: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<std::array<short int, 3> >::size_type' {aka 'long unsigned int'} [-Wsign-compare]
256 | for (int i = 0;i < valid_col.size(); ++i) {
| ~~^~~~~~~~~~~~~~~~~~
rect.cpp:287:20: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
287 | while (j+1 < col.size() && valid_col[col[idx_col[j+1]]][2] - valid_col[col[idx_col[j+1]]][1] + 1 <= row_value[row[i]]) {
| ~~~~^~~~~~~~~~~~
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
344 KB |
Output is correct |
2 |
Correct |
1 ms |
604 KB |
Output is correct |
3 |
Correct |
1 ms |
604 KB |
Output is correct |
4 |
Correct |
0 ms |
604 KB |
Output is correct |
5 |
Correct |
0 ms |
348 KB |
Output is correct |
6 |
Correct |
1 ms |
604 KB |
Output is correct |
7 |
Correct |
0 ms |
348 KB |
Output is correct |
8 |
Correct |
0 ms |
348 KB |
Output is correct |
9 |
Correct |
0 ms |
348 KB |
Output is correct |
10 |
Correct |
1 ms |
348 KB |
Output is correct |
11 |
Correct |
1 ms |
348 KB |
Output is correct |
12 |
Correct |
1 ms |
348 KB |
Output is correct |
13 |
Correct |
0 ms |
348 KB |
Output is correct |
14 |
Correct |
0 ms |
348 KB |
Output is correct |
15 |
Correct |
0 ms |
348 KB |
Output is correct |
16 |
Correct |
0 ms |
348 KB |
Output is correct |
17 |
Correct |
0 ms |
344 KB |
Output is correct |
18 |
Correct |
0 ms |
348 KB |
Output is correct |
19 |
Correct |
0 ms |
348 KB |
Output is correct |
20 |
Correct |
0 ms |
348 KB |
Output is correct |
21 |
Correct |
0 ms |
344 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
344 KB |
Output is correct |
2 |
Correct |
1 ms |
604 KB |
Output is correct |
3 |
Correct |
1 ms |
604 KB |
Output is correct |
4 |
Correct |
0 ms |
604 KB |
Output is correct |
5 |
Correct |
0 ms |
348 KB |
Output is correct |
6 |
Correct |
1 ms |
604 KB |
Output is correct |
7 |
Correct |
0 ms |
348 KB |
Output is correct |
8 |
Correct |
0 ms |
348 KB |
Output is correct |
9 |
Correct |
0 ms |
348 KB |
Output is correct |
10 |
Correct |
1 ms |
348 KB |
Output is correct |
11 |
Correct |
1 ms |
348 KB |
Output is correct |
12 |
Correct |
1 ms |
348 KB |
Output is correct |
13 |
Correct |
0 ms |
348 KB |
Output is correct |
14 |
Correct |
0 ms |
348 KB |
Output is correct |
15 |
Correct |
0 ms |
348 KB |
Output is correct |
16 |
Correct |
0 ms |
348 KB |
Output is correct |
17 |
Correct |
0 ms |
344 KB |
Output is correct |
18 |
Correct |
0 ms |
348 KB |
Output is correct |
19 |
Correct |
0 ms |
348 KB |
Output is correct |
20 |
Correct |
0 ms |
348 KB |
Output is correct |
21 |
Correct |
0 ms |
344 KB |
Output is correct |
22 |
Correct |
3 ms |
1884 KB |
Output is correct |
23 |
Correct |
3 ms |
1884 KB |
Output is correct |
24 |
Correct |
3 ms |
1908 KB |
Output is correct |
25 |
Correct |
2 ms |
1116 KB |
Output is correct |
26 |
Correct |
4 ms |
1508 KB |
Output is correct |
27 |
Correct |
4 ms |
1624 KB |
Output is correct |
28 |
Correct |
4 ms |
1628 KB |
Output is correct |
29 |
Correct |
2 ms |
1116 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
344 KB |
Output is correct |
2 |
Correct |
1 ms |
604 KB |
Output is correct |
3 |
Correct |
1 ms |
604 KB |
Output is correct |
4 |
Correct |
0 ms |
604 KB |
Output is correct |
5 |
Correct |
0 ms |
348 KB |
Output is correct |
6 |
Correct |
1 ms |
604 KB |
Output is correct |
7 |
Correct |
0 ms |
348 KB |
Output is correct |
8 |
Correct |
0 ms |
348 KB |
Output is correct |
9 |
Correct |
0 ms |
348 KB |
Output is correct |
10 |
Correct |
1 ms |
348 KB |
Output is correct |
11 |
Correct |
1 ms |
348 KB |
Output is correct |
12 |
Correct |
1 ms |
348 KB |
Output is correct |
13 |
Correct |
0 ms |
348 KB |
Output is correct |
14 |
Correct |
0 ms |
348 KB |
Output is correct |
15 |
Correct |
0 ms |
348 KB |
Output is correct |
16 |
Correct |
0 ms |
348 KB |
Output is correct |
17 |
Correct |
3 ms |
1884 KB |
Output is correct |
18 |
Correct |
3 ms |
1884 KB |
Output is correct |
19 |
Correct |
3 ms |
1908 KB |
Output is correct |
20 |
Correct |
2 ms |
1116 KB |
Output is correct |
21 |
Correct |
4 ms |
1508 KB |
Output is correct |
22 |
Correct |
4 ms |
1624 KB |
Output is correct |
23 |
Correct |
4 ms |
1628 KB |
Output is correct |
24 |
Correct |
2 ms |
1116 KB |
Output is correct |
25 |
Correct |
0 ms |
344 KB |
Output is correct |
26 |
Correct |
0 ms |
348 KB |
Output is correct |
27 |
Correct |
0 ms |
348 KB |
Output is correct |
28 |
Correct |
0 ms |
348 KB |
Output is correct |
29 |
Correct |
0 ms |
344 KB |
Output is correct |
30 |
Correct |
22 ms |
9924 KB |
Output is correct |
31 |
Correct |
22 ms |
9916 KB |
Output is correct |
32 |
Correct |
23 ms |
10076 KB |
Output is correct |
33 |
Correct |
15 ms |
5532 KB |
Output is correct |
34 |
Correct |
26 ms |
8404 KB |
Output is correct |
35 |
Correct |
26 ms |
8804 KB |
Output is correct |
36 |
Correct |
24 ms |
8396 KB |
Output is correct |
37 |
Correct |
25 ms |
8324 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
344 KB |
Output is correct |
2 |
Correct |
1 ms |
604 KB |
Output is correct |
3 |
Correct |
1 ms |
604 KB |
Output is correct |
4 |
Correct |
0 ms |
604 KB |
Output is correct |
5 |
Correct |
0 ms |
348 KB |
Output is correct |
6 |
Correct |
1 ms |
604 KB |
Output is correct |
7 |
Correct |
0 ms |
348 KB |
Output is correct |
8 |
Correct |
0 ms |
348 KB |
Output is correct |
9 |
Correct |
0 ms |
348 KB |
Output is correct |
10 |
Correct |
1 ms |
348 KB |
Output is correct |
11 |
Correct |
1 ms |
348 KB |
Output is correct |
12 |
Correct |
1 ms |
348 KB |
Output is correct |
13 |
Correct |
0 ms |
348 KB |
Output is correct |
14 |
Correct |
0 ms |
348 KB |
Output is correct |
15 |
Correct |
0 ms |
348 KB |
Output is correct |
16 |
Correct |
0 ms |
348 KB |
Output is correct |
17 |
Correct |
3 ms |
1884 KB |
Output is correct |
18 |
Correct |
3 ms |
1884 KB |
Output is correct |
19 |
Correct |
3 ms |
1908 KB |
Output is correct |
20 |
Correct |
2 ms |
1116 KB |
Output is correct |
21 |
Correct |
4 ms |
1508 KB |
Output is correct |
22 |
Correct |
4 ms |
1624 KB |
Output is correct |
23 |
Correct |
4 ms |
1628 KB |
Output is correct |
24 |
Correct |
2 ms |
1116 KB |
Output is correct |
25 |
Correct |
22 ms |
9924 KB |
Output is correct |
26 |
Correct |
22 ms |
9916 KB |
Output is correct |
27 |
Correct |
23 ms |
10076 KB |
Output is correct |
28 |
Correct |
15 ms |
5532 KB |
Output is correct |
29 |
Correct |
26 ms |
8404 KB |
Output is correct |
30 |
Correct |
26 ms |
8804 KB |
Output is correct |
31 |
Correct |
24 ms |
8396 KB |
Output is correct |
32 |
Correct |
25 ms |
8324 KB |
Output is correct |
33 |
Correct |
0 ms |
344 KB |
Output is correct |
34 |
Correct |
0 ms |
348 KB |
Output is correct |
35 |
Correct |
0 ms |
348 KB |
Output is correct |
36 |
Correct |
0 ms |
348 KB |
Output is correct |
37 |
Correct |
0 ms |
344 KB |
Output is correct |
38 |
Correct |
156 ms |
76112 KB |
Output is correct |
39 |
Correct |
157 ms |
70012 KB |
Output is correct |
40 |
Correct |
152 ms |
69936 KB |
Output is correct |
41 |
Correct |
146 ms |
68512 KB |
Output is correct |
42 |
Correct |
283 ms |
118920 KB |
Output is correct |
43 |
Correct |
290 ms |
118864 KB |
Output is correct |
44 |
Correct |
281 ms |
119376 KB |
Output is correct |
45 |
Correct |
273 ms |
112864 KB |
Output is correct |
46 |
Correct |
159 ms |
53332 KB |
Output is correct |
47 |
Correct |
221 ms |
63568 KB |
Output is correct |
48 |
Correct |
441 ms |
101716 KB |
Output is correct |
49 |
Correct |
490 ms |
103504 KB |
Output is correct |
50 |
Correct |
201 ms |
65176 KB |
Output is correct |
51 |
Correct |
206 ms |
65104 KB |
Output is correct |
52 |
Correct |
425 ms |
97100 KB |
Output is correct |
53 |
Correct |
448 ms |
97876 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
176 ms |
441236 KB |
Output is correct |
2 |
Correct |
125 ms |
318292 KB |
Output is correct |
3 |
Correct |
193 ms |
441084 KB |
Output is correct |
4 |
Correct |
0 ms |
348 KB |
Output is correct |
5 |
Correct |
190 ms |
441284 KB |
Output is correct |
6 |
Correct |
192 ms |
441184 KB |
Output is correct |
7 |
Correct |
183 ms |
441312 KB |
Output is correct |
8 |
Correct |
187 ms |
441180 KB |
Output is correct |
9 |
Correct |
183 ms |
441212 KB |
Output is correct |
10 |
Correct |
175 ms |
440916 KB |
Output is correct |
11 |
Correct |
175 ms |
440924 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
344 KB |
Output is correct |
2 |
Correct |
0 ms |
348 KB |
Output is correct |
3 |
Correct |
0 ms |
348 KB |
Output is correct |
4 |
Correct |
0 ms |
348 KB |
Output is correct |
5 |
Correct |
0 ms |
344 KB |
Output is correct |
6 |
Correct |
0 ms |
348 KB |
Output is correct |
7 |
Correct |
1192 ms |
483528 KB |
Output is correct |
8 |
Correct |
2608 ms |
672364 KB |
Output is correct |
9 |
Correct |
2591 ms |
673448 KB |
Output is correct |
10 |
Correct |
2652 ms |
673560 KB |
Output is correct |
11 |
Correct |
416 ms |
468612 KB |
Output is correct |
12 |
Correct |
672 ms |
493208 KB |
Output is correct |
13 |
Correct |
660 ms |
496416 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
344 KB |
Output is correct |
2 |
Correct |
1 ms |
604 KB |
Output is correct |
3 |
Correct |
1 ms |
604 KB |
Output is correct |
4 |
Correct |
0 ms |
604 KB |
Output is correct |
5 |
Correct |
0 ms |
348 KB |
Output is correct |
6 |
Correct |
1 ms |
604 KB |
Output is correct |
7 |
Correct |
0 ms |
348 KB |
Output is correct |
8 |
Correct |
0 ms |
348 KB |
Output is correct |
9 |
Correct |
0 ms |
348 KB |
Output is correct |
10 |
Correct |
1 ms |
348 KB |
Output is correct |
11 |
Correct |
1 ms |
348 KB |
Output is correct |
12 |
Correct |
1 ms |
348 KB |
Output is correct |
13 |
Correct |
0 ms |
348 KB |
Output is correct |
14 |
Correct |
0 ms |
348 KB |
Output is correct |
15 |
Correct |
0 ms |
348 KB |
Output is correct |
16 |
Correct |
0 ms |
348 KB |
Output is correct |
17 |
Correct |
3 ms |
1884 KB |
Output is correct |
18 |
Correct |
3 ms |
1884 KB |
Output is correct |
19 |
Correct |
3 ms |
1908 KB |
Output is correct |
20 |
Correct |
2 ms |
1116 KB |
Output is correct |
21 |
Correct |
4 ms |
1508 KB |
Output is correct |
22 |
Correct |
4 ms |
1624 KB |
Output is correct |
23 |
Correct |
4 ms |
1628 KB |
Output is correct |
24 |
Correct |
2 ms |
1116 KB |
Output is correct |
25 |
Correct |
22 ms |
9924 KB |
Output is correct |
26 |
Correct |
22 ms |
9916 KB |
Output is correct |
27 |
Correct |
23 ms |
10076 KB |
Output is correct |
28 |
Correct |
15 ms |
5532 KB |
Output is correct |
29 |
Correct |
26 ms |
8404 KB |
Output is correct |
30 |
Correct |
26 ms |
8804 KB |
Output is correct |
31 |
Correct |
24 ms |
8396 KB |
Output is correct |
32 |
Correct |
25 ms |
8324 KB |
Output is correct |
33 |
Correct |
156 ms |
76112 KB |
Output is correct |
34 |
Correct |
157 ms |
70012 KB |
Output is correct |
35 |
Correct |
152 ms |
69936 KB |
Output is correct |
36 |
Correct |
146 ms |
68512 KB |
Output is correct |
37 |
Correct |
283 ms |
118920 KB |
Output is correct |
38 |
Correct |
290 ms |
118864 KB |
Output is correct |
39 |
Correct |
281 ms |
119376 KB |
Output is correct |
40 |
Correct |
273 ms |
112864 KB |
Output is correct |
41 |
Correct |
159 ms |
53332 KB |
Output is correct |
42 |
Correct |
221 ms |
63568 KB |
Output is correct |
43 |
Correct |
441 ms |
101716 KB |
Output is correct |
44 |
Correct |
490 ms |
103504 KB |
Output is correct |
45 |
Correct |
201 ms |
65176 KB |
Output is correct |
46 |
Correct |
206 ms |
65104 KB |
Output is correct |
47 |
Correct |
425 ms |
97100 KB |
Output is correct |
48 |
Correct |
448 ms |
97876 KB |
Output is correct |
49 |
Correct |
176 ms |
441236 KB |
Output is correct |
50 |
Correct |
125 ms |
318292 KB |
Output is correct |
51 |
Correct |
193 ms |
441084 KB |
Output is correct |
52 |
Correct |
0 ms |
348 KB |
Output is correct |
53 |
Correct |
190 ms |
441284 KB |
Output is correct |
54 |
Correct |
192 ms |
441184 KB |
Output is correct |
55 |
Correct |
183 ms |
441312 KB |
Output is correct |
56 |
Correct |
187 ms |
441180 KB |
Output is correct |
57 |
Correct |
183 ms |
441212 KB |
Output is correct |
58 |
Correct |
175 ms |
440916 KB |
Output is correct |
59 |
Correct |
175 ms |
440924 KB |
Output is correct |
60 |
Correct |
0 ms |
348 KB |
Output is correct |
61 |
Correct |
1192 ms |
483528 KB |
Output is correct |
62 |
Correct |
2608 ms |
672364 KB |
Output is correct |
63 |
Correct |
2591 ms |
673448 KB |
Output is correct |
64 |
Correct |
2652 ms |
673560 KB |
Output is correct |
65 |
Correct |
416 ms |
468612 KB |
Output is correct |
66 |
Correct |
672 ms |
493208 KB |
Output is correct |
67 |
Correct |
660 ms |
496416 KB |
Output is correct |
68 |
Correct |
0 ms |
344 KB |
Output is correct |
69 |
Correct |
0 ms |
348 KB |
Output is correct |
70 |
Correct |
0 ms |
348 KB |
Output is correct |
71 |
Correct |
0 ms |
348 KB |
Output is correct |
72 |
Correct |
0 ms |
344 KB |
Output is correct |
73 |
Correct |
2204 ms |
965764 KB |
Output is correct |
74 |
Correct |
2295 ms |
886308 KB |
Output is correct |
75 |
Correct |
2131 ms |
884432 KB |
Output is correct |
76 |
Correct |
2190 ms |
867976 KB |
Output is correct |
77 |
Runtime error |
2553 ms |
1048576 KB |
Execution killed with signal 9 |
78 |
Halted |
0 ms |
0 KB |
- |