Submission
Status:
PPPPPPP--P
Subtask/Task Score:
80/100
Score: 80
User: Karatat007
Problemset: Weird Castle
Language: cpp
Time: 0.002 second
Submitted On: 2026-10-08 09:54:44
#include <bits/stdc++.h>
using namespace std;
int main(){
ios_base::sync_with_stdio(false);
cin.tie(nullptr);
int s,g;
cin >> s >> g;
int ys,xs,yg,xg;
ys = sqrt(s);
if(ys*ys < s) ys++;
yg= sqrt(g);
if(yg*yg < g) yg++;
xg = yg + g - yg*yg;
xs = ys + s - ys*ys;
cout << abs(ys-yg) + abs(xs-xg);
}