From 28ffe7cbfcfdb1fe9f0f265fc4d8de4ffa4da45d Mon Sep 17 00:00:00 2001 From: ShazidMahsrafi Date: Mon, 17 Jul 2023 00:54:43 +0600 Subject: [PATCH] update logic using tutorial --- 1848A Vika and Her Friends/1848A.cpp | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/1848A Vika and Her Friends/1848A.cpp b/1848A Vika and Her Friends/1848A.cpp index b58405b..74f002c 100644 --- a/1848A Vika and Her Friends/1848A.cpp +++ b/1848A Vika and Her Friends/1848A.cpp @@ -9,13 +9,14 @@ void solve() cin>>n>>m>>k; int x,y; cin>>x>>y; + int vika_color=(x+y)%2; bool caught=false; while(k--) { int p,q; cin>>p>>q; - int d=abs(x-p)+abs(y-q); - if(d%2==0) + int friend_color=(p+q)%2; + if(vika_color==friend_color) { caught=true; }