#include <bits/stdc++.h>
using namespace std;
#define rng(i,a,b) for(int i=int(a);i<=int(b);i++)
#define rep(i,b) rng(i,0,b-1)
#define gnr(i,b,a) for(int i=int(b);i>=int(a);i--)
#define per(i,b) gnr(i,b-1,0)
#define pb push_back
#define eb emplace_back
#define fi first
#define se second
#define bg begin()
#define ed end()
#define all(x) x.bg,x.ed
#define si(x) int(x.size())
template<class t> using vc=vector<t>;
template<class t> using vvc=vc<vc<t>>;
typedef long long ll;
using pii=pair<int,int>;
using vi=vc<int>;
using uint=unsigned;
using ull=unsigned long long;
using pil=pair<int,ll>;
using pli=pair<ll,int>;
using pll=pair<ll,ll>;
using t3=tuple<int,int,int>;
ll rand_int(ll l, ll r) { //[l, r]
#ifdef LOCAL
static mt19937_64 gen;
#else
static mt19937_64 gen(chrono::steady_clock::now().time_since_epoch().count());
#endif
return uniform_int_distribution<ll>(l, r)(gen);
}
template <uint MD> struct ModInt {
using M = ModInt;
const static M G;
uint v;
ModInt(ll _v = 0) { set_v(_v % MD + MD); }
M& set_v(uint _v) {
v = (_v < MD) ? _v : _v - MD;
return *this;
}
explicit operator bool() const { return v != 0; }
M operator-() const { return M() - *this; }
M operator+(const M& r) const { return M().set_v(v + r.v); }
M operator-(const M& r) const { return M().set_v(v + MD - r.v); }
M operator*(const M& r) const { return M().set_v(ull(v) * r.v % MD); }
M operator/(const M& r) const { return *this * r.inv(); }
M& operator+=(const M& r) { return *this = *this + r; }
M& operator-=(const M& r) { return *this = *this - r; }
M& operator*=(const M& r) { return *this = *this * r; }
M& operator/=(const M& r) { return *this = *this / r; }
bool operator==(const M& r) const { return v == r.v; }
M pow(ll n) const {
M x = *this, r = 1;
while (n) {
if (n & 1) r *= x;
x *= x;
n >>= 1;
}
return r;
}
M inv() const { return pow(MD - 2); }
friend ostream& operator<<(ostream& os, const M& r) { return os << r.v; }
};
using Mint = ModInt<998244353>;
template<> const Mint Mint::G = Mint(3);
using t4 = tuple<int,int,int,int>;
int H, W, n;
int res=2e9;
void Solve(){
scanf("%d%d",&H,&W);
scanf("%d",&n);
vc<pii>w(n);
set<int>SX, SY;
rep(i,n){
scanf("%d%d",&w[i].fi,&w[i].se);
SX.insert(w[i].fi);SX.insert(w[i].fi+H);
SY.insert(w[i].se);SY.insert(w[i].se+W);
}
vi X, Y;
for(auto &t: SX)X.pb(t);
for(auto &t: SY)Y.pb(t);
rep(i,n){
w[i].fi = lower_bound(all(X), w[i].fi) - X.begin();
w[i].se = lower_bound(all(Y), w[i].se) - Y.begin();
}
vi DX, DY;
rep(i,si(X)){
rng(j,i+1,si(X)-1)DX.pb(X[j]-X[i]);
}
rep(i,si(Y)){
rng(j,i+1,si(Y)-1)DY.pb(Y[j]-Y[i]);
}
sort(all(DX));
DX.resize(unique(all(DX)) - DX.begin());
sort(all(DY));
DY.resize(unique(all(DY)) - DY.begin());
int nX = si(X), nY = si(Y);
vi PX(n), PY(n);
vc<vi> S(nX,vi(nY));
rep(i,n){
PX[i] = w[i].fi;
PY[i] = nY-1;
}
vc<priority_queue<int>>PQ1(nX), PQ2(nX);
int mY = lower_bound(all(Y),W+1) - Y.begin();
auto add0 = [&](int x, int y){
if(y<=mY) PQ1[x].push(y);
else PQ2[x].push(-y);
};
auto getLeft = [&](int x){
while(!PQ1[x].empty()){
int y = PQ1[x].top();
if(!S[x][y])return y;
PQ1[x].pop();
}
return 0;
};
auto getRight = [&](int x){
while(!PQ2[x].empty()){
int y = -PQ2[x].top();
if(!S[x][y])return y;
PQ2[x].pop();
}
return nY;
};
ll ans = 1e10;
rng(i,1,nX-1){
rng(j,1,nY-1){
add0(i,j);
}
}
vi LL(nX), RR(nX), dL(nX), dR(nX);
int pdy = si(DY)-1, dy = DY.back();
for(auto &dx : DX){
rep(i,n){
int bx = w[i].fi;
int by = w[i].se;
while(PX[i] < nX - 1 && X[PX[i]+1] - X[bx] <= dx){
PX[i]++;
rng(j,by+1,PY[i]){
S[PX[i]][j]++;
}
}
}
while(1){
/*printf("! %d %d\n",dx,dy);
rng(i,1,nX-1){
rng(j,1,nY-1){
printf("%d",S[i][j]);
}
puts("");
}*/
rng(i,1,nX-1){
LL[i] = getLeft(i);
RR[i] = getRight(i);
if(LL[i]==mY)RR[i]=mY;
RR[i]--;
//printf("%d %d %d\n",LL[i],mY,RR[i]);
//printf("%d: %d %d\n",X[i],Y[LL[i]],Y[RR[i]]);
}
int hL=1, tL=0;
int hR=1, tR=0, CK=0;
rng(i,1,nX-1){
while(hL <= tL && X[i] - X[dL[hL]] >= H)hL++;
while(hL <= tL && LL[dL[tL]] <= LL[i])tL--;
dL[++tL] = i;
int l = LL[dL[hL]];
while(hR <= tR && X[i] - X[dR[hR]] >= H)hR++;
while(hR <= tR && RR[dR[tR]] >= RR[i])tR--;
dR[++tR] = i;
int r = RR[dR[hR]];
//printf("%d %d %d %d\n",X[i],X[0],Y[r],Y[l]);
if(X[i]-X[0] >= H && Y[r]-Y[l] >= W){
//printf("%d %d %d %d\n",dx,dy,Y[l],Y[r]);
ans = min(ans, (ll)dx+dy-2);
CK=1;
break;
}
}
if(!CK)break;
pdy--;
if(pdy<0)break;
dy = DY[pdy];
rep(i,n){
int bx = w[i].fi;
int by = w[i].se;
while(Y[PY[i]] - Y[by] > dy){
rng(j,bx+1,PX[i]){
S[j][PY[i]]--;
if(!S[j][PY[i]])add0(j,PY[i]);
}
PY[i]--;
}
}
}
if(pdy<0)break;
}
printf("%lld\n",ans);
}
int main(){
int TC=1;
while(TC--){
Solve();
}
}
Compilation message
cultivation.cpp: In function 'void Solve()':
cultivation.cpp:79:10: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
79 | scanf("%d%d",&H,&W);
| ~~~~~^~~~~~~~~~~~~~
cultivation.cpp:80:10: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
80 | scanf("%d",&n);
| ~~~~~^~~~~~~~~
cultivation.cpp:84:14: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
84 | scanf("%d%d",&w[i].fi,&w[i].se);
| ~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
348 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 |
348 KB |
Output is correct |
6 |
Correct |
0 ms |
348 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 |
0 ms |
344 KB |
Output is correct |
11 |
Correct |
0 ms |
348 KB |
Output is correct |
12 |
Correct |
0 ms |
348 KB |
Output is correct |
13 |
Correct |
0 ms |
348 KB |
Output is correct |
14 |
Correct |
0 ms |
344 KB |
Output is correct |
15 |
Correct |
0 ms |
348 KB |
Output is correct |
16 |
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 |
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 |
348 KB |
Output is correct |
6 |
Correct |
0 ms |
348 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 |
0 ms |
344 KB |
Output is correct |
11 |
Correct |
0 ms |
348 KB |
Output is correct |
12 |
Correct |
0 ms |
348 KB |
Output is correct |
13 |
Correct |
0 ms |
348 KB |
Output is correct |
14 |
Correct |
0 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 |
344 KB |
Output is correct |
18 |
Correct |
1 ms |
344 KB |
Output is correct |
19 |
Correct |
1 ms |
344 KB |
Output is correct |
20 |
Correct |
1 ms |
348 KB |
Output is correct |
21 |
Correct |
1 ms |
348 KB |
Output is correct |
22 |
Correct |
1 ms |
348 KB |
Output is correct |
23 |
Correct |
0 ms |
348 KB |
Output is correct |
24 |
Correct |
1 ms |
348 KB |
Output is correct |
25 |
Correct |
1 ms |
348 KB |
Output is correct |
26 |
Correct |
1 ms |
348 KB |
Output is correct |
27 |
Correct |
2 ms |
348 KB |
Output is correct |
28 |
Correct |
1 ms |
348 KB |
Output is correct |
29 |
Correct |
1 ms |
344 KB |
Output is correct |
30 |
Correct |
1 ms |
344 KB |
Output is correct |
31 |
Correct |
2 ms |
348 KB |
Output is correct |
32 |
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 |
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 |
348 KB |
Output is correct |
6 |
Correct |
0 ms |
348 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 |
0 ms |
344 KB |
Output is correct |
11 |
Correct |
0 ms |
348 KB |
Output is correct |
12 |
Correct |
0 ms |
348 KB |
Output is correct |
13 |
Correct |
0 ms |
348 KB |
Output is correct |
14 |
Correct |
0 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 |
344 KB |
Output is correct |
18 |
Correct |
1 ms |
344 KB |
Output is correct |
19 |
Correct |
1 ms |
344 KB |
Output is correct |
20 |
Correct |
1 ms |
348 KB |
Output is correct |
21 |
Correct |
1 ms |
348 KB |
Output is correct |
22 |
Correct |
1 ms |
348 KB |
Output is correct |
23 |
Correct |
0 ms |
348 KB |
Output is correct |
24 |
Correct |
1 ms |
348 KB |
Output is correct |
25 |
Correct |
1 ms |
348 KB |
Output is correct |
26 |
Correct |
1 ms |
348 KB |
Output is correct |
27 |
Correct |
2 ms |
348 KB |
Output is correct |
28 |
Correct |
1 ms |
348 KB |
Output is correct |
29 |
Correct |
1 ms |
344 KB |
Output is correct |
30 |
Correct |
1 ms |
344 KB |
Output is correct |
31 |
Correct |
2 ms |
348 KB |
Output is correct |
32 |
Correct |
1 ms |
348 KB |
Output is correct |
33 |
Correct |
90 ms |
1488 KB |
Output is correct |
34 |
Correct |
172 ms |
1492 KB |
Output is correct |
35 |
Correct |
10 ms |
980 KB |
Output is correct |
36 |
Correct |
154 ms |
1492 KB |
Output is correct |
37 |
Correct |
144 ms |
1632 KB |
Output is correct |
38 |
Correct |
157 ms |
1488 KB |
Output is correct |
39 |
Correct |
118 ms |
1592 KB |
Output is correct |
40 |
Correct |
154 ms |
1492 KB |
Output is correct |
41 |
Correct |
101 ms |
1744 KB |
Output is correct |
42 |
Correct |
15 ms |
980 KB |
Output is correct |
43 |
Correct |
153 ms |
1488 KB |
Output is correct |
44 |
Correct |
38 ms |
984 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 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 |
1 ms |
348 KB |
Output is correct |
9 |
Correct |
1 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 |
1 ms |
348 KB |
Output is correct |
15 |
Correct |
1 ms |
348 KB |
Output is correct |
16 |
Correct |
1 ms |
492 KB |
Output is correct |
17 |
Correct |
1 ms |
348 KB |
Output is correct |
18 |
Correct |
1 ms |
344 KB |
Output is correct |
19 |
Correct |
1 ms |
348 KB |
Output is correct |
20 |
Correct |
1 ms |
348 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 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 |
1 ms |
348 KB |
Output is correct |
9 |
Correct |
1 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 |
1 ms |
348 KB |
Output is correct |
15 |
Correct |
1 ms |
348 KB |
Output is correct |
16 |
Correct |
1 ms |
492 KB |
Output is correct |
17 |
Correct |
1 ms |
348 KB |
Output is correct |
18 |
Correct |
1 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 |
34 ms |
860 KB |
Output is correct |
22 |
Correct |
57 ms |
860 KB |
Output is correct |
23 |
Correct |
51 ms |
860 KB |
Output is correct |
24 |
Correct |
50 ms |
856 KB |
Output is correct |
25 |
Correct |
57 ms |
856 KB |
Output is correct |
26 |
Correct |
17 ms |
600 KB |
Output is correct |
27 |
Correct |
69 ms |
1112 KB |
Output is correct |
28 |
Correct |
57 ms |
856 KB |
Output is correct |
29 |
Correct |
58 ms |
996 KB |
Output is correct |
30 |
Correct |
58 ms |
1000 KB |
Output is correct |
31 |
Correct |
58 ms |
860 KB |
Output is correct |
32 |
Correct |
56 ms |
976 KB |
Output is correct |
33 |
Correct |
64 ms |
856 KB |
Output is correct |
34 |
Correct |
51 ms |
856 KB |
Output is correct |
35 |
Correct |
50 ms |
856 KB |
Output is correct |
36 |
Correct |
65 ms |
860 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
348 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 |
348 KB |
Output is correct |
6 |
Correct |
0 ms |
348 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 |
0 ms |
344 KB |
Output is correct |
11 |
Correct |
0 ms |
348 KB |
Output is correct |
12 |
Correct |
0 ms |
348 KB |
Output is correct |
13 |
Correct |
0 ms |
348 KB |
Output is correct |
14 |
Correct |
0 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 |
344 KB |
Output is correct |
18 |
Correct |
1 ms |
344 KB |
Output is correct |
19 |
Correct |
1 ms |
344 KB |
Output is correct |
20 |
Correct |
1 ms |
348 KB |
Output is correct |
21 |
Correct |
1 ms |
348 KB |
Output is correct |
22 |
Correct |
1 ms |
348 KB |
Output is correct |
23 |
Correct |
0 ms |
348 KB |
Output is correct |
24 |
Correct |
1 ms |
348 KB |
Output is correct |
25 |
Correct |
1 ms |
348 KB |
Output is correct |
26 |
Correct |
1 ms |
348 KB |
Output is correct |
27 |
Correct |
2 ms |
348 KB |
Output is correct |
28 |
Correct |
1 ms |
348 KB |
Output is correct |
29 |
Correct |
1 ms |
344 KB |
Output is correct |
30 |
Correct |
1 ms |
344 KB |
Output is correct |
31 |
Correct |
2 ms |
348 KB |
Output is correct |
32 |
Correct |
1 ms |
348 KB |
Output is correct |
33 |
Correct |
90 ms |
1488 KB |
Output is correct |
34 |
Correct |
172 ms |
1492 KB |
Output is correct |
35 |
Correct |
10 ms |
980 KB |
Output is correct |
36 |
Correct |
154 ms |
1492 KB |
Output is correct |
37 |
Correct |
144 ms |
1632 KB |
Output is correct |
38 |
Correct |
157 ms |
1488 KB |
Output is correct |
39 |
Correct |
118 ms |
1592 KB |
Output is correct |
40 |
Correct |
154 ms |
1492 KB |
Output is correct |
41 |
Correct |
101 ms |
1744 KB |
Output is correct |
42 |
Correct |
15 ms |
980 KB |
Output is correct |
43 |
Correct |
153 ms |
1488 KB |
Output is correct |
44 |
Correct |
38 ms |
984 KB |
Output is correct |
45 |
Correct |
1 ms |
344 KB |
Output is correct |
46 |
Correct |
1 ms |
348 KB |
Output is correct |
47 |
Correct |
1 ms |
348 KB |
Output is correct |
48 |
Correct |
1 ms |
348 KB |
Output is correct |
49 |
Correct |
1 ms |
348 KB |
Output is correct |
50 |
Correct |
1 ms |
348 KB |
Output is correct |
51 |
Correct |
1 ms |
348 KB |
Output is correct |
52 |
Correct |
1 ms |
348 KB |
Output is correct |
53 |
Correct |
1 ms |
348 KB |
Output is correct |
54 |
Correct |
1 ms |
348 KB |
Output is correct |
55 |
Correct |
1 ms |
348 KB |
Output is correct |
56 |
Correct |
1 ms |
348 KB |
Output is correct |
57 |
Correct |
0 ms |
348 KB |
Output is correct |
58 |
Correct |
1 ms |
348 KB |
Output is correct |
59 |
Correct |
1 ms |
348 KB |
Output is correct |
60 |
Correct |
1 ms |
492 KB |
Output is correct |
61 |
Correct |
1 ms |
348 KB |
Output is correct |
62 |
Correct |
1 ms |
344 KB |
Output is correct |
63 |
Correct |
1 ms |
348 KB |
Output is correct |
64 |
Correct |
1 ms |
348 KB |
Output is correct |
65 |
Correct |
34 ms |
860 KB |
Output is correct |
66 |
Correct |
57 ms |
860 KB |
Output is correct |
67 |
Correct |
51 ms |
860 KB |
Output is correct |
68 |
Correct |
50 ms |
856 KB |
Output is correct |
69 |
Correct |
57 ms |
856 KB |
Output is correct |
70 |
Correct |
17 ms |
600 KB |
Output is correct |
71 |
Correct |
69 ms |
1112 KB |
Output is correct |
72 |
Correct |
57 ms |
856 KB |
Output is correct |
73 |
Correct |
58 ms |
996 KB |
Output is correct |
74 |
Correct |
58 ms |
1000 KB |
Output is correct |
75 |
Correct |
58 ms |
860 KB |
Output is correct |
76 |
Correct |
56 ms |
976 KB |
Output is correct |
77 |
Correct |
64 ms |
856 KB |
Output is correct |
78 |
Correct |
51 ms |
856 KB |
Output is correct |
79 |
Correct |
50 ms |
856 KB |
Output is correct |
80 |
Correct |
65 ms |
860 KB |
Output is correct |
81 |
Correct |
611 ms |
3152 KB |
Output is correct |
82 |
Correct |
630 ms |
2948 KB |
Output is correct |
83 |
Correct |
750 ms |
3664 KB |
Output is correct |
84 |
Correct |
1062 ms |
3516 KB |
Output is correct |
85 |
Correct |
1612 ms |
5724 KB |
Output is correct |
86 |
Correct |
1565 ms |
5716 KB |
Output is correct |
87 |
Correct |
1105 ms |
4684 KB |
Output is correct |
88 |
Correct |
1425 ms |
5816 KB |
Output is correct |
89 |
Correct |
1430 ms |
5772 KB |
Output is correct |
90 |
Correct |
1235 ms |
4868 KB |
Output is correct |
91 |
Correct |
1442 ms |
5556 KB |
Output is correct |
92 |
Correct |
1611 ms |
5816 KB |
Output is correct |
93 |
Correct |
1382 ms |
5816 KB |
Output is correct |
94 |
Correct |
1432 ms |
5720 KB |
Output is correct |
95 |
Correct |
1568 ms |
5712 KB |
Output is correct |
96 |
Correct |
1598 ms |
5816 KB |
Output is correct |
97 |
Correct |
1252 ms |
5720 KB |
Output is correct |
98 |
Correct |
18 ms |
1492 KB |
Output is correct |