# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
1064440 |
2024-08-18T12:48:25 Z |
Arapak |
Rectangles (IOI19_rect) |
C++17 |
|
5000 ms |
28292 KB |
// Author: Kajetan Ramsza
#include "rect.h"
#include "bits/stdc++.h"
using namespace std;
#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 vector<int> vi;
typedef pair<int,int> pii;
typedef long long ll;
#ifdef DEBUG
auto& operator<<(auto& os, const pair<auto, auto> &p);
auto& operator<<(auto &os, const auto &v)
{ os<<"{"; for(auto it=begin(v);it!=end(v);++it) {
if(it != begin(v)) { os<<", "; } os<<(*it);
} return os<<"}"; }
auto& operator<<(auto &os, const pair<auto, auto> &p)
{ return os<<"("<<p.first<<", "<<p.second<<")"; }
void dbg_out(auto... x) { ((cerr<<' '<<x), ...) << endl; }
#define dbg(x...) cerr<<"("<<#x<<"):", dbg_out(x)
#else
#define dbg(...)
#endif
int n, m;
bool check(vector<vi> &a, int x1, int x2, int y1, int y2) {
assert(0 < x1 && x1 < x2 && x2 < n);
assert(0 < y1 && y1 < y2 && y2 < m);
rep(i,x1,x2) rep(j,y1,y2)
if(a[x1-1][j] <= a[i][j] || a[x2][j] <= a[i][j] ||
a[i][y1-1] <= a[i][j] || a[i][y2] <= a[i][j])
return false;
return true;
}
ll count_rectangles(vector<vi> a) {
n = sz(a);
m = sz(a[0]);
ll res = 0;
rep(x1,1,n) rep(x2,x1+1,n)
rep(y1,1,m) rep(y2,y1+1,m)
res += check(a,x1,x2,y1,y2);
return res;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 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 |
348 KB |
Output is correct |
8 |
Correct |
0 ms |
348 KB |
Output is correct |
9 |
Correct |
1 ms |
348 KB |
Output is correct |
10 |
Correct |
2 ms |
348 KB |
Output is correct |
11 |
Correct |
2 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 |
1 ms |
344 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 |
348 KB |
Output is correct |
18 |
Correct |
1 ms |
348 KB |
Output is correct |
19 |
Correct |
1 ms |
348 KB |
Output is correct |
20 |
Correct |
0 ms |
348 KB |
Output is correct |
21 |
Correct |
1 ms |
348 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 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 |
348 KB |
Output is correct |
8 |
Correct |
0 ms |
348 KB |
Output is correct |
9 |
Correct |
1 ms |
348 KB |
Output is correct |
10 |
Correct |
2 ms |
348 KB |
Output is correct |
11 |
Correct |
2 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 |
1 ms |
344 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 |
348 KB |
Output is correct |
18 |
Correct |
1 ms |
348 KB |
Output is correct |
19 |
Correct |
1 ms |
348 KB |
Output is correct |
20 |
Correct |
0 ms |
348 KB |
Output is correct |
21 |
Correct |
1 ms |
348 KB |
Output is correct |
22 |
Correct |
57 ms |
348 KB |
Output is correct |
23 |
Correct |
68 ms |
512 KB |
Output is correct |
24 |
Correct |
57 ms |
348 KB |
Output is correct |
25 |
Correct |
50 ms |
348 KB |
Output is correct |
26 |
Correct |
52 ms |
600 KB |
Output is correct |
27 |
Correct |
52 ms |
348 KB |
Output is correct |
28 |
Correct |
66 ms |
344 KB |
Output is correct |
29 |
Correct |
13 ms |
348 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 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 |
348 KB |
Output is correct |
8 |
Correct |
0 ms |
348 KB |
Output is correct |
9 |
Correct |
1 ms |
348 KB |
Output is correct |
10 |
Correct |
2 ms |
348 KB |
Output is correct |
11 |
Correct |
2 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 |
1 ms |
344 KB |
Output is correct |
15 |
Correct |
0 ms |
348 KB |
Output is correct |
16 |
Correct |
0 ms |
348 KB |
Output is correct |
17 |
Correct |
57 ms |
348 KB |
Output is correct |
18 |
Correct |
68 ms |
512 KB |
Output is correct |
19 |
Correct |
57 ms |
348 KB |
Output is correct |
20 |
Correct |
50 ms |
348 KB |
Output is correct |
21 |
Correct |
52 ms |
600 KB |
Output is correct |
22 |
Correct |
52 ms |
348 KB |
Output is correct |
23 |
Correct |
66 ms |
344 KB |
Output is correct |
24 |
Correct |
13 ms |
348 KB |
Output is correct |
25 |
Correct |
0 ms |
348 KB |
Output is correct |
26 |
Correct |
1 ms |
348 KB |
Output is correct |
27 |
Correct |
1 ms |
348 KB |
Output is correct |
28 |
Correct |
0 ms |
348 KB |
Output is correct |
29 |
Correct |
1 ms |
348 KB |
Output is correct |
30 |
Correct |
2285 ms |
960 KB |
Output is correct |
31 |
Correct |
2313 ms |
960 KB |
Output is correct |
32 |
Correct |
2301 ms |
1036 KB |
Output is correct |
33 |
Correct |
2039 ms |
852 KB |
Output is correct |
34 |
Correct |
2183 ms |
880 KB |
Output is correct |
35 |
Correct |
2235 ms |
1104 KB |
Output is correct |
36 |
Correct |
2323 ms |
860 KB |
Output is correct |
37 |
Correct |
2092 ms |
860 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 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 |
348 KB |
Output is correct |
8 |
Correct |
0 ms |
348 KB |
Output is correct |
9 |
Correct |
1 ms |
348 KB |
Output is correct |
10 |
Correct |
2 ms |
348 KB |
Output is correct |
11 |
Correct |
2 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 |
1 ms |
344 KB |
Output is correct |
15 |
Correct |
0 ms |
348 KB |
Output is correct |
16 |
Correct |
0 ms |
348 KB |
Output is correct |
17 |
Correct |
57 ms |
348 KB |
Output is correct |
18 |
Correct |
68 ms |
512 KB |
Output is correct |
19 |
Correct |
57 ms |
348 KB |
Output is correct |
20 |
Correct |
50 ms |
348 KB |
Output is correct |
21 |
Correct |
52 ms |
600 KB |
Output is correct |
22 |
Correct |
52 ms |
348 KB |
Output is correct |
23 |
Correct |
66 ms |
344 KB |
Output is correct |
24 |
Correct |
13 ms |
348 KB |
Output is correct |
25 |
Correct |
2285 ms |
960 KB |
Output is correct |
26 |
Correct |
2313 ms |
960 KB |
Output is correct |
27 |
Correct |
2301 ms |
1036 KB |
Output is correct |
28 |
Correct |
2039 ms |
852 KB |
Output is correct |
29 |
Correct |
2183 ms |
880 KB |
Output is correct |
30 |
Correct |
2235 ms |
1104 KB |
Output is correct |
31 |
Correct |
2323 ms |
860 KB |
Output is correct |
32 |
Correct |
2092 ms |
860 KB |
Output is correct |
33 |
Correct |
0 ms |
348 KB |
Output is correct |
34 |
Correct |
1 ms |
348 KB |
Output is correct |
35 |
Correct |
1 ms |
348 KB |
Output is correct |
36 |
Correct |
0 ms |
348 KB |
Output is correct |
37 |
Correct |
1 ms |
348 KB |
Output is correct |
38 |
Execution timed out |
5051 ms |
7252 KB |
Time limit exceeded |
39 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
20 ms |
344 KB |
Output is correct |
2 |
Correct |
14 ms |
344 KB |
Output is correct |
3 |
Correct |
16 ms |
348 KB |
Output is correct |
4 |
Correct |
0 ms |
348 KB |
Output is correct |
5 |
Correct |
19 ms |
348 KB |
Output is correct |
6 |
Correct |
19 ms |
560 KB |
Output is correct |
7 |
Correct |
18 ms |
344 KB |
Output is correct |
8 |
Correct |
18 ms |
344 KB |
Output is correct |
9 |
Correct |
18 ms |
348 KB |
Output is correct |
10 |
Correct |
0 ms |
348 KB |
Output is correct |
11 |
Correct |
0 ms |
348 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 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 |
0 ms |
348 KB |
Output is correct |
5 |
Correct |
1 ms |
348 KB |
Output is correct |
6 |
Correct |
0 ms |
344 KB |
Output is correct |
7 |
Execution timed out |
5075 ms |
28292 KB |
Time limit exceeded |
8 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 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 |
348 KB |
Output is correct |
8 |
Correct |
0 ms |
348 KB |
Output is correct |
9 |
Correct |
1 ms |
348 KB |
Output is correct |
10 |
Correct |
2 ms |
348 KB |
Output is correct |
11 |
Correct |
2 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 |
1 ms |
344 KB |
Output is correct |
15 |
Correct |
0 ms |
348 KB |
Output is correct |
16 |
Correct |
0 ms |
348 KB |
Output is correct |
17 |
Correct |
57 ms |
348 KB |
Output is correct |
18 |
Correct |
68 ms |
512 KB |
Output is correct |
19 |
Correct |
57 ms |
348 KB |
Output is correct |
20 |
Correct |
50 ms |
348 KB |
Output is correct |
21 |
Correct |
52 ms |
600 KB |
Output is correct |
22 |
Correct |
52 ms |
348 KB |
Output is correct |
23 |
Correct |
66 ms |
344 KB |
Output is correct |
24 |
Correct |
13 ms |
348 KB |
Output is correct |
25 |
Correct |
2285 ms |
960 KB |
Output is correct |
26 |
Correct |
2313 ms |
960 KB |
Output is correct |
27 |
Correct |
2301 ms |
1036 KB |
Output is correct |
28 |
Correct |
2039 ms |
852 KB |
Output is correct |
29 |
Correct |
2183 ms |
880 KB |
Output is correct |
30 |
Correct |
2235 ms |
1104 KB |
Output is correct |
31 |
Correct |
2323 ms |
860 KB |
Output is correct |
32 |
Correct |
2092 ms |
860 KB |
Output is correct |
33 |
Execution timed out |
5051 ms |
7252 KB |
Time limit exceeded |
34 |
Halted |
0 ms |
0 KB |
- |