prompt string | response string |
|---|---|
Problem: This year, as in previous years, MemSQL is inviting the top 25 competitors from the Start[c]up qualification round to compete onsite for the final round. Not everyone who is eligible to compete onsite can afford to travel to the office, though. Initially the top 25 contestants are invited to come onsite. Each ... | /**
* DA-IICT
* Author : Savaliya Sagar
*/
import java.io.*;
import java.math.*;
import java.util.*;
import static java.util.Arrays.fill;
import static java.lang.Math.*;
import static java.util.Arrays.sort;
import static java.util.Collections.sort;
public class A859
{
InputStream is;
PrintWriter out;
String INP... |
Problem: This year, as in previous years, MemSQL is inviting the top 25 competitors from the Start[c]up qualification round to compete onsite for the final round. Not everyone who is eligible to compete onsite can afford to travel to the office, though. Initially the top 25 contestants are invited to come onsite. Each ... | #include <bits/stdc++.h>
using namespace std;
int main() {
int k;
cin >> k;
long long ans = 0, temp = 0, zero = 0;
for (int i = 0; i < k; i++) {
cin >> temp;
ans = max(temp - 25, ans);
}
cout << ans;
return 0;
}
|
Problem: This year, as in previous years, MemSQL is inviting the top 25 competitors from the Start[c]up qualification round to compete onsite for the final round. Not everyone who is eligible to compete onsite can afford to travel to the office, though. Initially the top 25 contestants are invited to come onsite. Each ... | n = int(input())
l = list(map(int,input().split()))
l_max = max(l)
print(l_max-25 if l_max > 25 else 0)
|
Problem: Polycarp takes part in a quadcopter competition. According to the rules a flying robot should:
* start the race from some point of a field,
* go around the flag,
* close cycle returning back to the starting point.
Polycarp knows the coordinates of the starting point (x1, y1) and the coordinates of... | #include <bits/stdc++.h>
using namespace std;
int main() {
int q, w;
cin >> q >> w;
int qq, ww;
cin >> qq >> ww;
vector<pair<int, int>> vpp;
vpp.push_back(make_pair(qq - 1, ww + 1));
vpp.push_back(make_pair(qq, ww + 1));
vpp.push_back(make_pair(qq + 1, ww + 1));
vpp.push_back(make_pair(qq - 1, ww));
... |
Problem: Polycarp takes part in a quadcopter competition. According to the rules a flying robot should:
* start the race from some point of a field,
* go around the flag,
* close cycle returning back to the starting point.
Polycarp knows the coordinates of the starting point (x1, y1) and the coordinates of... | x1, y1 = map(int, input().split())
x2, y2 = map(int, input().split())
if x1 != x2 and y1 != y2:
ans = abs(x1 - x2) + abs(y1 - y2) + 2
print(ans * 2)
else:
ans = abs(x1 - x2) + abs(y1 - y2) + 3
print(ans * 2)
|
Problem: Polycarp takes part in a quadcopter competition. According to the rules a flying robot should:
* start the race from some point of a field,
* go around the flag,
* close cycle returning back to the starting point.
Polycarp knows the coordinates of the starting point (x1, y1) and the coordinates of... | import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.io.FilterInputStream;
import java.io.BufferedInputStream;
import java.io.InputStream;
/**
* Built using CHelper plug-in
* Actual solution is at the top
*
* @author Jenish
*/
public class Ma... |
Problem: Polycarp takes part in a quadcopter competition. According to the rules a flying robot should:
* start the race from some point of a field,
* go around the flag,
* close cycle returning back to the starting point.
Polycarp knows the coordinates of the starting point (x1, y1) and the coordinates of... | #include <bits/stdc++.h>
using namespace std;
void solve() {}
int main() {
ios_base::sync_with_stdio(false);
cin.tie(NULL);
long long tt = 1;
while (tt--) {
long long x1, y1, x2, y2, ans = 0;
cin >> x1 >> y1 >> x2 >> y2;
if (x1 != x2 && y1 != y2) {
ans += 2 * (abs(x2 - x1) + 1);
ans += 2... |
Problem: Polycarp takes part in a quadcopter competition. According to the rules a flying robot should:
* start the race from some point of a field,
* go around the flag,
* close cycle returning back to the starting point.
Polycarp knows the coordinates of the starting point (x1, y1) and the coordinates of... | x1, y1 = map(int, input().split())
x2, y2 = map(int, input().split())
dx = abs(x1 - x2)
dy = abs(y1 - y2)
if dx and dy:
print(2 * (dx + dy) + 4)
else:
print(2 * (dx + dy) + 6) |
Problem: Polycarp takes part in a quadcopter competition. According to the rules a flying robot should:
* start the race from some point of a field,
* go around the flag,
* close cycle returning back to the starting point.
Polycarp knows the coordinates of the starting point (x1, y1) and the coordinates of... | #include <bits/stdc++.h>
using namespace std;
int main() {
ios::sync_with_stdio(false);
cin.tie(nullptr);
int x1, y1, x2, y2;
cin >> x1 >> y1 >> x2 >> y2;
int ans = 8;
if (abs(x1 - x2) > 0) {
ans += (abs(x1 - x2) - 1) * 2;
}
if (abs(y1 - y2) > 0) {
ans += (abs(y1 - y2) - 1) * 2;
}
cout << an... |
Problem: Polycarp takes part in a quadcopter competition. According to the rules a flying robot should:
* start the race from some point of a field,
* go around the flag,
* close cycle returning back to the starting point.
Polycarp knows the coordinates of the starting point (x1, y1) and the coordinates of... | import java.util.*;
import java.math.*;
import java.io.*;
import java.text.DecimalFormat;
import java.math.BigInteger;
... |
Problem: Polycarp takes part in a quadcopter competition. According to the rules a flying robot should:
* start the race from some point of a field,
* go around the flag,
* close cycle returning back to the starting point.
Polycarp knows the coordinates of the starting point (x1, y1) and the coordinates of... | import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.Arrays;
import java.util.SplittableRandom;
import java.util.InputMismatchException;
import java.io.IOException;
import java.io.InputStream;
/**
* Built using CHelper plug-in
* Actual sol... |
Problem: Polycarp takes part in a quadcopter competition. According to the rules a flying robot should:
* start the race from some point of a field,
* go around the flag,
* close cycle returning back to the starting point.
Polycarp knows the coordinates of the starting point (x1, y1) and the coordinates of... | #include <bits/stdc++.h>
using namespace std;
const double PI = acos(-1.0);
const int inf = 0x3f3f3f3f;
const long long mod = 1e9 + 7;
const int maxn = 1000 + 50;
int a, b, c, d;
int main() {
while (~scanf("%d %d %d %d", &a, &b, &c, &d)) {
int ans;
if (a != c && b != d) {
if (a < c && b < d) {
a... |
Problem: Polycarp takes part in a quadcopter competition. According to the rules a flying robot should:
* start the race from some point of a field,
* go around the flag,
* close cycle returning back to the starting point.
Polycarp knows the coordinates of the starting point (x1, y1) and the coordinates of... | import java.io.*;
import java.util.*;
public class Main {
public static class InputReader {
public BufferedReader reader;
public StringTokenizer tokenizer;
public InputReader(InputStream stream) {
reader = new BufferedReader(new InputStreamReader(stream), 32768);
tokenizer = null;
}
public String n... |
Problem: Polycarp takes part in a quadcopter competition. According to the rules a flying robot should:
* start the race from some point of a field,
* go around the flag,
* close cycle returning back to the starting point.
Polycarp knows the coordinates of the starting point (x1, y1) and the coordinates of... | import sys
import math
#to read string
get_string = lambda: sys.stdin.readline().strip()
#to read list of integers
get_int_list = lambda: list( map(int,sys.stdin.readline().strip().split()) )
#to read integers
get_int = lambda: int(sys.stdin.readline())
#to print fast
pt = lambda x: sys.stdout.write(str(x)+'\n')
#---... |
Problem: Polycarp takes part in a quadcopter competition. According to the rules a flying robot should:
* start the race from some point of a field,
* go around the flag,
* close cycle returning back to the starting point.
Polycarp knows the coordinates of the starting point (x1, y1) and the coordinates of... | import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.io.IOException;
import java.io.InputStream;
/**
* Built using CHelper plug-in
* Actual solution is at the top
*
* @author Aman Kumar Singh
*/
public class Main {
public static void main... |
Problem: Polycarp takes part in a quadcopter competition. According to the rules a flying robot should:
* start the race from some point of a field,
* go around the flag,
* close cycle returning back to the starting point.
Polycarp knows the coordinates of the starting point (x1, y1) and the coordinates of... | #include <bits/stdc++.h>
using namespace std;
int main() {
int x1, y1, x2, y2;
cin >> x1 >> y1;
cin >> x2 >> y2;
int ans = 2 * (abs(x1 - x2) + 1 + abs(y1 - y2) + 1);
if (x1 != x2 && y1 != y2) {
cout << ans;
} else {
cout << ans + 2;
}
}
|
Problem: Polycarp takes part in a quadcopter competition. According to the rules a flying robot should:
* start the race from some point of a field,
* go around the flag,
* close cycle returning back to the starting point.
Polycarp knows the coordinates of the starting point (x1, y1) and the coordinates of... | #include <bits/stdc++.h>
using namespace std;
const int INF = 2034567891;
const long long int INF64 = 4234567890123456789ll;
long long int gcd(long long int a, long long int b) {
return (b == 0 ? a : gcd(b, a % b));
}
long long int lcm(long long int a, long long int b) {
return (a * (b / gcd(a, b)));
}
int main() {... |
Problem: Polycarp takes part in a quadcopter competition. According to the rules a flying robot should:
* start the race from some point of a field,
* go around the flag,
* close cycle returning back to the starting point.
Polycarp knows the coordinates of the starting point (x1, y1) and the coordinates of... | line1 = input()
line2 = input()
dc = [int(s) for s in line1.split(' ')]
fc = [int(s) for s in line2.split(' ')]
d = [abs(a - b) for a, b in zip(dc, fc)]
transit_x = max(2, d[0]+1)*2
transit_y = max(2, d[1]+1)*2
t = transit_x + transit_y
print(t) |
Problem: Polycarp takes part in a quadcopter competition. According to the rules a flying robot should:
* start the race from some point of a field,
* go around the flag,
* close cycle returning back to the starting point.
Polycarp knows the coordinates of the starting point (x1, y1) and the coordinates of... | #include <bits/stdc++.h>
using namespace std;
int main() {
int x1, y1, x2, y2;
int r, r1;
cin >> x1 >> y1 >> x2 >> y2;
if (x1 == x2) {
r = abs(y2 - y1) + 1;
cout << r * 2 + 4;
return 0;
}
if (y1 == y2) {
r = abs(x2 - x1) + 1;
cout << r * 2 + 4;
return 0;
}
r = abs(x2 - x1) + 1;
... |
Problem: Polycarp takes part in a quadcopter competition. According to the rules a flying robot should:
* start the race from some point of a field,
* go around the flag,
* close cycle returning back to the starting point.
Polycarp knows the coordinates of the starting point (x1, y1) and the coordinates of... | p1=list(map(int,input().split()))
p2=list(map(int,input().split()))
if(p1[0]!=p2[0] and p1[1]!=p2[1]):
ans=2*(abs(p1[0]-p2[0])+1)+2*(abs(p1[1]-p2[1])+1)
elif(p1[0]!=p2[0] and p1[1]==p2[1]):
ans=2*(abs(p1[0]-p2[0])+1)+4
else:
ans=ans=2*(abs(p1[1]-p2[1])+1)+4
print(ans)
|
Problem: Polycarp takes part in a quadcopter competition. According to the rules a flying robot should:
* start the race from some point of a field,
* go around the flag,
* close cycle returning back to the starting point.
Polycarp knows the coordinates of the starting point (x1, y1) and the coordinates of... | #include <bits/stdc++.h>
using namespace std;
int main() {
int x1, y1, x2, y2;
cin >> x1 >> y1 >> x2 >> y2;
int uppery = y2 + 1;
int lowery = y2 - 1;
int upperx = x2 + 1;
int lowerx = x2 - 1;
int ans = 4;
ans +=
abs(x1 - upperx) + abs(y1 - lowery) + abs(x1 - lowerx) + abs(y1 - uppery);
cout << a... |
Problem: Polycarp takes part in a quadcopter competition. According to the rules a flying robot should:
* start the race from some point of a field,
* go around the flag,
* close cycle returning back to the starting point.
Polycarp knows the coordinates of the starting point (x1, y1) and the coordinates of... | import sys, collections
def get_dist(a,b,c,d):
return abs(a - c) + abs(b - d)
x1, y1 = map(int, sys.stdin.readline().split())
x2, y2 = map(int, sys.stdin.readline().split())
if x1 == x2 and y1 != y2:
print(max(2 * get_dist(x1 - 1, y1, x2 + 1, y2 - 1), 2 * get_dist(x1 - 1, y1, x2 + 1, y2 + 1),
2... |
Problem: Polycarp takes part in a quadcopter competition. According to the rules a flying robot should:
* start the race from some point of a field,
* go around the flag,
* close cycle returning back to the starting point.
Polycarp knows the coordinates of the starting point (x1, y1) and the coordinates of... | #include <bits/stdc++.h>
using namespace std;
template <typename T>
using V = vector<T>;
template <typename T>
using VV = vector<V<T>>;
template <typename T>
istream& operator>>(istream& cin, V<T>& arr) {
for (T& val : arr) {
cin >> val;
}
return cin;
}
template <typename T>
ostream& operator<<(ostream& cout,... |
Problem: Polycarp takes part in a quadcopter competition. According to the rules a flying robot should:
* start the race from some point of a field,
* go around the flag,
* close cycle returning back to the starting point.
Polycarp knows the coordinates of the starting point (x1, y1) and the coordinates of... | #include <bits/stdc++.h>
using namespace std;
int main() {
ios_base::sync_with_stdio(0);
cin.tie(0);
int x1, y1, x2, y2;
cin >> x1 >> y1 >> x2 >> y2;
if (x1 == x2)
cout << abs(y1 - y2) * 2 + 2 + 4 << '\n';
else if (y1 == y2)
cout << abs(x1 - x2) * 2 + 2 + 4 << '\n';
else
cout << 2 * abs(x1 - x... |
Problem: Polycarp takes part in a quadcopter competition. According to the rules a flying robot should:
* start the race from some point of a field,
* go around the flag,
* close cycle returning back to the starting point.
Polycarp knows the coordinates of the starting point (x1, y1) and the coordinates of... | import java.io.*;
import java.util.*;
import java.math.*;
public class M {
public static void main(String args[]) {
try {
InputReader in = new InputReader(System.in);
BufferedWriter out = new BufferedWriter(new OutputStreamWriter(System.out));
int x = in.readInt();
... |
Problem: Polycarp takes part in a quadcopter competition. According to the rules a flying robot should:
* start the race from some point of a field,
* go around the flag,
* close cycle returning back to the starting point.
Polycarp knows the coordinates of the starting point (x1, y1) and the coordinates of... | import java.util.Scanner;
import static java.lang.Math.abs;
public class QuadcopterCompetition {
public static final Scanner SCANNER = new Scanner(System.in);
public static void main(String[] args) {
short x1 = SCANNER.nextShort(),
y1 = SCANNER.nextShort(),
x2 = SCANNE... |
Problem: Polycarp takes part in a quadcopter competition. According to the rules a flying robot should:
* start the race from some point of a field,
* go around the flag,
* close cycle returning back to the starting point.
Polycarp knows the coordinates of the starting point (x1, y1) and the coordinates of... | #include <bits/stdc++.h>
using namespace std;
int main() {
int a, b, c, d;
cin >> a >> b >> c >> d;
int t1, t2;
if (a == c)
t1 = 2;
else
t1 = abs(a - c) + 1;
if (b == d)
t2 = 2;
else
t2 = abs(b - d) + 1;
int t = 2 * (t1 + t2);
cout << t;
return 0;
}
|
Problem: Polycarp takes part in a quadcopter competition. According to the rules a flying robot should:
* start the race from some point of a field,
* go around the flag,
* close cycle returning back to the starting point.
Polycarp knows the coordinates of the starting point (x1, y1) and the coordinates of... |
import java.util.Scanner;
public class M {
static int dist(int x1, int y1, int x2, int y2) {
return Math.abs(x2 - x1) + Math.abs(y2 - y1);
}
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
int sx = sc.nextInt(), sy = sc.nextInt();
int ex = sc.nextInt(), ey = sc.nextInt();
... |
Problem: Polycarp takes part in a quadcopter competition. According to the rules a flying robot should:
* start the race from some point of a field,
* go around the flag,
* close cycle returning back to the starting point.
Polycarp knows the coordinates of the starting point (x1, y1) and the coordinates of... |
//
function abs(q)
{
if (q>0){return q;}
return -q
}
s=readline().split(' ').map(function(x){return +x;})
a=+s[0]
b=+s[1]
s=readline().split(' ').map(function(x){return +x;})
c=+s[0]
d=+s[1]
u=0
if (a==c||b==d)
{
u=2
}
print(abs(a-c)*2+abs(b-d)*2+4+u) |
Problem: Polycarp takes part in a quadcopter competition. According to the rules a flying robot should:
* start the race from some point of a field,
* go around the flag,
* close cycle returning back to the starting point.
Polycarp knows the coordinates of the starting point (x1, y1) and the coordinates of... | #include <bits/stdc++.h>
using namespace std;
int main() {
int x[] = {1, -1, 0, 0, 1, -1, 1, -1};
int y[] = {1, -1, -1, 1, 0, 0, -1, 1};
int x1, x2, y1, y2;
cin >> x1 >> y1 >> x2 >> y2;
int s = abs(x1 - x2 + x[0]) + abs(y1 - y2 + y[0]);
for (int i = 1; i < 8; i++) {
s = min(s, abs(x1 - x2 + x[i]) + abs(... |
Problem: Polycarp takes part in a quadcopter competition. According to the rules a flying robot should:
* start the race from some point of a field,
* go around the flag,
* close cycle returning back to the starting point.
Polycarp knows the coordinates of the starting point (x1, y1) and the coordinates of... | # M. Quadcopter Competition
x1,y1 = map(int,input().split())
x2,y2 = map(int,input().split())
if x1==x2:
p=2*abs(y1-y2)+6
elif y2==y1:
p=2*abs(x1-x2)+6
else:
p=abs(x1-x2)*2+abs(y1-y2)*2+4
print(p) |
Problem: Polycarp takes part in a quadcopter competition. According to the rules a flying robot should:
* start the race from some point of a field,
* go around the flag,
* close cycle returning back to the starting point.
Polycarp knows the coordinates of the starting point (x1, y1) and the coordinates of... | x1, y1 = map(int, raw_input().split())
x2, y2 = map(int, raw_input().split())
if x1 == x2:
x1 -= 1
if y1 == y2:
y1 -= 1
print (max(abs(x1 - x2 - 1), abs(x1 - x2 + 1)) + max(abs(y1 - y2 - 1), abs(y1 - y2 + 1))) * 2
|
Problem: Polycarp takes part in a quadcopter competition. According to the rules a flying robot should:
* start the race from some point of a field,
* go around the flag,
* close cycle returning back to the starting point.
Polycarp knows the coordinates of the starting point (x1, y1) and the coordinates of... | f = lambda: map(int, input().split())
print(2 * sum(max(1, abs(a - b)) + 1 for a, b in zip(f(), f()))) |
Problem: Polycarp takes part in a quadcopter competition. According to the rules a flying robot should:
* start the race from some point of a field,
* go around the flag,
* close cycle returning back to the starting point.
Polycarp knows the coordinates of the starting point (x1, y1) and the coordinates of... | x1,y1=map(int,input().split())
x2,y2=map(int,input().split())
if x1==x2:
print(4+(abs(y2-y1)+1)*2)
elif y1==y2:
print((abs(x2-x1)+1)*2+4)
else:
print((abs(x2-x1)+1)*2+(abs(y2-y1)+1)*2)
|
Problem: Polycarp takes part in a quadcopter competition. According to the rules a flying robot should:
* start the race from some point of a field,
* go around the flag,
* close cycle returning back to the starting point.
Polycarp knows the coordinates of the starting point (x1, y1) and the coordinates of... | import java.io.DataInputStream;
import java.io.FileInputStream;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.Scanner;
import java.util.StringTokenizer;
public class Main
{
static class Reader
{
final private int BUFFER_SIZE = 1 << 16;
private DataInputStream d... |
Problem: Polycarp takes part in a quadcopter competition. According to the rules a flying robot should:
* start the race from some point of a field,
* go around the flag,
* close cycle returning back to the starting point.
Polycarp knows the coordinates of the starting point (x1, y1) and the coordinates of... | x1, y1 = map(int, input().split())
x2, y2 = map(int, input().split())
print(2 * max(abs(x2 - x1), 1) + 2 * max(abs(y2 - y1), 1) + 4)
|
Problem: Polycarp takes part in a quadcopter competition. According to the rules a flying robot should:
* start the race from some point of a field,
* go around the flag,
* close cycle returning back to the starting point.
Polycarp knows the coordinates of the starting point (x1, y1) and the coordinates of... | #include <bits/stdc++.h>
using namespace std;
int main() {
int x1, x2, y1, y2, ans = 0;
scanf("%d%d%d%d", &x1, &y1, &x2, &y2);
ans = abs(x1 - x2) + 1 + abs(y1 - y2) + 1;
if (x1 == x2 or y1 == y2) ans++;
printf("%d", ans << 1);
}
|
Problem: Polycarp takes part in a quadcopter competition. According to the rules a flying robot should:
* start the race from some point of a field,
* go around the flag,
* close cycle returning back to the starting point.
Polycarp knows the coordinates of the starting point (x1, y1) and the coordinates of... | import java.util.Scanner;
public class QuadcopterCompetition {
public static void main(String[] args) {
Scanner scanner = new Scanner(System.in);
int x1 = scanner.nextInt();
int y1 = scanner.nextInt();
int x2 = scanner.nextInt();
int y2 = scanner.nextInt();
if (x1 == x2) {
x1 += 1;
} else if (... |
Problem: Polycarp takes part in a quadcopter competition. According to the rules a flying robot should:
* start the race from some point of a field,
* go around the flag,
* close cycle returning back to the starting point.
Polycarp knows the coordinates of the starting point (x1, y1) and the coordinates of... | import java.io.*;
import java.lang.reflect.Array;
import java.math.BigInteger;
import java.util.*;
import java.io.IOException;
import java.io.InputStream;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
import java.util.stream.Collector;
import java.util.stream.Collectors;
import java.util.stream.IntStr... |
Problem: Polycarp takes part in a quadcopter competition. According to the rules a flying robot should:
* start the race from some point of a field,
* go around the flag,
* close cycle returning back to the starting point.
Polycarp knows the coordinates of the starting point (x1, y1) and the coordinates of... | data1 = input().split()
data2 = input().split()
x1, y1 = int(data1[0]), int(data1[1])
x2, y2 = int(data2[0]), int(data2[1])
w = max(2, abs(x1-x2)+1)
h = max(2, abs(y1-y2)+1)
print(w*2+h*2)
|
Problem: Polycarp takes part in a quadcopter competition. According to the rules a flying robot should:
* start the race from some point of a field,
* go around the flag,
* close cycle returning back to the starting point.
Polycarp knows the coordinates of the starting point (x1, y1) and the coordinates of... | #include <bits/stdc++.h>
using namespace std;
int abs(int n) { return n > 0 ? n : -n; }
int main() {
int x1, x2, y1, y2;
cin >> x1 >> y1 >> x2 >> y2;
if (x1 == x2 || y1 == y2) {
cout << 2 * (abs(x2 - x1) + abs(y2 - y1)) + 6;
return 0;
}
cout << 2 * (abs(x2 - x1) + abs(y2 - y1)) + 4;
}
|
Problem: Polycarp takes part in a quadcopter competition. According to the rules a flying robot should:
* start the race from some point of a field,
* go around the flag,
* close cycle returning back to the starting point.
Polycarp knows the coordinates of the starting point (x1, y1) and the coordinates of... | #include <bits/stdc++.h>
using namespace std;
int main() {
int x1, y1, x2, y2 = 0;
cin >> x1 >> y1;
cin >> x2 >> y2;
if (x2 == x1) {
x2 += 2;
} else if (x2 > x1) {
x2 += 1;
} else {
x2 -= 1;
}
if (y2 == y1) {
y2 += 2;
} else if (y2 > y1) {
y2 += 1;
} else {
y2 -= 1;
}
cou... |
Problem: Polycarp takes part in a quadcopter competition. According to the rules a flying robot should:
* start the race from some point of a field,
* go around the flag,
* close cycle returning back to the starting point.
Polycarp knows the coordinates of the starting point (x1, y1) and the coordinates of... | #include <bits/stdc++.h>
using namespace std;
void solve() {
int a, b, c, d;
scanf("%d%d%d%d", &a, &b, &c, &d);
int dx = abs(a - c), dy = abs(b - d);
printf("%d\n", max(dx + 1, 2) * 2 + max(dy + 1, 2) * 2);
}
int main() {
int Tc = 1;
for (int tc = 1; tc <= Tc; tc++) {
solve();
}
return 0;
}
|
Problem: Polycarp takes part in a quadcopter competition. According to the rules a flying robot should:
* start the race from some point of a field,
* go around the flag,
* close cycle returning back to the starting point.
Polycarp knows the coordinates of the starting point (x1, y1) and the coordinates of... | #include <bits/stdc++.h>
using namespace std;
int main() {
int x1, y1, x2, y2;
cin >> x1 >> y1 >> x2 >> y2;
int ans1 = 0, ans2 = 0;
if (x1 == x2)
ans1 = 2;
else
ans1 = abs(x1 - x2) + 1;
if (y1 == y2)
ans2 = 2;
else
ans2 = abs(y1 - y2) + 1;
cout << 2 * (ans1 + ans2) << endl;
return 0;
}... |
Problem: Polycarp takes part in a quadcopter competition. According to the rules a flying robot should:
* start the race from some point of a field,
* go around the flag,
* close cycle returning back to the starting point.
Polycarp knows the coordinates of the starting point (x1, y1) and the coordinates of... | import java.util.Scanner;
public class Main {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
int s1 = sc.nextInt(), s2 = sc.nextInt(), f1 = sc.nextInt(), f2 = sc.nextInt();
int a = Math.abs(s1 - f1) + 1, b = Math.abs(s2 - f2) + 1;
if (a == 1) {
... |
Problem: Polycarp takes part in a quadcopter competition. According to the rules a flying robot should:
* start the race from some point of a field,
* go around the flag,
* close cycle returning back to the starting point.
Polycarp knows the coordinates of the starting point (x1, y1) and the coordinates of... | #include <bits/stdc++.h>
using namespace std;
int main() {
int a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p, q;
scanf("%d %d %d %d", &a, &b, &c, &d);
e = (max(abs(a - c) + 1, 2) + max(abs(b - d) + 1, 2)) * 2;
printf("%d\n", e);
return 0;
}
|
Problem: Polycarp takes part in a quadcopter competition. According to the rules a flying robot should:
* start the race from some point of a field,
* go around the flag,
* close cycle returning back to the starting point.
Polycarp knows the coordinates of the starting point (x1, y1) and the coordinates of... | def delta(a, b): return max(1, abs(a - b))
x1, y1 = [int(s) for s in input().split()]
x2, y2 = [int(s) for s in input().split()]
print(2 * (delta(x1, x2) + 1) + 2 * (delta(y1, y2) + 1))
|
Problem: Polycarp takes part in a quadcopter competition. According to the rules a flying robot should:
* start the race from some point of a field,
* go around the flag,
* close cycle returning back to the starting point.
Polycarp knows the coordinates of the starting point (x1, y1) and the coordinates of... | #include <bits/stdc++.h>
using namespace std;
int main() {
int x1, y1, x2, y2;
cin >> x1 >> y1 >> x2 >> y2;
if (x1 < x2 && y1 > y2)
cout << 2 * (y1 - y2 + x2 - x1) + 4;
else if (x1 > x2 && y1 < y2)
cout << 2 * (y2 - y1 + x1 - x2) + 4;
else if (x1 == x2 && y1 < y2)
cout << 2 * (2 + y2 - y1 + 1);
... |
Problem: Polycarp takes part in a quadcopter competition. According to the rules a flying robot should:
* start the race from some point of a field,
* go around the flag,
* close cycle returning back to the starting point.
Polycarp knows the coordinates of the starting point (x1, y1) and the coordinates of... | sa,sb = map(int,input().split())
a,b = map(int,input().split())
print(2 * (max(abs(sa-a)+1, 2) + max(abs(sb-b)+1, 2))) |
Problem: Polycarp takes part in a quadcopter competition. According to the rules a flying robot should:
* start the race from some point of a field,
* go around the flag,
* close cycle returning back to the starting point.
Polycarp knows the coordinates of the starting point (x1, y1) and the coordinates of... | import sys
x1,y1=list(map(int,(raw_input().strip().split())))
x2,y2=list(map(int,(raw_input().strip().split())))
s=0
if(x1==x2 or y1==y2):
s+=2;
print s+4+2*(abs(x1-x2)+abs(y1-y2))
|
Problem: Polycarp takes part in a quadcopter competition. According to the rules a flying robot should:
* start the race from some point of a field,
* go around the flag,
* close cycle returning back to the starting point.
Polycarp knows the coordinates of the starting point (x1, y1) and the coordinates of... | import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.*;
import java.io.BufferedReader;
import java.io.InputStreamReader;
public class Main {
public static void main(String[] args) {
InputStream inputStream = System.in;
Out... |
Problem: Polycarp takes part in a quadcopter competition. According to the rules a flying robot should:
* start the race from some point of a field,
* go around the flag,
* close cycle returning back to the starting point.
Polycarp knows the coordinates of the starting point (x1, y1) and the coordinates of... | import java.io.PrintWriter;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.Comparator;
import java.util.HashSet;
import java.util.Scanner;
import java.util.Stack;
public class B348 {
/**
* @param args
*/
static long min;
public static void main(String[] a... |
Problem: Polycarp takes part in a quadcopter competition. According to the rules a flying robot should:
* start the race from some point of a field,
* go around the flag,
* close cycle returning back to the starting point.
Polycarp knows the coordinates of the starting point (x1, y1) and the coordinates of... |
import java.io.*;
import java.util.*;
import java.util.concurrent.ForkJoinTask;
public class Main {
public static HashSet<String> st = new HashSet<>();
// It computes all the subsequence of an string
public static Set subsequence(String str)
{
// iterate over the entire string
for (int... |
Problem: Polycarp takes part in a quadcopter competition. According to the rules a flying robot should:
* start the race from some point of a field,
* go around the flag,
* close cycle returning back to the starting point.
Polycarp knows the coordinates of the starting point (x1, y1) and the coordinates of... | x1,y1=map(int,input().split())
x2,y2=map(int,input().split())
dx=max(2,abs(x1-x2)+1)
dy=max(2,abs(y1-y2)+1)
print(2*dx+2*dy) |
Problem: Polycarp takes part in a quadcopter competition. According to the rules a flying robot should:
* start the race from some point of a field,
* go around the flag,
* close cycle returning back to the starting point.
Polycarp knows the coordinates of the starting point (x1, y1) and the coordinates of... | import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.util.*;
public class Solution {
public static void main(String[] args) {
InputReader in = new InputReader();
PrintWriter out = new PrintWriter(System.out);
Thread th = new Thread... |
Problem: Polycarp takes part in a quadcopter competition. According to the rules a flying robot should:
* start the race from some point of a field,
* go around the flag,
* close cycle returning back to the starting point.
Polycarp knows the coordinates of the starting point (x1, y1) and the coordinates of... | #include <bits/stdc++.h>
using namespace std;
int main() {
int x1, y1, x2, y2;
cin >> x1 >> y1 >> x2 >> y2;
if (x1 == x2 || y1 == y2)
cout << 2 * (abs(x1 - x2) + 1) + 2 * (abs(y1 - y2) + 2);
else
cout << 2 * (abs(x1 - x2) + 1) + 2 * (abs(y1 - y2) + 2) - 2;
return 0;
}
|
Problem: Polycarp takes part in a quadcopter competition. According to the rules a flying robot should:
* start the race from some point of a field,
* go around the flag,
* close cycle returning back to the starting point.
Polycarp knows the coordinates of the starting point (x1, y1) and the coordinates of... | #include <bits/stdc++.h>
using namespace std;
using LL = long long;
constexpr int N = 1e5 + 5;
int main() {
ios::sync_with_stdio(false);
cin.tie(nullptr);
int x1, y1, x2, y2;
cin >> x1 >> y1 >> x2 >> y2;
int a = max(2, abs(x1 - x2) + 1);
int b = max(2, abs(y1 - y2) + 1);
cout << 2 * (a + b) << endl;
}
|
Problem: Polycarp takes part in a quadcopter competition. According to the rules a flying robot should:
* start the race from some point of a field,
* go around the flag,
* close cycle returning back to the starting point.
Polycarp knows the coordinates of the starting point (x1, y1) and the coordinates of... | #include <bits/stdc++.h>
using namespace std;
int main() {
int x1, y1, x2, y2, x, y;
cin >> x1 >> y1 >> x2 >> y2;
if (x1 == x2)
x = 2;
else
(x = abs(x1 - x2) + 1);
if (y1 == y2)
y = 2;
else
(y = abs(y1 - y2) + 1);
cout << 2 * (x + y);
return 0;
}
|
Problem: Polycarp takes part in a quadcopter competition. According to the rules a flying robot should:
* start the race from some point of a field,
* go around the flag,
* close cycle returning back to the starting point.
Polycarp knows the coordinates of the starting point (x1, y1) and the coordinates of... | #include <bits/stdc++.h>
using namespace std;
bool inLines(int x1, int y1, int x2, int y2) {
if (abs(x1 - x2) <= 1) return true;
return abs(y1 - y2) <= 1;
}
int main() {
int x1, y1;
int x2, y2;
cin >> x1 >> y1;
cin >> x2 >> y2;
if (inLines(x1, y1, x2, y2)) {
cout << 8 + 2 * (max(abs(x1 - x2), abs(y1 -... |
Problem: Polycarp takes part in a quadcopter competition. According to the rules a flying robot should:
* start the race from some point of a field,
* go around the flag,
* close cycle returning back to the starting point.
Polycarp knows the coordinates of the starting point (x1, y1) and the coordinates of... | x1, y1 = map(int, input().split())
x2, y2 = map(int, input().split())
if x1 == x2 and y1 == y2:
print(8)
if y1 == y2:
print(((abs(x1 - x2) + 1) * 2) + 4)
elif x1 == x2:
print(((abs(y1 - y2) + 1) * 2) + 4)
else:
distx = abs(x1 - x2) + 1
disty = abs(y1 - y2) + 1
print(2 * distx + 2 * disty) |
Problem: Polycarp takes part in a quadcopter competition. According to the rules a flying robot should:
* start the race from some point of a field,
* go around the flag,
* close cycle returning back to the starting point.
Polycarp knows the coordinates of the starting point (x1, y1) and the coordinates of... | x1,y1 = map(int,raw_input().split())
x2,y2 = map(int,raw_input().split())
ans = (abs(x2-x1) + 1 + abs(y2-y1)+1)*2
if(x2==x1 or y2==y1):
ans+=2
print ans |
Problem: Polycarp takes part in a quadcopter competition. According to the rules a flying robot should:
* start the race from some point of a field,
* go around the flag,
* close cycle returning back to the starting point.
Polycarp knows the coordinates of the starting point (x1, y1) and the coordinates of... | #include <bits/stdc++.h>
using namespace std;
int main() {
int a, b, aa, bb, ans = 0;
cin >> a >> b >> aa >> bb;
if (a == aa)
ans += 4;
else if (b == bb)
ans += 4;
if (a > aa) {
aa--;
} else if (a < aa) {
aa++;
}
if (b > bb) {
bb--;
} else if (b < bb) {
bb++;
}
cout << (2 *... |
Problem: Polycarp takes part in a quadcopter competition. According to the rules a flying robot should:
* start the race from some point of a field,
* go around the flag,
* close cycle returning back to the starting point.
Polycarp knows the coordinates of the starting point (x1, y1) and the coordinates of... | a, b = input().split(" ")
x, y = input().split(" ")
a = int(a)
b = int(b)
x = int(x)
y = int(y)
x_ = 0
y_ = 0
if(x == a):
x_ = 2
y_ = abs(y-b)+1
elif(y == b):
x_ = abs(x-a)+1
y_ = 2
else:
y_ = abs(y-b)+1
x_ = abs(x-a)+1
print(2*(x_ + y_)) |
Problem: Polycarp takes part in a quadcopter competition. According to the rules a flying robot should:
* start the race from some point of a field,
* go around the flag,
* close cycle returning back to the starting point.
Polycarp knows the coordinates of the starting point (x1, y1) and the coordinates of... | #include <bits/stdc++.h>
using namespace std;
int main() {
ios_base::sync_with_stdio(false);
cin.tie(0);
long long x1, x2, y1, y2;
cin >> x1 >> y1 >> x2 >> y2;
if (x1 == x2) x2++;
if (y1 == y2) y2++;
long long answ = (abs(x1 - (x2 + 1)) + abs(y1 - (y2 + 1))) * 2;
answ = max(answ, (abs(x1 - (x2 + 1)) + a... |
Problem: Polycarp takes part in a quadcopter competition. According to the rules a flying robot should:
* start the race from some point of a field,
* go around the flag,
* close cycle returning back to the starting point.
Polycarp knows the coordinates of the starting point (x1, y1) and the coordinates of... | #include <bits/stdc++.h>
using namespace std;
int main() {
int x1, x2, y1, y2;
int c = 0;
cin >> x1 >> y1 >> x2 >> y2;
int tmp;
tmp = x1 - x2;
if (tmp == 0)
tmp = tmp + 1;
else {
if (tmp < 0) tmp = -tmp;
}
tmp++;
c += (tmp * 2);
tmp = y1 - y2;
if (tmp == 0)
tmp = tmp + 1;
else {
... |
Problem: Polycarp takes part in a quadcopter competition. According to the rules a flying robot should:
* start the race from some point of a field,
* go around the flag,
* close cycle returning back to the starting point.
Polycarp knows the coordinates of the starting point (x1, y1) and the coordinates of... | import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.StringTokenizer;
import java.io.IOException;
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.io.InputStream;
/**
* Built using CHelper plug-in
* Actual soluti... |
Problem: Polycarp takes part in a quadcopter competition. According to the rules a flying robot should:
* start the race from some point of a field,
* go around the flag,
* close cycle returning back to the starting point.
Polycarp knows the coordinates of the starting point (x1, y1) and the coordinates of... | a,b = map( int, input().split())
c,d = map(int, input().split())
k = 0
if c==a or b==d : k=2
print((abs(c-a)+1)*2 + 2*(abs(b-d)+1)+k) |
Problem: Polycarp takes part in a quadcopter competition. According to the rules a flying robot should:
* start the race from some point of a field,
* go around the flag,
* close cycle returning back to the starting point.
Polycarp knows the coordinates of the starting point (x1, y1) and the coordinates of... | import java.util.Scanner;
public class Quadcopter{
public static void main(String args[]){
Scanner sc=new Scanner(System.in);
int x1=sc.nextInt();
int y1=sc.nextInt();
//sc.nextLine();
int x2=sc.nextInt();
int y2=sc.nextInt();
int verticalDistance=Math.abs(x2-x1)+1;
int horizontalDis... |
Problem: Polycarp takes part in a quadcopter competition. According to the rules a flying robot should:
* start the race from some point of a field,
* go around the flag,
* close cycle returning back to the starting point.
Polycarp knows the coordinates of the starting point (x1, y1) and the coordinates of... | import java.util.Arrays;
import java.util.Scanner;
public class cf
{
static int n;
static int arr[];
public static void main(String args[])
{
Scanner sc = new Scanner(System.in);
int x1= sc.nextInt();
int y1= sc.nextInt();
int x2= sc.nextInt();
int y2= sc.nextInt();
in... |
Problem: Polycarp takes part in a quadcopter competition. According to the rules a flying robot should:
* start the race from some point of a field,
* go around the flag,
* close cycle returning back to the starting point.
Polycarp knows the coordinates of the starting point (x1, y1) and the coordinates of... | #include <bits/stdc++.h>
using namespace std;
int xs[8] = {1, 1, 1, 0, 0, -1, -1, -1};
int ys[8] = {-1, 0, 1, -1, 1, -1, 0, 1};
int main() {
ios_base::sync_with_stdio(false);
cin.tie(0);
int x1, y1, x2, y2;
cin >> x1 >> y1;
cin >> x2 >> y2;
int nx, ny;
int mV = INT_MAX;
for (int i = 0; i < 8; i++) {
... |
Problem: Polycarp takes part in a quadcopter competition. According to the rules a flying robot should:
* start the race from some point of a field,
* go around the flag,
* close cycle returning back to the starting point.
Polycarp knows the coordinates of the starting point (x1, y1) and the coordinates of... | a = tuple(map(int, input().split()))
b = tuple(map(int, input().split()))
x = abs(a[0] - b[0])
y = abs(a[1] - b[1])
if x == 0:
x += 2
else:
x += 1
if y == 0:
y += 2
else:
y += 1
print(2*(x + y))
|
Problem: Polycarp takes part in a quadcopter competition. According to the rules a flying robot should:
* start the race from some point of a field,
* go around the flag,
* close cycle returning back to the starting point.
Polycarp knows the coordinates of the starting point (x1, y1) and the coordinates of... | import java.io.IOException;
import java.util.ArrayList;
import java.util.Scanner;
public class codforces {
public static void main(String args[]) throws IOException {
Scanner sc = new Scanner(System.in);
long somme = 0 ;
long x1 = sc.nextLong();
long y1 = sc.nextLong();
long x2 = sc.nextLong... |
Problem: Polycarp takes part in a quadcopter competition. According to the rules a flying robot should:
* start the race from some point of a field,
* go around the flag,
* close cycle returning back to the starting point.
Polycarp knows the coordinates of the starting point (x1, y1) and the coordinates of... | x1,y1=map(int,input().split())
x2,y2=map(int,input().split())
if(x1==x2):
print(2*(3+abs(y2-y1)))
elif(y1==y2):
print(2*(abs(x2-x1)+3))
else:
print(2*(2+abs(x2-x1)+abs(y2-y1))) |
Problem: Polycarp takes part in a quadcopter competition. According to the rules a flying robot should:
* start the race from some point of a field,
* go around the flag,
* close cycle returning back to the starting point.
Polycarp knows the coordinates of the starting point (x1, y1) and the coordinates of... | #include <bits/stdc++.h>
using namespace std;
template <class T>
T min3(T a, T b, T c) {
return min(a, min(b, c));
};
template <class T>
T max3(T a, T b, T c) {
return max(a, max(b, c));
};
void openFile() {
freopen("/home/khaihanhdk/MyWorkplace/cpp file/a.inp", "r", stdin);
}
int main() {
int x, y;
int h, k;... |
Problem: Polycarp takes part in a quadcopter competition. According to the rules a flying robot should:
* start the race from some point of a field,
* go around the flag,
* close cycle returning back to the starting point.
Polycarp knows the coordinates of the starting point (x1, y1) and the coordinates of... | #include <bits/stdc++.h>
using namespace std;
int main() {
int x1, y1, x2, y2;
cin >> x1 >> y1 >> x2 >> y2;
if (x1 == x2)
cout << ((abs(y1 - y2) + 3) << 1);
else if (y1 == y2)
cout << ((abs(x1 - x2) + 3) << 1);
else
cout << ((abs(y1 - y2) - 1) << 1) + ((abs(x1 - x2) + 3) << 1);
return 0;
}
|
Problem: Polycarp takes part in a quadcopter competition. According to the rules a flying robot should:
* start the race from some point of a field,
* go around the flag,
* close cycle returning back to the starting point.
Polycarp knows the coordinates of the starting point (x1, y1) and the coordinates of... | x1,y1=[int(i) for i in input().split()]
x2,y2=[int(i) for i in input().split()]
h=abs(x1-x2)+(1 if x1!=x2 else 2)
w=abs(y1-y2)+(1 if y1!=y2 else 2)
print(h*2+w*2) |
Problem: Polycarp takes part in a quadcopter competition. According to the rules a flying robot should:
* start the race from some point of a field,
* go around the flag,
* close cycle returning back to the starting point.
Polycarp knows the coordinates of the starting point (x1, y1) and the coordinates of... | def main():
x1, y1 = [int(float(x)) for x in input().split(' ')]
x2, y2 = [int(float(x)) for x in input().split(' ')]
#Find envolving point
xr = x2
yr = y2
if(x2>x1):
xr+=1
elif(x2!=x1):
xr-=1
if(y2>y1):
yr+=1
elif(y2!=y1):
yr-=1
#Size of rectangle
... |
Problem: Polycarp takes part in a quadcopter competition. According to the rules a flying robot should:
* start the race from some point of a field,
* go around the flag,
* close cycle returning back to the starting point.
Polycarp knows the coordinates of the starting point (x1, y1) and the coordinates of... | import java.io.*;
import java.util.*;
public class MainM {
public static void main(String[] args) {
StdIn in = new StdIn();
int x1=in.nextInt(), y1=in.nextInt(), x2=in.nextInt(), y2=in.nextInt();
if(x1==x2) {
System.out.println((Math.abs(y1-y2)+1)*2+4);
} else if(y1==y2) {
System.out.println((Math.abs... |
Problem: Polycarp takes part in a quadcopter competition. According to the rules a flying robot should:
* start the race from some point of a field,
* go around the flag,
* close cycle returning back to the starting point.
Polycarp knows the coordinates of the starting point (x1, y1) and the coordinates of... | #include <bits/stdc++.h>
using namespace std;
int main() {
long long int t, a, b, c, d, ans, i, j;
cin >> a >> b;
cin >> c >> d;
if (a != c && b != d) {
i = abs(a - c);
j = abs(b - d);
ans = (2 * (i + j)) + 4;
cout << ans << endl;
} else {
if (a == c) {
i = abs(b - d);
i = i + ... |
Problem: Polycarp takes part in a quadcopter competition. According to the rules a flying robot should:
* start the race from some point of a field,
* go around the flag,
* close cycle returning back to the starting point.
Polycarp knows the coordinates of the starting point (x1, y1) and the coordinates of... |
import java.util.Scanner;
public class ProblemM {
public static void main(String[] args) {
QuadcopterCompetition QC = new QuadcopterCompetition();
QC.solve();
QC.print();
}
}
class QuadcopterCompetition {
Scanner sc;
int x1, y1;
int x2, y2;
int answer;
QuadcopterCompetition() {
sc = new Scann... |
Problem: Polycarp takes part in a quadcopter competition. According to the rules a flying robot should:
* start the race from some point of a field,
* go around the flag,
* close cycle returning back to the starting point.
Polycarp knows the coordinates of the starting point (x1, y1) and the coordinates of... | //package com.company;
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.util.Scanner;
public class Main {
public static void main(String[] args) {
Scanner in = new Scanner(System.in);
// String str2 = null, str1 = null;
// try (BufferedReader br = new BufferedReade... |
Problem: Polycarp takes part in a quadcopter competition. According to the rules a flying robot should:
* start the race from some point of a field,
* go around the flag,
* close cycle returning back to the starting point.
Polycarp knows the coordinates of the starting point (x1, y1) and the coordinates of... | from math import *
xq,yq = map(int, input().split())
xf,yf = map(int, input().split())
val=0
if(yq==yf and xq==xf):
print(int(10))
elif(xq==xf and yq!=yf):
print(int(2*( fabs( yq - yf)-1 ) + 8))
elif(yq==yf and xq!=xf):
print(int(2*( fabs( xq - xf)-1 ) + 8))
elif(fabs(xq - xf) + fabs(yq - yf) == 2):
... |
Problem: Polycarp takes part in a quadcopter competition. According to the rules a flying robot should:
* start the race from some point of a field,
* go around the flag,
* close cycle returning back to the starting point.
Polycarp knows the coordinates of the starting point (x1, y1) and the coordinates of... | #include <bits/stdc++.h>
using namespace std;
const int INF = 1e9 * 2;
int main() {
ios::sync_with_stdio(0);
cin.tie(0);
cout.tie(0);
int x1, y1, x2, y2;
cin >> x1 >> y1 >> x2 >> y2;
int ans = 0;
if (x1 <= x2 - 1) {
ans += (x2 - x1 - 1 + 2) * 2;
} else if (x1 == x2) {
ans += 4;
} else {
an... |
Problem: Polycarp takes part in a quadcopter competition. According to the rules a flying robot should:
* start the race from some point of a field,
* go around the flag,
* close cycle returning back to the starting point.
Polycarp knows the coordinates of the starting point (x1, y1) and the coordinates of... | X = list(map(int, input().split()))
Y = list(map(int, input().split()))
print(sum((4 if X[0] == Y[0] else ((abs(X[0] - Y[0]) + 1) * 2), (4 if X[1] == Y[1] else ((abs(X[1] - Y[1]) + 1) * 2)))))
|
Problem: Polycarp takes part in a quadcopter competition. According to the rules a flying robot should:
* start the race from some point of a field,
* go around the flag,
* close cycle returning back to the starting point.
Polycarp knows the coordinates of the starting point (x1, y1) and the coordinates of... | a, b = input().split()
a, b = int(a), int(b)
c, d = input().split()
c, d = int(c), int(d)
if abs(a - c) == 0:
print(2 * abs(b - d) + 6)
elif abs(b - d) == 0:
print(2 * abs(a - c) + 6)
else:
print(2 * abs(a - c) + 2 * abs(b-d) + 4)
|
Problem: Polycarp takes part in a quadcopter competition. According to the rules a flying robot should:
* start the race from some point of a field,
* go around the flag,
* close cycle returning back to the starting point.
Polycarp knows the coordinates of the starting point (x1, y1) and the coordinates of... | #include <bits/stdc++.h>
using namespace std;
int main() {
int x1, y1, x2, y2;
cin >> x1 >> y1 >> x2 >> y2;
int ans = 2 * max((abs(x1 - x2) + 1), 2) + 2 * max((abs(y1 - y2) + 1), 2);
cout << ans << endl;
return 0;
}
|
Problem: Polycarp takes part in a quadcopter competition. According to the rules a flying robot should:
* start the race from some point of a field,
* go around the flag,
* close cycle returning back to the starting point.
Polycarp knows the coordinates of the starting point (x1, y1) and the coordinates of... | x1,y1 = map(int,input().split())
x2,y2 = map(int,input().split())
print((max(abs(x1-x2),1)+1)*2+2*(max(1,abs(y1-y2))+1))
|
Problem: Polycarp takes part in a quadcopter competition. According to the rules a flying robot should:
* start the race from some point of a field,
* go around the flag,
* close cycle returning back to the starting point.
Polycarp knows the coordinates of the starting point (x1, y1) and the coordinates of... | #include <bits/stdc++.h>
using namespace std;
int main() {
int x1, y1, x2, y2, l;
cin >> x1 >> y1 >> x2 >> y2;
if ((x1 != x2) && (y1 != y2)) {
l = abs(x1 - x2) + 1;
l = l + abs(y2 - y1) + 1;
l = l + l;
cout << l;
} else {
if (x1 == x2) {
l = abs(x1 - x2) + 2;
l = l + abs(y2 - y1)... |
Problem: Polycarp takes part in a quadcopter competition. According to the rules a flying robot should:
* start the race from some point of a field,
* go around the flag,
* close cycle returning back to the starting point.
Polycarp knows the coordinates of the starting point (x1, y1) and the coordinates of... | #include <bits/stdc++.h>
using namespace std;
const double PI = acos(-1.0);
const int inf = 0x3f3f3f3f;
const long long mod = 1e9 + 7;
const int maxn = 1e6 + 5;
int a, b, c, d;
int main() {
scanf("%d%d%d%d", &a, &b, &c, &d);
int x, y;
if (a == c)
x = 4;
else
x = (abs(a - c) + 1) * 2;
if (b == d)
y... |
Problem: Polycarp takes part in a quadcopter competition. According to the rules a flying robot should:
* start the race from some point of a field,
* go around the flag,
* close cycle returning back to the starting point.
Polycarp knows the coordinates of the starting point (x1, y1) and the coordinates of... | import java.util.*;
public class QuadcopterCompetition{
public static void main(String[] args){
Scanner sc = new Scanner(System.in);
int x1 = sc.nextInt(), y1 = sc.nextInt(), x2 = sc.nextInt(), y2 = sc.nextInt();
if(x1 == x2){
System.out.println(2*(2+Math.abs(y1-y2)+1));
... |
Problem: Polycarp takes part in a quadcopter competition. According to the rules a flying robot should:
* start the race from some point of a field,
* go around the flag,
* close cycle returning back to the starting point.
Polycarp knows the coordinates of the starting point (x1, y1) and the coordinates of... | import java.io.*;
import java.util.*;
public class MyClass {
public static void main(String args[]) {
Scanner sc=new Scanner(System.in);
int x1=sc.nextInt();
int y1=sc.nextInt();
int x2=sc.nextInt();
int y2=sc.nextInt();
int ans=0;
if(x1==x2)
ans=4+(M... |
Problem: Polycarp takes part in a quadcopter competition. According to the rules a flying robot should:
* start the race from some point of a field,
* go around the flag,
* close cycle returning back to the starting point.
Polycarp knows the coordinates of the starting point (x1, y1) and the coordinates of... | import java.util.Scanner ;
public class M883_QuadCopterCompititon {
public static void main(String[] args) {
Scanner ss =new Scanner (System.in) ;
int x1 ,x2,y1,y2 ;
x1 = ss.nextInt() ;
y1 = ss.nextInt() ;
x2 = ss.nextInt() ;
y2 = ss.nextInt() ;
int cir =2* ((int )(Math.abs(x1-x2) + (int ) Mat... |
Problem: Polycarp takes part in a quadcopter competition. According to the rules a flying robot should:
* start the race from some point of a field,
* go around the flag,
* close cycle returning back to the starting point.
Polycarp knows the coordinates of the starting point (x1, y1) and the coordinates of... | #include <bits/stdc++.h>
using namespace std;
int main() {
int x1, y1, x2, y2, ans = 0;
cin >> x1 >> y1 >> x2 >> y2;
if (x1 == x2) x1++;
if (y1 == y2) y1++;
x2 = x2 > x1 ? x2 + 1 : x2 - 1;
y2 = y2 > y1 ? y2 + 1 : y2 - 1;
ans = abs(x1 - x2) + abs(y1 - y2);
ans = ans * 2;
cout << ans;
return 0;
}
|
Problem: Polycarp takes part in a quadcopter competition. According to the rules a flying robot should:
* start the race from some point of a field,
* go around the flag,
* close cycle returning back to the starting point.
Polycarp knows the coordinates of the starting point (x1, y1) and the coordinates of... |
x1,y1 = map(int,input().split())
x2,y2= map(int,input().split())
a = abs(x1-x2)+1
b = abs(y1-y2)+1
if a==1:
a+=1
if b==1:
b+=1
print((a+b)*2)
|
Problem: Polycarp takes part in a quadcopter competition. According to the rules a flying robot should:
* start the race from some point of a field,
* go around the flag,
* close cycle returning back to the starting point.
Polycarp knows the coordinates of the starting point (x1, y1) and the coordinates of... | #883M
x1, y1 = map(int, input().split(" "))
x2, y2 = map(int, input().split(" "))
length = 0
if x2>x1:
length += 2*(x2+1-x1)
elif x2<x1:
length += 2*(x1+1-x2)
elif x2 == x1:
length += 4
if y2>y1:
length += 2*(y2+1-y1)
elif y2<y1:
length += 2*(y1+1-y2)
elif y2==y1:
length += 4
print(length)
|
Problem: Polycarp takes part in a quadcopter competition. According to the rules a flying robot should:
* start the race from some point of a field,
* go around the flag,
* close cycle returning back to the starting point.
Polycarp knows the coordinates of the starting point (x1, y1) and the coordinates of... | x1, y1 = map(int,input().split())
x2, y2 = map(int,input().split())
n = 2*(abs((x2 - x1))+1) + 2* (abs((y2 - y1))+1)
if x1 == x2:
n+=2
if y1 == y2:
n+=2
print(n) |
Problem: Polycarp takes part in a quadcopter competition. According to the rules a flying robot should:
* start the race from some point of a field,
* go around the flag,
* close cycle returning back to the starting point.
Polycarp knows the coordinates of the starting point (x1, y1) and the coordinates of... |
import java.awt.List;
import java.io.*;
import java.util.*;
/*
*
* daiict
*
*
*
*/
public class prac {
FastScanner in;
PrintWriter out;
static ArrayList[] adj;
... |
Problem: Polycarp takes part in a quadcopter competition. According to the rules a flying robot should:
* start the race from some point of a field,
* go around the flag,
* close cycle returning back to the starting point.
Polycarp knows the coordinates of the starting point (x1, y1) and the coordinates of... | import java.io.*;
import java.util.*;
import java.lang.*;
import static java.lang.Math.*;
public class Main implements Runnable {
public static void main(String[] args) {
new Thread(null, new Main(), "Check2", 1 << 28).start();// to increse stack size in java
}
void init(ArrayList <Integer> adj[], ... |
Problem: Polycarp takes part in a quadcopter competition. According to the rules a flying robot should:
* start the race from some point of a field,
* go around the flag,
* close cycle returning back to the starting point.
Polycarp knows the coordinates of the starting point (x1, y1) and the coordinates of... | import java.io.*;
import java.util.*;
public class Solution {
public static void main(String[] args) throws Exception {
MyReader reader = new MyReader(System.in);
MyWriter writer = new MyWriter(System.out);
new Solution().run(reader, writer);
writer.close();
}
private void... |
Problem: Polycarp takes part in a quadcopter competition. According to the rules a flying robot should:
* start the race from some point of a field,
* go around the flag,
* close cycle returning back to the starting point.
Polycarp knows the coordinates of the starting point (x1, y1) and the coordinates of... | //package m;
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.ArrayDeque;
import java.util.Queue;
public class M {
public M(IO io) {
int x1 = io.getInt();
int y1 = io.getInt();
int x2 = io.getInt();
int y2 = io.getInt();
int dx = Math.abs(x1 ... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.