# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
154554 |
2019-09-22T17:18:41 Z |
liwi |
Rectangles (IOI19_rect) |
C++14 |
|
5000 ms |
1048576 KB |
#pragma GCC optimize("Ofast")
#pragma GCC optimize("unroll-loops")
#pragma GCC target("sse4,popcnt,abm,mmx,tune=native")
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace std;
using namespace __gnu_pbds;
typedef tree<int, null_type, less<int>, rb_tree_tag,tree_order_statistics_node_update> ordered_set;
#define scan(x) do{while((x=getchar())<'0'); for(x-='0'; '0'<=(_=getchar()); x=(x<<3)+(x<<1)+_-'0');}while(0)
char _;
#define complete_unique(a) a.erase(unique(a.begin(),a.end()),a.end())
#define all(a) a.begin(),a.end()
#define println printf("\n");
#define readln(x) getline(cin,x);
#define pb push_back
#define endl "\n"
#define INT_INF 0x3f3f3f3f
#define LL_INF 0x3f3f3f3f3f3f3f3f
#define MOD 1000000007
#define MOD2 1494318097
#define SEED 131
#define mp make_pair
#define fastio cin.tie(0); cin.sync_with_stdio(0);
#define MAXN 2501
typedef unsigned long long ull;
typedef long long ll;
typedef long double ld;
typedef unordered_map<int,int> umii;
typedef pair<int,int> pii;
typedef pair<double,double> pdd;
typedef pair<ll,ll> pll;
typedef pair<int,pii> triple;
typedef int8_t byte;
mt19937 g1(time(0));
int randint(int a, int b){return uniform_int_distribution<int>(a, b)(g1);}
ll randlong(ll a,ll b){return uniform_int_distribution<long long>(a, b)(g1);}
ll gcd(ll a, ll b){return b == 0 ? a : gcd(b, a % b);}
ll lcm(ll a, ll b){return a*b/gcd(a,b);}
ll fpow(ll b, ll exp, ll mod){if(exp == 0) return 1;ll t = fpow(b,exp/2,mod);if(exp&1) return t*t%mod*b%mod;return t*t%mod;}
ll divmod(ll i, ll j, ll mod){i%=mod,j%=mod;return i*fpow(j,mod-2,mod)%mod;}
int num_rows,num_cols,arr[MAXN][MAXN],bit[MAXN],cnt[MAXN][MAXN],ans,l,r,lst[MAXN][MAXN];
vector<pii> row_dp[MAXN][MAXN],col_dp[MAXN][MAXN];
pii dq[MAXN];
//vector<pii> rows[MAXN],cols[MAXN];
//vector<int> h_segs[MAXN][MAXN],v_segs[MAXN][MAXN];
//vector<int> r_range[MAXN][MAXN],v_range[MAXN][MAXN];
inline void update(int pos, int val){
for(int i=pos; i<=num_cols; i+=i&-i)
bit[i]+=val;
}
inline int query(int pos){
int res = 0;
for(int i=pos; i>0; i-=i&-i)
res+=bit[i];
return res;
}
inline void init_rows(){
// memset(cnt,0,sizeof cnt);
for(int i=2; i<num_rows; i++){
l = 1, r = 0;
for(int k=1; k<=num_cols; k++){
while(r-l+1 > 0 && dq[r].first < arr[i][k]) r--;
int lft = (r-l+1>0?dq[r].second:INT_INF);
if(lft < k-1 && (row_dp[lft+1][k-1].empty() || row_dp[lft+1][k-1].back().first != i))
row_dp[lft+1][k-1].emplace_back(i,i), cnt[lft+1][k-1]++; //rows[i].pb(mp(lft+1,k-1));
while(r-l+1 > 0 && dq[r].first == arr[i][k]) r--;
dq[++r] = mp(arr[i][k],k);
}
l = 1, r = 0;
for(int k=num_cols; k>=1; k--){
while(r-l+1 > 0 && dq[r].first < arr[i][k]) r--;
int rgt = (r-l+1>0?dq[r].second:-INT_INF);
if(rgt > k+1 && (row_dp[k+1][rgt-1].empty() || row_dp[k+1][rgt-1].back().first != i))
row_dp[k+1][rgt-1].emplace_back(i,i), cnt[k+1][rgt-1]++; //rows[i].pb(mp(k+1,rgt-1));
while(r-l+1 > 0 && dq[r].first == arr[i][k]) r--;
dq[++r] = mp(arr[i][k],k);
}
}
}
inline void init_cols(){
memset(cnt,0,sizeof cnt);
for(int i=2; i<num_cols; i++){
l = 1, r = 0;
for(int k=1; k<=num_rows; k++){
while(r-l+1 > 0 && dq[r].first < arr[k][i]) r--;
int lft = (r-l+1>0?dq[r].second:INT_INF);
if(lft < k-1 && (col_dp[lft+1][k-1].empty() || col_dp[lft+1][k-1].back().first != i))
col_dp[lft+1][k-1].emplace_back(i,i), cnt[lft+1][k-1]++; //cols[i].pb(mp(lft+1,k-1));
while(r-l+1 > 0 && dq[r].first == arr[k][i]) r--;
dq[++r] = mp(arr[k][i],k);
}
l = 1, r = 0;
for(int k=num_rows; k>=1; k--){
while(r-l+1 > 0 && dq[r].first < arr[k][i]) r--;
int rgt = (r-l+1>0?dq[r].second:-INT_INF);
if(rgt > k+1 && (col_dp[k+1][rgt-1].empty() || col_dp[k+1][rgt-1].back().first != i))
col_dp[k+1][rgt-1].emplace_back(i,i), cnt[k+1][rgt-1]++; //cols[i].pb(mp(k+1,rgt-1));
while(r-l+1 > 0 && dq[r].first == arr[k][i]) r--;
dq[++r] = mp(arr[k][i],k);
}
}
}
inline void calc_hor_dp(){
// for(int i=2; i<num_rows; i++){
// sort(all(rows[i])); complete_unique(rows[i]);
// for(pii check:rows[i]){
// h_segs[check.first][check.second].pb(i);
//// r_range[i][check.first].pb(check.second);
// }
// rows[i].clear();
// }
vector<pair<pii,int>> dep[MAXN];
for(int l=2; l<=num_cols-1; l++){
for(int r=l; r<=num_cols-1; r++){
if(cnt[l][r] == 0) continue;
vector<pii> &nums = row_dp[l][r];
// sort(all(nums)); complete_unique(nums);
// vector<pii> t;
int lst = 0;
for(int i=1; i<cnt[l][r]; i++){
if(nums[i].first == nums[i-1].first+1) continue;
for(int k=nums[lst].first; k<=nums[i-1].first; k++)
dep[nums[i-1].first-k+1].emplace_back(mp(k,l),r);
// row_dp[k][l].pb(mp(nums[i-1].first-k+1,r));
lst = i;
}
for(int k=nums[lst].first; k<=nums[cnt[l][r]-1].first; k++)
dep[nums[cnt[l][r]-1].first-k+1].emplace_back(mp(k,l),r);
// row_dp[k][l].pb(mp(nums[cnt[l][r]-1].first-k+1,r));
nums.clear();
}
}
for(int i=1; i<=num_rows; i++){
for(auto &check:dep[i])
row_dp[check.first.first][check.first.second].emplace_back(i,check.second);
}
// for(int l=2; l<=num_cols-1; l++){
// for(int r=l; r<=num_cols-1; r++){
// reverse(all(row_dp[l][r]));
// while(cnt[l][r]--) row_dp[l][r].pop_back();
// reverse(all(row_dp[l][r]));
// }
// }
}
inline void calc_col_dp(){
// for(int i=2; i<num_cols; i++){
// sort(all(cols[i])); complete_unique(cols[i]);
// for(pii check:cols[i]){
// v_segs[check.first][check.second].pb(i);
//// v_range[check.first][i].pb(check.second);
// }
// cols[i].clear();
// }
for(int l=2; l<=num_rows-1; l++){
for(int r=l; r<=num_rows-1; r++){
if(cnt[l][r] == 0) continue;
vector<pii> &nums = col_dp[l][r];
// sort(all(nums)); complete_unique(nums);
int lst = 0;
for(int i=1; i<cnt[l][r]; i++){
if(nums[i].first == nums[i-1].first+1) continue;
for(int k=nums[lst].first; k<=nums[i-1].first; k++)
col_dp[l][k].emplace_back(r,nums[i-1].first);
lst = i;
}
for(int k=nums[lst].first; k<=nums[cnt[l][r]-1].first; k++)
col_dp[l][k].emplace_back(r,nums[cnt[l][r]-1].first);
}
}
// for(int l=2; l<=num_cols-1; l++){
// for(int r=l; r<=num_cols-1; r++){
// reverse(all(col_dp[l][r]));
// while(cnt[l][r]--) col_dp[l][r].pop_back();
// reverse(all(col_dp[l][r]));
// }
// }
}
ll count_rectangles(vector<vector<int>> a){
ans = 0, num_rows = (int)a.size(), num_cols = (int)a[0].size();
for(int i=0; i<a.size(); i++)
for(int k=0; k<a[i].size(); k++)
arr[i+1][k+1] = a[i][k];
for(int i=2; i<num_rows; i++){
l = 1, r = 0;
for(int k=1; k<=num_cols; k++){
while(r-l+1 > 0 && dq[r].first < arr[i][k]) r--;
int lft = (r-l+1>0?dq[r].second:INT_INF);
if(lft < k-1 && (row_dp[lft+1][k-1].empty() || row_dp[lft+1][k-1].back().first != i))
row_dp[lft+1][k-1].emplace_back(i,i), cnt[lft+1][k-1]++; //rows[i].pb(mp(lft+1,k-1));
while(r-l+1 > 0 && dq[r].first == arr[i][k]) r--;
dq[++r] = mp(arr[i][k],k);
}
l = 1, r = 0;
for(int k=num_cols; k>=1; k--){
while(r-l+1 > 0 && dq[r].first < arr[i][k]) r--;
int rgt = (r-l+1>0?dq[r].second:-INT_INF);
if(rgt > k+1 && (row_dp[k+1][rgt-1].empty() || row_dp[k+1][rgt-1].back().first != i))
row_dp[k+1][rgt-1].emplace_back(i,i), cnt[k+1][rgt-1]++; //rows[i].pb(mp(k+1,rgt-1));
while(r-l+1 > 0 && dq[r].first == arr[i][k]) r--;
dq[++r] = mp(arr[i][k],k);
}
}
vector<pair<pii,int>> dep[MAXN];
for(int l=2; l<=num_cols-1; l++){
for(int r=l; r<=num_cols-1; r++){
if(cnt[l][r] == 0) continue;
vector<pii> &nums = row_dp[l][r];
// sort(all(nums)); complete_unique(nums);
// vector<pii> t;
int lst = 0;
for(int i=1; i<cnt[l][r]; i++){
if(nums[i].first == nums[i-1].first+1) continue;
for(int k=nums[lst].first; k<=nums[i-1].first; k++)
dep[nums[i-1].first-k+1].emplace_back(mp(k,l),r);
// row_dp[k][l].pb(mp(nums[i-1].first-k+1,r));
lst = i;
}
for(int k=nums[lst].first; k<=nums[cnt[l][r]-1].first; k++)
dep[nums[cnt[l][r]-1].first-k+1].emplace_back(mp(k,l),r);
// row_dp[k][l].pb(mp(nums[cnt[l][r]-1].first-k+1,r));
nums.clear();
}
}
for(int i=1; i<=num_rows; i++){
for(auto &check:dep[i])
row_dp[check.first.first][check.first.second].emplace_back(i,check.second);
}
memset(cnt,0,sizeof cnt);
for(int i=2; i<num_cols; i++){
l = 1, r = 0;
for(int k=1; k<=num_rows; k++){
while(r-l+1 > 0 && dq[r].first < arr[k][i]) r--;
int lft = (r-l+1>0?dq[r].second:INT_INF);
if(lft < k-1 && (col_dp[lft+1][k-1].empty() || col_dp[lft+1][k-1].back().first != i))
col_dp[lft+1][k-1].emplace_back(i,i), cnt[lft+1][k-1]++; //cols[i].pb(mp(lft+1,k-1));
while(r-l+1 > 0 && dq[r].first == arr[k][i]) r--;
dq[++r] = mp(arr[k][i],k);
}
l = 1, r = 0;
for(int k=num_rows; k>=1; k--){
while(r-l+1 > 0 && dq[r].first < arr[k][i]) r--;
int rgt = (r-l+1>0?dq[r].second:-INT_INF);
if(rgt > k+1 && (col_dp[k+1][rgt-1].empty() || col_dp[k+1][rgt-1].back().first != i))
col_dp[k+1][rgt-1].emplace_back(i,i), cnt[k+1][rgt-1]++; //cols[i].pb(mp(k+1,rgt-1));
while(r-l+1 > 0 && dq[r].first == arr[k][i]) r--;
dq[++r] = mp(arr[k][i],k);
}
}
for(int l=2; l<=num_rows-1; l++){
for(int r=l; r<=num_rows-1; r++){
if(cnt[l][r] == 0) continue;
vector<pii> &nums = col_dp[l][r];
// sort(all(nums)); complete_unique(nums);
int lst = 0;
for(int i=1; i<cnt[l][r]; i++){
if(nums[i].first == nums[i-1].first+1) continue;
for(int k=nums[lst].first; k<=nums[i-1].first; k++)
col_dp[l][k].emplace_back(r,nums[i-1].first);
lst = i;
}
for(int k=nums[lst].first; k<=nums[cnt[l][r]-1].first; k++)
col_dp[l][k].emplace_back(r,nums[cnt[l][r]-1].first);
}
}
// init_rows(); calc_hor_dp();
// init_cols(); calc_col_dp();
for(int i=num_rows-1; i>=2; i--){
for(int k=num_cols-1; k>=2; k--){
// sort(all(row_dp[i][k]));
// sort(all(col_dp[i][k]));
int ptr = cnt[i][k], res = 0, cc = 0;
for(int v=0; v<row_dp[i][k].size(); v++){
// pii curr = row_dp[i][k][v];
while(ptr < col_dp[i][k].size() && col_dp[i][k][ptr].first-i+1 <= row_dp[i][k][v].first){
// assert(col_dp[i][k][ptr].second>=k);
update(col_dp[i][k][ptr].second-k+1,1);
ptr++, cc++;
}
res+=cc-query(row_dp[i][k][v].second-k);
}
while(--ptr >= cnt[i][k]) update(col_dp[i][k][ptr].second-k+1,-1);
ans+=res;
}
}
return ans;
}
Compilation message
rect.cpp: In function 'll count_rectangles(std::vector<std::vector<int> >)':
rect.cpp:197:16: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
for(int i=0; i<a.size(); i++)
~^~~~~~~~~
rect.cpp:198:17: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
for(int k=0; k<a[i].size(); k++)
~^~~~~~~~~~~~
rect.cpp:301:18: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
for(int v=0; v<row_dp[i][k].size(); v++){
~^~~~~~~~~~~~~~~~~~~~
rect.cpp:303:15: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
while(ptr < col_dp[i][k].size() && col_dp[i][k][ptr].first-i+1 <= row_dp[i][k][v].first){
~~~~^~~~~~~~~~~~~~~~~~~~~
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
313 ms |
318760 KB |
Output is correct |
2 |
Correct |
317 ms |
318860 KB |
Output is correct |
3 |
Correct |
324 ms |
318840 KB |
Output is correct |
4 |
Correct |
327 ms |
318832 KB |
Output is correct |
5 |
Correct |
316 ms |
318808 KB |
Output is correct |
6 |
Correct |
314 ms |
318968 KB |
Output is correct |
7 |
Correct |
323 ms |
318864 KB |
Output is correct |
8 |
Correct |
335 ms |
318840 KB |
Output is correct |
9 |
Correct |
358 ms |
318968 KB |
Output is correct |
10 |
Correct |
321 ms |
318840 KB |
Output is correct |
11 |
Correct |
315 ms |
318800 KB |
Output is correct |
12 |
Correct |
313 ms |
318956 KB |
Output is correct |
13 |
Correct |
315 ms |
318632 KB |
Output is correct |
14 |
Correct |
312 ms |
318712 KB |
Output is correct |
15 |
Correct |
315 ms |
318712 KB |
Output is correct |
16 |
Correct |
312 ms |
318644 KB |
Output is correct |
17 |
Correct |
314 ms |
318712 KB |
Output is correct |
18 |
Correct |
314 ms |
318584 KB |
Output is correct |
19 |
Correct |
316 ms |
318916 KB |
Output is correct |
20 |
Correct |
315 ms |
318852 KB |
Output is correct |
21 |
Correct |
316 ms |
318712 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
313 ms |
318760 KB |
Output is correct |
2 |
Correct |
317 ms |
318860 KB |
Output is correct |
3 |
Correct |
324 ms |
318840 KB |
Output is correct |
4 |
Correct |
327 ms |
318832 KB |
Output is correct |
5 |
Correct |
316 ms |
318808 KB |
Output is correct |
6 |
Correct |
314 ms |
318968 KB |
Output is correct |
7 |
Correct |
323 ms |
318864 KB |
Output is correct |
8 |
Correct |
335 ms |
318840 KB |
Output is correct |
9 |
Correct |
358 ms |
318968 KB |
Output is correct |
10 |
Correct |
321 ms |
318840 KB |
Output is correct |
11 |
Correct |
315 ms |
318800 KB |
Output is correct |
12 |
Correct |
313 ms |
318956 KB |
Output is correct |
13 |
Correct |
315 ms |
318632 KB |
Output is correct |
14 |
Correct |
312 ms |
318712 KB |
Output is correct |
15 |
Correct |
315 ms |
318712 KB |
Output is correct |
16 |
Correct |
312 ms |
318644 KB |
Output is correct |
17 |
Correct |
318 ms |
319804 KB |
Output is correct |
18 |
Correct |
321 ms |
319736 KB |
Output is correct |
19 |
Correct |
315 ms |
319864 KB |
Output is correct |
20 |
Correct |
314 ms |
319224 KB |
Output is correct |
21 |
Correct |
315 ms |
319600 KB |
Output is correct |
22 |
Correct |
314 ms |
319572 KB |
Output is correct |
23 |
Correct |
314 ms |
319480 KB |
Output is correct |
24 |
Correct |
313 ms |
319224 KB |
Output is correct |
25 |
Correct |
314 ms |
318712 KB |
Output is correct |
26 |
Correct |
314 ms |
318584 KB |
Output is correct |
27 |
Correct |
316 ms |
318916 KB |
Output is correct |
28 |
Correct |
315 ms |
318852 KB |
Output is correct |
29 |
Correct |
316 ms |
318712 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
313 ms |
318760 KB |
Output is correct |
2 |
Correct |
317 ms |
318860 KB |
Output is correct |
3 |
Correct |
324 ms |
318840 KB |
Output is correct |
4 |
Correct |
327 ms |
318832 KB |
Output is correct |
5 |
Correct |
316 ms |
318808 KB |
Output is correct |
6 |
Correct |
314 ms |
318968 KB |
Output is correct |
7 |
Correct |
323 ms |
318864 KB |
Output is correct |
8 |
Correct |
335 ms |
318840 KB |
Output is correct |
9 |
Correct |
358 ms |
318968 KB |
Output is correct |
10 |
Correct |
321 ms |
318840 KB |
Output is correct |
11 |
Correct |
315 ms |
318800 KB |
Output is correct |
12 |
Correct |
313 ms |
318956 KB |
Output is correct |
13 |
Correct |
315 ms |
318632 KB |
Output is correct |
14 |
Correct |
312 ms |
318712 KB |
Output is correct |
15 |
Correct |
315 ms |
318712 KB |
Output is correct |
16 |
Correct |
312 ms |
318644 KB |
Output is correct |
17 |
Correct |
318 ms |
319804 KB |
Output is correct |
18 |
Correct |
321 ms |
319736 KB |
Output is correct |
19 |
Correct |
315 ms |
319864 KB |
Output is correct |
20 |
Correct |
314 ms |
319224 KB |
Output is correct |
21 |
Correct |
315 ms |
319600 KB |
Output is correct |
22 |
Correct |
314 ms |
319572 KB |
Output is correct |
23 |
Correct |
314 ms |
319480 KB |
Output is correct |
24 |
Correct |
313 ms |
319224 KB |
Output is correct |
25 |
Correct |
330 ms |
324012 KB |
Output is correct |
26 |
Correct |
330 ms |
324088 KB |
Output is correct |
27 |
Correct |
353 ms |
324116 KB |
Output is correct |
28 |
Correct |
325 ms |
321460 KB |
Output is correct |
29 |
Correct |
349 ms |
322976 KB |
Output is correct |
30 |
Correct |
334 ms |
323104 KB |
Output is correct |
31 |
Correct |
334 ms |
322864 KB |
Output is correct |
32 |
Correct |
348 ms |
322976 KB |
Output is correct |
33 |
Correct |
314 ms |
318712 KB |
Output is correct |
34 |
Correct |
314 ms |
318584 KB |
Output is correct |
35 |
Correct |
316 ms |
318916 KB |
Output is correct |
36 |
Correct |
315 ms |
318852 KB |
Output is correct |
37 |
Correct |
316 ms |
318712 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
313 ms |
318760 KB |
Output is correct |
2 |
Correct |
317 ms |
318860 KB |
Output is correct |
3 |
Correct |
324 ms |
318840 KB |
Output is correct |
4 |
Correct |
327 ms |
318832 KB |
Output is correct |
5 |
Correct |
316 ms |
318808 KB |
Output is correct |
6 |
Correct |
314 ms |
318968 KB |
Output is correct |
7 |
Correct |
323 ms |
318864 KB |
Output is correct |
8 |
Correct |
335 ms |
318840 KB |
Output is correct |
9 |
Correct |
358 ms |
318968 KB |
Output is correct |
10 |
Correct |
321 ms |
318840 KB |
Output is correct |
11 |
Correct |
315 ms |
318800 KB |
Output is correct |
12 |
Correct |
313 ms |
318956 KB |
Output is correct |
13 |
Correct |
315 ms |
318632 KB |
Output is correct |
14 |
Correct |
312 ms |
318712 KB |
Output is correct |
15 |
Correct |
315 ms |
318712 KB |
Output is correct |
16 |
Correct |
312 ms |
318644 KB |
Output is correct |
17 |
Correct |
318 ms |
319804 KB |
Output is correct |
18 |
Correct |
321 ms |
319736 KB |
Output is correct |
19 |
Correct |
315 ms |
319864 KB |
Output is correct |
20 |
Correct |
314 ms |
319224 KB |
Output is correct |
21 |
Correct |
315 ms |
319600 KB |
Output is correct |
22 |
Correct |
314 ms |
319572 KB |
Output is correct |
23 |
Correct |
314 ms |
319480 KB |
Output is correct |
24 |
Correct |
313 ms |
319224 KB |
Output is correct |
25 |
Correct |
330 ms |
324012 KB |
Output is correct |
26 |
Correct |
330 ms |
324088 KB |
Output is correct |
27 |
Correct |
353 ms |
324116 KB |
Output is correct |
28 |
Correct |
325 ms |
321460 KB |
Output is correct |
29 |
Correct |
349 ms |
322976 KB |
Output is correct |
30 |
Correct |
334 ms |
323104 KB |
Output is correct |
31 |
Correct |
334 ms |
322864 KB |
Output is correct |
32 |
Correct |
348 ms |
322976 KB |
Output is correct |
33 |
Correct |
505 ms |
356432 KB |
Output is correct |
34 |
Correct |
466 ms |
355172 KB |
Output is correct |
35 |
Correct |
462 ms |
355304 KB |
Output is correct |
36 |
Correct |
407 ms |
354276 KB |
Output is correct |
37 |
Correct |
527 ms |
380776 KB |
Output is correct |
38 |
Correct |
537 ms |
380636 KB |
Output is correct |
39 |
Correct |
610 ms |
381048 KB |
Output is correct |
40 |
Correct |
515 ms |
377412 KB |
Output is correct |
41 |
Correct |
441 ms |
340072 KB |
Output is correct |
42 |
Correct |
487 ms |
345000 KB |
Output is correct |
43 |
Correct |
661 ms |
362476 KB |
Output is correct |
44 |
Correct |
712 ms |
364772 KB |
Output is correct |
45 |
Correct |
486 ms |
343444 KB |
Output is correct |
46 |
Correct |
474 ms |
341856 KB |
Output is correct |
47 |
Correct |
666 ms |
361500 KB |
Output is correct |
48 |
Correct |
635 ms |
362648 KB |
Output is correct |
49 |
Correct |
314 ms |
318712 KB |
Output is correct |
50 |
Correct |
314 ms |
318584 KB |
Output is correct |
51 |
Correct |
316 ms |
318916 KB |
Output is correct |
52 |
Correct |
315 ms |
318852 KB |
Output is correct |
53 |
Correct |
316 ms |
318712 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
360 ms |
319112 KB |
Output is correct |
2 |
Correct |
321 ms |
319096 KB |
Output is correct |
3 |
Correct |
330 ms |
318840 KB |
Output is correct |
4 |
Correct |
322 ms |
318840 KB |
Output is correct |
5 |
Correct |
328 ms |
318968 KB |
Output is correct |
6 |
Correct |
323 ms |
319012 KB |
Output is correct |
7 |
Correct |
337 ms |
318976 KB |
Output is correct |
8 |
Correct |
329 ms |
319060 KB |
Output is correct |
9 |
Correct |
327 ms |
319136 KB |
Output is correct |
10 |
Correct |
326 ms |
318716 KB |
Output is correct |
11 |
Correct |
327 ms |
318800 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
313 ms |
318840 KB |
Output is correct |
2 |
Correct |
1156 ms |
430816 KB |
Output is correct |
3 |
Correct |
2282 ms |
559380 KB |
Output is correct |
4 |
Correct |
2292 ms |
560380 KB |
Output is correct |
5 |
Correct |
2316 ms |
560432 KB |
Output is correct |
6 |
Correct |
463 ms |
361200 KB |
Output is correct |
7 |
Correct |
657 ms |
400768 KB |
Output is correct |
8 |
Correct |
657 ms |
404376 KB |
Output is correct |
9 |
Correct |
314 ms |
318712 KB |
Output is correct |
10 |
Correct |
314 ms |
318584 KB |
Output is correct |
11 |
Correct |
316 ms |
318916 KB |
Output is correct |
12 |
Correct |
315 ms |
318852 KB |
Output is correct |
13 |
Correct |
316 ms |
318712 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
313 ms |
318760 KB |
Output is correct |
2 |
Correct |
317 ms |
318860 KB |
Output is correct |
3 |
Correct |
324 ms |
318840 KB |
Output is correct |
4 |
Correct |
327 ms |
318832 KB |
Output is correct |
5 |
Correct |
316 ms |
318808 KB |
Output is correct |
6 |
Correct |
314 ms |
318968 KB |
Output is correct |
7 |
Correct |
323 ms |
318864 KB |
Output is correct |
8 |
Correct |
335 ms |
318840 KB |
Output is correct |
9 |
Correct |
358 ms |
318968 KB |
Output is correct |
10 |
Correct |
321 ms |
318840 KB |
Output is correct |
11 |
Correct |
315 ms |
318800 KB |
Output is correct |
12 |
Correct |
313 ms |
318956 KB |
Output is correct |
13 |
Correct |
315 ms |
318632 KB |
Output is correct |
14 |
Correct |
312 ms |
318712 KB |
Output is correct |
15 |
Correct |
315 ms |
318712 KB |
Output is correct |
16 |
Correct |
312 ms |
318644 KB |
Output is correct |
17 |
Correct |
318 ms |
319804 KB |
Output is correct |
18 |
Correct |
321 ms |
319736 KB |
Output is correct |
19 |
Correct |
315 ms |
319864 KB |
Output is correct |
20 |
Correct |
314 ms |
319224 KB |
Output is correct |
21 |
Correct |
315 ms |
319600 KB |
Output is correct |
22 |
Correct |
314 ms |
319572 KB |
Output is correct |
23 |
Correct |
314 ms |
319480 KB |
Output is correct |
24 |
Correct |
313 ms |
319224 KB |
Output is correct |
25 |
Correct |
330 ms |
324012 KB |
Output is correct |
26 |
Correct |
330 ms |
324088 KB |
Output is correct |
27 |
Correct |
353 ms |
324116 KB |
Output is correct |
28 |
Correct |
325 ms |
321460 KB |
Output is correct |
29 |
Correct |
349 ms |
322976 KB |
Output is correct |
30 |
Correct |
334 ms |
323104 KB |
Output is correct |
31 |
Correct |
334 ms |
322864 KB |
Output is correct |
32 |
Correct |
348 ms |
322976 KB |
Output is correct |
33 |
Correct |
505 ms |
356432 KB |
Output is correct |
34 |
Correct |
466 ms |
355172 KB |
Output is correct |
35 |
Correct |
462 ms |
355304 KB |
Output is correct |
36 |
Correct |
407 ms |
354276 KB |
Output is correct |
37 |
Correct |
527 ms |
380776 KB |
Output is correct |
38 |
Correct |
537 ms |
380636 KB |
Output is correct |
39 |
Correct |
610 ms |
381048 KB |
Output is correct |
40 |
Correct |
515 ms |
377412 KB |
Output is correct |
41 |
Correct |
441 ms |
340072 KB |
Output is correct |
42 |
Correct |
487 ms |
345000 KB |
Output is correct |
43 |
Correct |
661 ms |
362476 KB |
Output is correct |
44 |
Correct |
712 ms |
364772 KB |
Output is correct |
45 |
Correct |
486 ms |
343444 KB |
Output is correct |
46 |
Correct |
474 ms |
341856 KB |
Output is correct |
47 |
Correct |
666 ms |
361500 KB |
Output is correct |
48 |
Correct |
635 ms |
362648 KB |
Output is correct |
49 |
Correct |
360 ms |
319112 KB |
Output is correct |
50 |
Correct |
321 ms |
319096 KB |
Output is correct |
51 |
Correct |
330 ms |
318840 KB |
Output is correct |
52 |
Correct |
322 ms |
318840 KB |
Output is correct |
53 |
Correct |
328 ms |
318968 KB |
Output is correct |
54 |
Correct |
323 ms |
319012 KB |
Output is correct |
55 |
Correct |
337 ms |
318976 KB |
Output is correct |
56 |
Correct |
329 ms |
319060 KB |
Output is correct |
57 |
Correct |
327 ms |
319136 KB |
Output is correct |
58 |
Correct |
326 ms |
318716 KB |
Output is correct |
59 |
Correct |
327 ms |
318800 KB |
Output is correct |
60 |
Correct |
313 ms |
318840 KB |
Output is correct |
61 |
Correct |
1156 ms |
430816 KB |
Output is correct |
62 |
Correct |
2282 ms |
559380 KB |
Output is correct |
63 |
Correct |
2292 ms |
560380 KB |
Output is correct |
64 |
Correct |
2316 ms |
560432 KB |
Output is correct |
65 |
Correct |
463 ms |
361200 KB |
Output is correct |
66 |
Correct |
657 ms |
400768 KB |
Output is correct |
67 |
Correct |
657 ms |
404376 KB |
Output is correct |
68 |
Correct |
3339 ms |
768752 KB |
Output is correct |
69 |
Correct |
2704 ms |
750660 KB |
Output is correct |
70 |
Correct |
2565 ms |
750700 KB |
Output is correct |
71 |
Correct |
1559 ms |
732448 KB |
Output is correct |
72 |
Correct |
3658 ms |
1048576 KB |
Output is correct |
73 |
Correct |
3355 ms |
638084 KB |
Output is correct |
74 |
Correct |
3704 ms |
680308 KB |
Output is correct |
75 |
Execution timed out |
5048 ms |
847088 KB |
Time limit exceeded |
76 |
Halted |
0 ms |
0 KB |
- |