#include "rect.h"
#include<bits/stdc++.h>
using namespace std;
using ll = int;
using lll = long long;
const ll maxn = 2500;
const ll big = 1e9;
struct BIT{
ll n;
vector<ll> a;
BIT(ll N):n(N),a(N+1,0){}
void add(ll i, ll v){
for(;i<=n;i+=i&-i) a[i] += v;
}
ll get(ll i){
ll x = 0;
for(;i>0;i-=i&-i) x += a[i];
return x;
}
};
struct dsu{
vector<ll> p;
dsu(ll N):p(N,-1){}
ll g(ll i){
return p[i]<0?i:p[i] = g(p[i]);
}
bool m(ll a,ll b){
a = g(a),b = g(b);
if (a==b) return false;
if (p[a]>p[b]) swap(a,b);
p[a] += p[b];
p[b] = a;
return true;
}
};
struct node{
ll l,r,m,v;
node *L,*R;
node(ll a, ll b):l(a),r(b),m(a+b>>1),v(0),L(nullptr),R(nullptr){
if (l<r){
L = new node(l,m);
R = new node(m+1,r);
}
}
void add(ll i, ll x){
if(l<r){
if(i<=m) (L=new node(*L))->add(i,x);
else (R=new node(*R))->add(i,x);
}else v+=x;
}
ll qry(ll i){
if(l<r){
if(i<=m) return L->qry(i);
else return R->qry(i);
}else return v;
}
};
struct segtree{
vector<node*> rt;
segtree(ll l, ll r){
rt.push_back(new node(l,r));
}
void nw(){
//cerr << "nw\n";
rt.push_back(new node(*rt.back()));
}
void add(ll t, ll i, ll x){
//cerr << "add " << t << " " << i << " " << x << "\n";
rt[t]->add(i,x);
}
ll qry(ll t, ll i){
ll ret = rt[t]->qry(i);
//cerr << "qry " << t << " " << i << " -> " << ret << "\n";
return ret;
}
};
struct segtree_n{
ll l0,r0;
vector<ll> rt,v,L,R;
segtree_n(ll l, ll r):l0(l),r0(r){
rt.push_back(build(l,r));
}
ll newnode(){
ll ret = v.size();
v.emplace_back();
L.push_back(-1);
R.push_back(-1);
return ret;
}
ll copy(ll i){
ll ret = v.size();
v.push_back(v[i]);
L.push_back(L[i]);
R.push_back(R[i]);
return ret;
}
ll build(ll l, ll r){
ll ret = newnode();
if (l<r){
ll m = l+r>>1;
ll tmp = build(l,m);
L[ret] = tmp;
tmp = build(m+1,r);
R[ret] = tmp;
}
return ret;
}
void nw(){
//cerr << "nw\n";
rt.push_back(copy(rt.back()));
}
void add(ll i, ll l, ll r, ll p, ll x){
if (l==r) v[i] += x;
else{
ll m = l+r>>1;
if (p<=m) {
ll tmp = copy(L[i]);
add(L[i]=tmp,l,m,p,x);
}else{
ll tmp = copy(R[i]);
add(R[i]=tmp,m+1,r,p,x);
}
}
}
void add(ll t, ll i, ll x){
//cerr << "add " << t << " " << i << " " << x << "\n";
add(rt[t],l0,r0,i,x);
}
ll qry(ll i, ll l, ll r, ll p){
if (l==r) return v[i];
else{
ll m = l+r>>1;
if (p<=m) return qry(L[i],l,m,p);
else return qry(R[i],m+1,r,p);
}
}
ll qry(ll t, ll i){
ll ret = qry(rt[t],l0,r0,i);
//cerr << "qry " << t << " " << i << " -> " << ret << "\n";
return ret;
}
};
struct mxt{
ll n;
vector<ll> a;
mxt(ll N):n(N),a(N<<2,0){}
void mod(ll i, ll l, ll r, ll x, ll v){
if (l==r) a[i] = v;
else{
ll m = l+r>>1;
if (x<=m) mod(i<<1,l,m,x,v);
else mod(i<<1|1,m+1,r,x,v);
a[i] = max(a[i<<1],a[i<<1|1]);
}
}
ll qry(ll i, ll l, ll r, ll ql, ll qr){
if (ql<=l&&r<=qr) return a[i];
else{
ll m = l+r>>1;
ll ret = -big;
if (ql<=m)ret = max(ret,qry(i<<1,l,m,ql,qr));
if(qr>m)ret = max(ret,qry(i<<1|1,m+1,r,ql,qr));
return ret;
}
}
};
long long count_rectangles(std::vector<std::vector<int> > a) {
ll n = a.size(), m = a[0].size();
if (n<3||m<3) return 0;
ll sub6 = 1;
for(auto &o : a) for(ll &i : o) if (i>1) sub6 = 0;
if (0&&sub6){
dsu d(n*m);
for(ll i = 1;i<n-1;i++){
for(ll j = 1;j<m-1;j++){
if(i>1&&!a[i][j]&&!a[i-1][j]){
d.m((i)*m+(j),(i-1)*m+(j));
}
if(j>1&&!a[i][j]&&!a[i][j-1]){
d.m((i)*m+(j),(i)*m+(j-1));
}
}
}
vector<ll> gs;
for(ll i = 1;i<n-1;i++){
for(ll j = 1;j<m-1;j++){
if(!a[i][j]){
gs.push_back(d.g((i)*m+(j)));
}
}
}
sort(gs.begin(),gs.end());
gs.erase(unique(gs.begin(),gs.end()),gs.end());
ll gc = gs.size();
vector<vector<pair<ll,ll>>> ps(gc);
for(ll i = 1;i<n-1;i++){
for(ll j = 1;j<m-1;j++){
if(!a[i][j]){
ll p = d.g((i)*m+(j));
ll idx = lower_bound(gs.begin(),gs.end(),p)-gs.begin();
ps[idx].push_back({i,j});
}
}
}
ll ans = 0;
for(auto &o : ps){
ll x1 = o[0].first, x2=o[0].first, y1=o[0].second, y2=o[0].second;
for(auto [x,y] : o){
x1 = min(x,x1);
x2 = max(x,x2);
y1 = min(y,y1);
y2 = max(y,y2);
}
ll req = (x2-x1+1)*(y2-y1+1);
if (req==o.size()) ans++;
}
return ans;
}
vector<vector<pair<ll,ll>>> row(n),col(m);
for(ll i = 0;i<n;i++){
vector<pair<ll,ll>> st;
for(ll j = 0;j<m;j++){
while(st.size()&&st.back().first<a[i][j]){
if(j>st.back().second+1)row[i].push_back({st.back().second,j});
st.pop_back();
}
if(st.size()){
if(j>st.back().second+1)row[i].push_back({st.back().second,j});
}
if (st.size()&&st.back().first==a[i][j]) st.pop_back();
st.push_back({a[i][j],j});
}
}
for(ll j = 0;j<m;j++){
vector<pair<ll,ll>> st;
for(ll i = 0;i<n;i++){
while(st.size()&&st.back().first<a[i][j]){
if(i>st.back().second+1)col[j].push_back({st.back().second,i});
st.pop_back();
}
if(st.size()){
if(i>st.back().second+1)col[j].push_back({st.back().second,i});
}
if (st.size()&&st.back().first==a[i][j]) st.pop_back();
st.push_back({a[i][j],i});
}
}
for(auto &o : row) sort(o.begin(),o.end());
for(auto &o : col) sort(o.begin(),o.end());
vector<vector<ll>> down(n,vector<ll>(m,0)),up(n,vector<ll>(m,n));
for(ll i = 0;i<m;i++){
for(auto [l,r] : col[i]){
down[l][i] = r;
up[l][i] = min(up[l][i],r);
}
}
segtree_n tree(0,m*m);
for(ll i = 0;i<n;i++){
tree.nw();
for(auto [l,r] : row[i]){
ll idx = l*m+r;
tree.add(i+1,idx,1);
}
}
lll ans = 0;
for(ll r1 = 1;r1<n-1;r1++){
vector<pair<ll,ll>> cur;
vector<pair<ll,ll>> nw;
BIT t(m);
vector<vector<pair<ll,ll>>> ops(n);
BIT t0(m);
vector<vector<pair<ll,ll>>> ops0(n);
BIT t1(m);
vector<vector<pair<ll,ll>>> ops1(n);
vector<vector<pair<ll,ll>>> nws(n);
mxt mt(m);
if (1||sub6) for(ll i = 0;i<m;i++) {
mt.mod(1,0,m-1,i,max(up[r1-1][i]-1,r1));
ops[max(up[r1-1][i]-1,r1)].push_back({i+1,1});
ops[down[r1-1][i]].push_back({i+1,-1});
ops1[r1].push_back({i+1,1});
ops1[down[r1-1][i]].push_back({i+1,-1});
auto itl = lower_bound(col[i].begin(),col[i].end(),make_pair(r1-1,r1+1));
auto itr = lower_bound(col[i].begin(),col[i].end(),make_pair(r1,0));
for(auto it = itl;it!=itr;it++){
ll r = (*it).second;
ops0[r-1].push_back({i+1,1});
ops0[r].push_back({i+1,-1});
}
}
for(auto &o : row[r1]){
ll g = mt.qry(1,0,m-1,o.first+1,o.second-1);
nws[g].push_back(o);
////cerr << r1 << " " << g << " " << o.first << " " << o.second << "\n";
}
for(ll r2 = r1;r2<n-1;r2++){
if (1||sub6) for(auto [i,v] : ops[r2]){
t.add(i,v);
}
if (1||sub6) for(auto [i,v] : ops0[r2]){
t0.add(i,v);
}
if (1||sub6) for(auto [i,v] : ops1[r2]){
t1.add(i,v);
}
////cerr << "r2=" << r2 << " has " << nws[r2].size() <<"\n";
if (1||sub6) for(auto o: nws[r2]){
ll idx = o.first*m+o.second;
ll cnt = tree.qry(r2,idx)-tree.qry(r1,idx);
if(cnt>=r2-r1)cur.push_back(o);
////cerr << "add " << o.first << " " << o.second << "\n";
}
if(r2>r1){
for(auto &o : cur){
if (t1.get(o.second)-t1.get(o.first+1)==(o.second-o.first-1)&&binary_search(row[r2].begin(),row[r2].end(),o)){
nw.push_back(o);
}
}
nw.swap(cur);
nw.clear();
}
if (1||sub6){
for(auto &o : cur){
if (t.get(o.second)-t.get(o.first+1)==(o.second-o.first-1)&&
t0.get(o.second)-t0.get(o.first+1)==(o.second-o.first-1)) ans++;
}
}else{
pair<ll,ll> t = {r1-1,r2+1};
vector<ll> ok(m,0);
for(ll i = 0;i<m;i++) ok[i] = down[r1-1][i]>r2&&up[r1-1][i]-1<=r2&&binary_search(col[i].begin(),col[i].end(),t);
vector<ll> p(m+1,0);
for(ll i = 0;i<m;i++) p[i+1] = p[i]+ok[i];
for(auto &o : cur){
if (p[o.second]-p[o.first+1]==(o.second-o.first-1)) ans++;
}
}
}
}
return ans;
}
Compilation message
rect.cpp: In constructor 'node::node(ll, ll)':
rect.cpp:39:32: warning: suggest parentheses around '+' inside '>>' [-Wparentheses]
39 | node(ll a, ll b):l(a),r(b),m(a+b>>1),v(0),L(nullptr),R(nullptr){
| ~^~
rect.cpp: In member function 'll segtree_n::build(ll, ll)':
rect.cpp:100:12: warning: suggest parentheses around '+' inside '>>' [-Wparentheses]
100 | ll m = l+r>>1;
| ~^~
rect.cpp: In member function 'void segtree_n::add(ll, ll, ll, ll, ll)':
rect.cpp:115:12: warning: suggest parentheses around '+' inside '>>' [-Wparentheses]
115 | ll m = l+r>>1;
| ~^~
rect.cpp: In member function 'll segtree_n::qry(ll, ll, ll, ll)':
rect.cpp:132:12: warning: suggest parentheses around '+' inside '>>' [-Wparentheses]
132 | ll m = l+r>>1;
| ~^~
rect.cpp: In member function 'void mxt::mod(ll, ll, ll, ll, ll)':
rect.cpp:150:12: warning: suggest parentheses around '+' inside '>>' [-Wparentheses]
150 | ll m = l+r>>1;
| ~^~
rect.cpp: In member function 'll mxt::qry(ll, ll, ll, ll, ll)':
rect.cpp:159:12: warning: suggest parentheses around '+' inside '>>' [-Wparentheses]
159 | ll m = l+r>>1;
| ~^~
rect.cpp: In function 'long long int count_rectangles(std::vector<std::vector<int> >)':
rect.cpp:216:11: warning: comparison of integer expressions of different signedness: 'll' {aka 'int'} and 'std::vector<std::pair<int, int> >::size_type' {aka 'long unsigned int'} [-Wsign-compare]
216 | if (req==o.size()) ans++;
| ~~~^~~~~~~~~~
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
348 KB |
Output is correct |
2 |
Correct |
1 ms |
604 KB |
Output is correct |
3 |
Correct |
1 ms |
604 KB |
Output is correct |
4 |
Correct |
1 ms |
604 KB |
Output is correct |
5 |
Correct |
1 ms |
344 KB |
Output is correct |
6 |
Correct |
1 ms |
604 KB |
Output is correct |
7 |
Correct |
0 ms |
348 KB |
Output is correct |
8 |
Correct |
1 ms |
344 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 |
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 |
348 KB |
Output is correct |
18 |
Correct |
0 ms |
344 KB |
Output is correct |
19 |
Correct |
1 ms |
348 KB |
Output is correct |
20 |
Correct |
1 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 |
348 KB |
Output is correct |
2 |
Correct |
1 ms |
604 KB |
Output is correct |
3 |
Correct |
1 ms |
604 KB |
Output is correct |
4 |
Correct |
1 ms |
604 KB |
Output is correct |
5 |
Correct |
1 ms |
344 KB |
Output is correct |
6 |
Correct |
1 ms |
604 KB |
Output is correct |
7 |
Correct |
0 ms |
348 KB |
Output is correct |
8 |
Correct |
1 ms |
344 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 |
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 |
348 KB |
Output is correct |
18 |
Correct |
0 ms |
344 KB |
Output is correct |
19 |
Correct |
1 ms |
348 KB |
Output is correct |
20 |
Correct |
1 ms |
348 KB |
Output is correct |
21 |
Correct |
0 ms |
344 KB |
Output is correct |
22 |
Correct |
4 ms |
1876 KB |
Output is correct |
23 |
Correct |
4 ms |
2120 KB |
Output is correct |
24 |
Correct |
4 ms |
1876 KB |
Output is correct |
25 |
Correct |
3 ms |
1356 KB |
Output is correct |
26 |
Correct |
6 ms |
1872 KB |
Output is correct |
27 |
Correct |
5 ms |
1876 KB |
Output is correct |
28 |
Correct |
5 ms |
1708 KB |
Output is correct |
29 |
Correct |
3 ms |
860 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
348 KB |
Output is correct |
2 |
Correct |
1 ms |
604 KB |
Output is correct |
3 |
Correct |
1 ms |
604 KB |
Output is correct |
4 |
Correct |
1 ms |
604 KB |
Output is correct |
5 |
Correct |
1 ms |
344 KB |
Output is correct |
6 |
Correct |
1 ms |
604 KB |
Output is correct |
7 |
Correct |
0 ms |
348 KB |
Output is correct |
8 |
Correct |
1 ms |
344 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 |
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 |
4 ms |
1876 KB |
Output is correct |
18 |
Correct |
4 ms |
2120 KB |
Output is correct |
19 |
Correct |
4 ms |
1876 KB |
Output is correct |
20 |
Correct |
3 ms |
1356 KB |
Output is correct |
21 |
Correct |
6 ms |
1872 KB |
Output is correct |
22 |
Correct |
5 ms |
1876 KB |
Output is correct |
23 |
Correct |
5 ms |
1708 KB |
Output is correct |
24 |
Correct |
3 ms |
860 KB |
Output is correct |
25 |
Correct |
0 ms |
348 KB |
Output is correct |
26 |
Correct |
0 ms |
344 KB |
Output is correct |
27 |
Correct |
1 ms |
348 KB |
Output is correct |
28 |
Correct |
1 ms |
348 KB |
Output is correct |
29 |
Correct |
0 ms |
344 KB |
Output is correct |
30 |
Correct |
21 ms |
13272 KB |
Output is correct |
31 |
Correct |
24 ms |
13348 KB |
Output is correct |
32 |
Correct |
22 ms |
16680 KB |
Output is correct |
33 |
Correct |
16 ms |
5944 KB |
Output is correct |
34 |
Correct |
28 ms |
12364 KB |
Output is correct |
35 |
Correct |
33 ms |
12836 KB |
Output is correct |
36 |
Correct |
28 ms |
14000 KB |
Output is correct |
37 |
Correct |
32 ms |
13348 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
348 KB |
Output is correct |
2 |
Correct |
1 ms |
604 KB |
Output is correct |
3 |
Correct |
1 ms |
604 KB |
Output is correct |
4 |
Correct |
1 ms |
604 KB |
Output is correct |
5 |
Correct |
1 ms |
344 KB |
Output is correct |
6 |
Correct |
1 ms |
604 KB |
Output is correct |
7 |
Correct |
0 ms |
348 KB |
Output is correct |
8 |
Correct |
1 ms |
344 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 |
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 |
4 ms |
1876 KB |
Output is correct |
18 |
Correct |
4 ms |
2120 KB |
Output is correct |
19 |
Correct |
4 ms |
1876 KB |
Output is correct |
20 |
Correct |
3 ms |
1356 KB |
Output is correct |
21 |
Correct |
6 ms |
1872 KB |
Output is correct |
22 |
Correct |
5 ms |
1876 KB |
Output is correct |
23 |
Correct |
5 ms |
1708 KB |
Output is correct |
24 |
Correct |
3 ms |
860 KB |
Output is correct |
25 |
Correct |
21 ms |
13272 KB |
Output is correct |
26 |
Correct |
24 ms |
13348 KB |
Output is correct |
27 |
Correct |
22 ms |
16680 KB |
Output is correct |
28 |
Correct |
16 ms |
5944 KB |
Output is correct |
29 |
Correct |
28 ms |
12364 KB |
Output is correct |
30 |
Correct |
33 ms |
12836 KB |
Output is correct |
31 |
Correct |
28 ms |
14000 KB |
Output is correct |
32 |
Correct |
32 ms |
13348 KB |
Output is correct |
33 |
Correct |
0 ms |
348 KB |
Output is correct |
34 |
Correct |
0 ms |
344 KB |
Output is correct |
35 |
Correct |
1 ms |
348 KB |
Output is correct |
36 |
Correct |
1 ms |
348 KB |
Output is correct |
37 |
Correct |
0 ms |
344 KB |
Output is correct |
38 |
Correct |
245 ms |
86304 KB |
Output is correct |
39 |
Correct |
236 ms |
83560 KB |
Output is correct |
40 |
Correct |
201 ms |
85392 KB |
Output is correct |
41 |
Correct |
195 ms |
84412 KB |
Output is correct |
42 |
Correct |
393 ms |
157024 KB |
Output is correct |
43 |
Correct |
384 ms |
154868 KB |
Output is correct |
44 |
Correct |
386 ms |
156316 KB |
Output is correct |
45 |
Correct |
391 ms |
154244 KB |
Output is correct |
46 |
Correct |
160 ms |
51448 KB |
Output is correct |
47 |
Correct |
230 ms |
82268 KB |
Output is correct |
48 |
Correct |
494 ms |
154272 KB |
Output is correct |
49 |
Correct |
500 ms |
156056 KB |
Output is correct |
50 |
Correct |
230 ms |
78948 KB |
Output is correct |
51 |
Correct |
239 ms |
77792 KB |
Output is correct |
52 |
Correct |
459 ms |
156836 KB |
Output is correct |
53 |
Correct |
464 ms |
155424 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
183 ms |
149760 KB |
Output is correct |
2 |
Correct |
144 ms |
134364 KB |
Output is correct |
3 |
Correct |
159 ms |
147580 KB |
Output is correct |
4 |
Correct |
1 ms |
600 KB |
Output is correct |
5 |
Correct |
163 ms |
149816 KB |
Output is correct |
6 |
Correct |
163 ms |
149636 KB |
Output is correct |
7 |
Correct |
176 ms |
149732 KB |
Output is correct |
8 |
Correct |
190 ms |
149540 KB |
Output is correct |
9 |
Correct |
181 ms |
149464 KB |
Output is correct |
10 |
Correct |
0 ms |
344 KB |
Output is correct |
11 |
Correct |
1 ms |
348 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
348 KB |
Output is correct |
2 |
Correct |
0 ms |
344 KB |
Output is correct |
3 |
Correct |
1 ms |
348 KB |
Output is correct |
4 |
Correct |
1 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 |
1303 ms |
385628 KB |
Output is correct |
8 |
Correct |
2764 ms |
710548 KB |
Output is correct |
9 |
Correct |
2832 ms |
713008 KB |
Output is correct |
10 |
Correct |
2715 ms |
713448 KB |
Output is correct |
11 |
Correct |
447 ms |
202244 KB |
Output is correct |
12 |
Correct |
733 ms |
235924 KB |
Output is correct |
13 |
Correct |
752 ms |
258088 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
348 KB |
Output is correct |
2 |
Correct |
1 ms |
604 KB |
Output is correct |
3 |
Correct |
1 ms |
604 KB |
Output is correct |
4 |
Correct |
1 ms |
604 KB |
Output is correct |
5 |
Correct |
1 ms |
344 KB |
Output is correct |
6 |
Correct |
1 ms |
604 KB |
Output is correct |
7 |
Correct |
0 ms |
348 KB |
Output is correct |
8 |
Correct |
1 ms |
344 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 |
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 |
4 ms |
1876 KB |
Output is correct |
18 |
Correct |
4 ms |
2120 KB |
Output is correct |
19 |
Correct |
4 ms |
1876 KB |
Output is correct |
20 |
Correct |
3 ms |
1356 KB |
Output is correct |
21 |
Correct |
6 ms |
1872 KB |
Output is correct |
22 |
Correct |
5 ms |
1876 KB |
Output is correct |
23 |
Correct |
5 ms |
1708 KB |
Output is correct |
24 |
Correct |
3 ms |
860 KB |
Output is correct |
25 |
Correct |
21 ms |
13272 KB |
Output is correct |
26 |
Correct |
24 ms |
13348 KB |
Output is correct |
27 |
Correct |
22 ms |
16680 KB |
Output is correct |
28 |
Correct |
16 ms |
5944 KB |
Output is correct |
29 |
Correct |
28 ms |
12364 KB |
Output is correct |
30 |
Correct |
33 ms |
12836 KB |
Output is correct |
31 |
Correct |
28 ms |
14000 KB |
Output is correct |
32 |
Correct |
32 ms |
13348 KB |
Output is correct |
33 |
Correct |
245 ms |
86304 KB |
Output is correct |
34 |
Correct |
236 ms |
83560 KB |
Output is correct |
35 |
Correct |
201 ms |
85392 KB |
Output is correct |
36 |
Correct |
195 ms |
84412 KB |
Output is correct |
37 |
Correct |
393 ms |
157024 KB |
Output is correct |
38 |
Correct |
384 ms |
154868 KB |
Output is correct |
39 |
Correct |
386 ms |
156316 KB |
Output is correct |
40 |
Correct |
391 ms |
154244 KB |
Output is correct |
41 |
Correct |
160 ms |
51448 KB |
Output is correct |
42 |
Correct |
230 ms |
82268 KB |
Output is correct |
43 |
Correct |
494 ms |
154272 KB |
Output is correct |
44 |
Correct |
500 ms |
156056 KB |
Output is correct |
45 |
Correct |
230 ms |
78948 KB |
Output is correct |
46 |
Correct |
239 ms |
77792 KB |
Output is correct |
47 |
Correct |
459 ms |
156836 KB |
Output is correct |
48 |
Correct |
464 ms |
155424 KB |
Output is correct |
49 |
Correct |
183 ms |
149760 KB |
Output is correct |
50 |
Correct |
144 ms |
134364 KB |
Output is correct |
51 |
Correct |
159 ms |
147580 KB |
Output is correct |
52 |
Correct |
1 ms |
600 KB |
Output is correct |
53 |
Correct |
163 ms |
149816 KB |
Output is correct |
54 |
Correct |
163 ms |
149636 KB |
Output is correct |
55 |
Correct |
176 ms |
149732 KB |
Output is correct |
56 |
Correct |
190 ms |
149540 KB |
Output is correct |
57 |
Correct |
181 ms |
149464 KB |
Output is correct |
58 |
Correct |
0 ms |
344 KB |
Output is correct |
59 |
Correct |
1 ms |
348 KB |
Output is correct |
60 |
Correct |
0 ms |
348 KB |
Output is correct |
61 |
Correct |
1303 ms |
385628 KB |
Output is correct |
62 |
Correct |
2764 ms |
710548 KB |
Output is correct |
63 |
Correct |
2832 ms |
713008 KB |
Output is correct |
64 |
Correct |
2715 ms |
713448 KB |
Output is correct |
65 |
Correct |
447 ms |
202244 KB |
Output is correct |
66 |
Correct |
733 ms |
235924 KB |
Output is correct |
67 |
Correct |
752 ms |
258088 KB |
Output is correct |
68 |
Correct |
0 ms |
348 KB |
Output is correct |
69 |
Correct |
0 ms |
344 KB |
Output is correct |
70 |
Correct |
1 ms |
348 KB |
Output is correct |
71 |
Correct |
1 ms |
348 KB |
Output is correct |
72 |
Correct |
0 ms |
344 KB |
Output is correct |
73 |
Runtime error |
1672 ms |
1048576 KB |
Execution killed with signal 9 |
74 |
Halted |
0 ms |
0 KB |
- |