Search is not available for this dataset
name
stringlengths
2
88
description
stringlengths
31
8.62k
public_tests
dict
private_tests
dict
solution_type
stringclasses
2 values
programming_language
stringclasses
5 values
solution
stringlengths
1
983k
143_A. Help Vasilisa the Wise 2
Vasilisa the Wise from the Kingdom of Far Far Away got a magic box with a secret as a present from her friend Hellawisa the Wise from the Kingdom of A Little Closer. However, Vasilisa the Wise does not know what the box's secret is, since she cannot open it again. She hopes that you will help her one more time with tha...
{ "input": [ "1 2\n3 4\n5 6\n", "11 10\n13 8\n5 16\n", "3 7\n4 6\n5 5\n", "10 10\n10 10\n10 10\n" ], "output": [ "-1\n", "4 7\n9 1\n", "1 2\n3 4\n", "-1\n" ] }
{ "input": [ "3 14\n8 9\n10 7\n", "12 11\n11 12\n16 7\n", "12 17\n10 19\n13 16\n", "9 12\n3 17\n10 10\n", "10 7\n4 13\n11 6\n", "7 9\n4 12\n5 11\n", "2 4\n1 5\n3 3\n", "13 8\n15 6\n11 10\n", "8 10\n9 9\n13 5\n", "12 7\n5 14\n8 11\n", "9 6\n5 10\n3 12\n", "16 5\n13 8\n10...
CORRECT
java
import java.util.Scanner; public class A143_Help_Vasilisa_the_Wise2 { public static void main(String[] args) { Scanner ss = new Scanner (System.in) ; int r1 =ss.nextInt() ; int r2 = ss.nextInt() ; int c1 =ss.nextInt() ; int c2 =ss.nextInt() ; int d1 =ss.nextInt() ; int d2 = ss.nextInt() ; i...
143_A. Help Vasilisa the Wise 2
Vasilisa the Wise from the Kingdom of Far Far Away got a magic box with a secret as a present from her friend Hellawisa the Wise from the Kingdom of A Little Closer. However, Vasilisa the Wise does not know what the box's secret is, since she cannot open it again. She hopes that you will help her one more time with tha...
{ "input": [ "1 2\n3 4\n5 6\n", "11 10\n13 8\n5 16\n", "3 7\n4 6\n5 5\n", "10 10\n10 10\n10 10\n" ], "output": [ "-1\n", "4 7\n9 1\n", "1 2\n3 4\n", "-1\n" ] }
{ "input": [ "3 14\n8 9\n10 7\n", "12 11\n11 12\n16 7\n", "12 17\n10 19\n13 16\n", "9 12\n3 17\n10 10\n", "10 7\n4 13\n11 6\n", "7 9\n4 12\n5 11\n", "2 4\n1 5\n3 3\n", "13 8\n15 6\n11 10\n", "8 10\n9 9\n13 5\n", "12 7\n5 14\n8 11\n", "9 6\n5 10\n3 12\n", "16 5\n13 8\n10...
CORRECT
python2
r1, r2 = map(int, raw_input().split()) c1, c2 = map(int, raw_input().split()) d1, d2 = map(int, raw_input().split()) M = [[0, 0], [0, 0]] ind = False i = 1 while i < 10 and not ind: M[0][0] = i M[0][1] = r1 - i M[1][0] = c1 - i M[1][1] = d1 - i if M[0][0] != M[0][1] and M[0][0] != M[1][0] and M[0]...
143_A. Help Vasilisa the Wise 2
Vasilisa the Wise from the Kingdom of Far Far Away got a magic box with a secret as a present from her friend Hellawisa the Wise from the Kingdom of A Little Closer. However, Vasilisa the Wise does not know what the box's secret is, since she cannot open it again. She hopes that you will help her one more time with tha...
{ "input": [ "1 2\n3 4\n5 6\n", "11 10\n13 8\n5 16\n", "3 7\n4 6\n5 5\n", "10 10\n10 10\n10 10\n" ], "output": [ "-1\n", "4 7\n9 1\n", "1 2\n3 4\n", "-1\n" ] }
{ "input": [ "3 14\n8 9\n10 7\n", "12 11\n11 12\n16 7\n", "12 17\n10 19\n13 16\n", "9 12\n3 17\n10 10\n", "10 7\n4 13\n11 6\n", "7 9\n4 12\n5 11\n", "2 4\n1 5\n3 3\n", "13 8\n15 6\n11 10\n", "8 10\n9 9\n13 5\n", "12 7\n5 14\n8 11\n", "9 6\n5 10\n3 12\n", "16 5\n13 8\n10...
CORRECT
python3
import sys import math import collections import heapq input=sys.stdin.readline r1,r2=(int(i) for i in input().split()) c1,c2=(int(i) for i in input().split()) d1,d2=(int(i) for i in input().split()) c3=0 for i in range(1,10): b=r1-i c=c1-i d=d1-i if(len(set([i,b,c,d]))==4 and max(i,b,c,d)<=9 and min(i,...
143_A. Help Vasilisa the Wise 2
Vasilisa the Wise from the Kingdom of Far Far Away got a magic box with a secret as a present from her friend Hellawisa the Wise from the Kingdom of A Little Closer. However, Vasilisa the Wise does not know what the box's secret is, since she cannot open it again. She hopes that you will help her one more time with tha...
{ "input": [ "1 2\n3 4\n5 6\n", "11 10\n13 8\n5 16\n", "3 7\n4 6\n5 5\n", "10 10\n10 10\n10 10\n" ], "output": [ "-1\n", "4 7\n9 1\n", "1 2\n3 4\n", "-1\n" ] }
{ "input": [ "3 14\n8 9\n10 7\n", "12 11\n11 12\n16 7\n", "12 17\n10 19\n13 16\n", "9 12\n3 17\n10 10\n", "10 7\n4 13\n11 6\n", "7 9\n4 12\n5 11\n", "2 4\n1 5\n3 3\n", "13 8\n15 6\n11 10\n", "8 10\n9 9\n13 5\n", "12 7\n5 14\n8 11\n", "9 6\n5 10\n3 12\n", "16 5\n13 8\n10...
CORRECT
python2
r1, r2 = map(int, raw_input().split()) c1, c2 = map(int, raw_input().split()) d1, d2 = map(int, raw_input().split()) x = (c1-r2+d1) // 2 y = (c2-r2+d2) // 2 z = (c1-r1+d2) // 2 m = (r1+r2+c1+c2+d1+d2) // 3 - (x+y+z) #print x, y, z, m if len(set([x, y, z, m])) != 4 or max([x, y, z, m]) > 9 or min([x, y, z, m]) <= 0 or...
143_A. Help Vasilisa the Wise 2
Vasilisa the Wise from the Kingdom of Far Far Away got a magic box with a secret as a present from her friend Hellawisa the Wise from the Kingdom of A Little Closer. However, Vasilisa the Wise does not know what the box's secret is, since she cannot open it again. She hopes that you will help her one more time with tha...
{ "input": [ "1 2\n3 4\n5 6\n", "11 10\n13 8\n5 16\n", "3 7\n4 6\n5 5\n", "10 10\n10 10\n10 10\n" ], "output": [ "-1\n", "4 7\n9 1\n", "1 2\n3 4\n", "-1\n" ] }
{ "input": [ "3 14\n8 9\n10 7\n", "12 11\n11 12\n16 7\n", "12 17\n10 19\n13 16\n", "9 12\n3 17\n10 10\n", "10 7\n4 13\n11 6\n", "7 9\n4 12\n5 11\n", "2 4\n1 5\n3 3\n", "13 8\n15 6\n11 10\n", "8 10\n9 9\n13 5\n", "12 7\n5 14\n8 11\n", "9 6\n5 10\n3 12\n", "16 5\n13 8\n10...
CORRECT
java
import java.io.BufferedReader; import java.io.FileNotFoundException; import java.io.FileReader; import java.io.IOException; import java.io.InputStreamReader; import java.io.PrintWriter; import java.math.BigDecimal; import java.math.RoundingMode; import java.util.StringTokenizer; /** * Change class name, cunstructor ...
143_A. Help Vasilisa the Wise 2
Vasilisa the Wise from the Kingdom of Far Far Away got a magic box with a secret as a present from her friend Hellawisa the Wise from the Kingdom of A Little Closer. However, Vasilisa the Wise does not know what the box's secret is, since she cannot open it again. She hopes that you will help her one more time with tha...
{ "input": [ "1 2\n3 4\n5 6\n", "11 10\n13 8\n5 16\n", "3 7\n4 6\n5 5\n", "10 10\n10 10\n10 10\n" ], "output": [ "-1\n", "4 7\n9 1\n", "1 2\n3 4\n", "-1\n" ] }
{ "input": [ "3 14\n8 9\n10 7\n", "12 11\n11 12\n16 7\n", "12 17\n10 19\n13 16\n", "9 12\n3 17\n10 10\n", "10 7\n4 13\n11 6\n", "7 9\n4 12\n5 11\n", "2 4\n1 5\n3 3\n", "13 8\n15 6\n11 10\n", "8 10\n9 9\n13 5\n", "12 7\n5 14\n8 11\n", "9 6\n5 10\n3 12\n", "16 5\n13 8\n10...
CORRECT
python3
r1, r2 = map(int, input().split(" ")) c1, c2 = map(int, input().split(" ")) d1, d2 = map(int, input().split(" ")) row1_list = list() row2_list = list() unlock_gems_of_r1 = list() unlock_gems_of_r2 = list() final_set = set() for gem_no1 in range(1, 10): for gem_no2 in range(1, 10): if (gem_no1 + gem_no2) ==...
143_A. Help Vasilisa the Wise 2
Vasilisa the Wise from the Kingdom of Far Far Away got a magic box with a secret as a present from her friend Hellawisa the Wise from the Kingdom of A Little Closer. However, Vasilisa the Wise does not know what the box's secret is, since she cannot open it again. She hopes that you will help her one more time with tha...
{ "input": [ "1 2\n3 4\n5 6\n", "11 10\n13 8\n5 16\n", "3 7\n4 6\n5 5\n", "10 10\n10 10\n10 10\n" ], "output": [ "-1\n", "4 7\n9 1\n", "1 2\n3 4\n", "-1\n" ] }
{ "input": [ "3 14\n8 9\n10 7\n", "12 11\n11 12\n16 7\n", "12 17\n10 19\n13 16\n", "9 12\n3 17\n10 10\n", "10 7\n4 13\n11 6\n", "7 9\n4 12\n5 11\n", "2 4\n1 5\n3 3\n", "13 8\n15 6\n11 10\n", "8 10\n9 9\n13 5\n", "12 7\n5 14\n8 11\n", "9 6\n5 10\n3 12\n", "16 5\n13 8\n10...
CORRECT
python3
def is_valid(a, b, headers): r1, r2, c1, c2, d1, d2 = headers c, d = r1 - a, r2 - b res = [a, b, c, d] if a + d == d1 and b + c == d2 and len(res) == len(set(res)) and max(res) < 10: return res return -1 def print_result(res): if res == -1: return 0 print(res[0], res[2]) ...
143_A. Help Vasilisa the Wise 2
Vasilisa the Wise from the Kingdom of Far Far Away got a magic box with a secret as a present from her friend Hellawisa the Wise from the Kingdom of A Little Closer. However, Vasilisa the Wise does not know what the box's secret is, since she cannot open it again. She hopes that you will help her one more time with tha...
{ "input": [ "1 2\n3 4\n5 6\n", "11 10\n13 8\n5 16\n", "3 7\n4 6\n5 5\n", "10 10\n10 10\n10 10\n" ], "output": [ "-1\n", "4 7\n9 1\n", "1 2\n3 4\n", "-1\n" ] }
{ "input": [ "3 14\n8 9\n10 7\n", "12 11\n11 12\n16 7\n", "12 17\n10 19\n13 16\n", "9 12\n3 17\n10 10\n", "10 7\n4 13\n11 6\n", "7 9\n4 12\n5 11\n", "2 4\n1 5\n3 3\n", "13 8\n15 6\n11 10\n", "8 10\n9 9\n13 5\n", "12 7\n5 14\n8 11\n", "9 6\n5 10\n3 12\n", "16 5\n13 8\n10...
CORRECT
python3
r1,r2=map(int,input().split()) c1,c2=map(int,input().split()) d1,d2=map(int,input().split()) a=(r1+d1-c2)/2 b=(d2+c2-r2)/2 c=c1-a d=c2-b x=[a,b,c,d] if a==int(a) and b==int(b) and c==int(c) and d==int(d) and a+b==r1 and c+d==r2 and x.count(a)==1 and x.count(b)==1 and x.count(c)==1 and x.count(d)==1 and max(x)<=9 and mi...
143_A. Help Vasilisa the Wise 2
Vasilisa the Wise from the Kingdom of Far Far Away got a magic box with a secret as a present from her friend Hellawisa the Wise from the Kingdom of A Little Closer. However, Vasilisa the Wise does not know what the box's secret is, since she cannot open it again. She hopes that you will help her one more time with tha...
{ "input": [ "1 2\n3 4\n5 6\n", "11 10\n13 8\n5 16\n", "3 7\n4 6\n5 5\n", "10 10\n10 10\n10 10\n" ], "output": [ "-1\n", "4 7\n9 1\n", "1 2\n3 4\n", "-1\n" ] }
{ "input": [ "3 14\n8 9\n10 7\n", "12 11\n11 12\n16 7\n", "12 17\n10 19\n13 16\n", "9 12\n3 17\n10 10\n", "10 7\n4 13\n11 6\n", "7 9\n4 12\n5 11\n", "2 4\n1 5\n3 3\n", "13 8\n15 6\n11 10\n", "8 10\n9 9\n13 5\n", "12 7\n5 14\n8 11\n", "9 6\n5 10\n3 12\n", "16 5\n13 8\n10...
CORRECT
python2
r1, r2=[int(x) for x in raw_input().split()] c1, c2=[int(x) for x in raw_input().split()] d1, d2=[int(x) for x in raw_input().split()] w=range(1,10) x=range(1,10) y=range(1,10) z=range(1,10) p=0 o=0 i=0 u=0 lock=False for p in w: for o in x: for i in y: for u in z: if i+u==r2 an...
143_A. Help Vasilisa the Wise 2
Vasilisa the Wise from the Kingdom of Far Far Away got a magic box with a secret as a present from her friend Hellawisa the Wise from the Kingdom of A Little Closer. However, Vasilisa the Wise does not know what the box's secret is, since she cannot open it again. She hopes that you will help her one more time with tha...
{ "input": [ "1 2\n3 4\n5 6\n", "11 10\n13 8\n5 16\n", "3 7\n4 6\n5 5\n", "10 10\n10 10\n10 10\n" ], "output": [ "-1\n", "4 7\n9 1\n", "1 2\n3 4\n", "-1\n" ] }
{ "input": [ "3 14\n8 9\n10 7\n", "12 11\n11 12\n16 7\n", "12 17\n10 19\n13 16\n", "9 12\n3 17\n10 10\n", "10 7\n4 13\n11 6\n", "7 9\n4 12\n5 11\n", "2 4\n1 5\n3 3\n", "13 8\n15 6\n11 10\n", "8 10\n9 9\n13 5\n", "12 7\n5 14\n8 11\n", "9 6\n5 10\n3 12\n", "16 5\n13 8\n10...
CORRECT
python2
# Matheus Oliveira # 01/08/2017 # 143A.py rows = map(int, raw_input().split()) columns = map(int, raw_input().split()) diags = map(int, raw_input().split()) possible = False for n1 in xrange(1, 10): possible = True not_being = [1, 2, 3, 4, 5, 6, 7, 8, 9] not_being.remove(n1) n2 = columns[0] - n1 if n2 in ...
143_A. Help Vasilisa the Wise 2
Vasilisa the Wise from the Kingdom of Far Far Away got a magic box with a secret as a present from her friend Hellawisa the Wise from the Kingdom of A Little Closer. However, Vasilisa the Wise does not know what the box's secret is, since she cannot open it again. She hopes that you will help her one more time with tha...
{ "input": [ "1 2\n3 4\n5 6\n", "11 10\n13 8\n5 16\n", "3 7\n4 6\n5 5\n", "10 10\n10 10\n10 10\n" ], "output": [ "-1\n", "4 7\n9 1\n", "1 2\n3 4\n", "-1\n" ] }
{ "input": [ "3 14\n8 9\n10 7\n", "12 11\n11 12\n16 7\n", "12 17\n10 19\n13 16\n", "9 12\n3 17\n10 10\n", "10 7\n4 13\n11 6\n", "7 9\n4 12\n5 11\n", "2 4\n1 5\n3 3\n", "13 8\n15 6\n11 10\n", "8 10\n9 9\n13 5\n", "12 7\n5 14\n8 11\n", "9 6\n5 10\n3 12\n", "16 5\n13 8\n10...
CORRECT
cpp
#include <bits/stdc++.h> using namespace std; int main() { vector<int> v; int freq[10]; memset(freq, 0, sizeof(freq)); int k, r1, r2, c1, c2, d1, d2, x1, x2, y1, y2; cin >> r1 >> r2 >> c1 >> c2 >> d1 >> d2; x1 = (c1 + r1 - d2) / 2; v.push_back(x1); x2 = c1 - x1; v.push_back(x2); y1 = (d2 + c2 - r2) ...
143_A. Help Vasilisa the Wise 2
Vasilisa the Wise from the Kingdom of Far Far Away got a magic box with a secret as a present from her friend Hellawisa the Wise from the Kingdom of A Little Closer. However, Vasilisa the Wise does not know what the box's secret is, since she cannot open it again. She hopes that you will help her one more time with tha...
{ "input": [ "1 2\n3 4\n5 6\n", "11 10\n13 8\n5 16\n", "3 7\n4 6\n5 5\n", "10 10\n10 10\n10 10\n" ], "output": [ "-1\n", "4 7\n9 1\n", "1 2\n3 4\n", "-1\n" ] }
{ "input": [ "3 14\n8 9\n10 7\n", "12 11\n11 12\n16 7\n", "12 17\n10 19\n13 16\n", "9 12\n3 17\n10 10\n", "10 7\n4 13\n11 6\n", "7 9\n4 12\n5 11\n", "2 4\n1 5\n3 3\n", "13 8\n15 6\n11 10\n", "8 10\n9 9\n13 5\n", "12 7\n5 14\n8 11\n", "9 6\n5 10\n3 12\n", "16 5\n13 8\n10...
CORRECT
cpp
#include <bits/stdc++.h> using namespace std; int main() { int r1, r2, c1, c2, d1, d2; cin >> r1 >> r2 >> c1 >> c2 >> d1 >> d2; int a1, a2, a3, a4; for (int i = 1; i <= 9; i++) { a1 = i; a2 = r1 - a1; a3 = c1 - a1; a4 = c2 - a2; if (1 > a2 or 1 > a3 or 1 > a4 or a2 > 9 or a3 > 9 or a4 > 9) c...
143_A. Help Vasilisa the Wise 2
Vasilisa the Wise from the Kingdom of Far Far Away got a magic box with a secret as a present from her friend Hellawisa the Wise from the Kingdom of A Little Closer. However, Vasilisa the Wise does not know what the box's secret is, since she cannot open it again. She hopes that you will help her one more time with tha...
{ "input": [ "1 2\n3 4\n5 6\n", "11 10\n13 8\n5 16\n", "3 7\n4 6\n5 5\n", "10 10\n10 10\n10 10\n" ], "output": [ "-1\n", "4 7\n9 1\n", "1 2\n3 4\n", "-1\n" ] }
{ "input": [ "3 14\n8 9\n10 7\n", "12 11\n11 12\n16 7\n", "12 17\n10 19\n13 16\n", "9 12\n3 17\n10 10\n", "10 7\n4 13\n11 6\n", "7 9\n4 12\n5 11\n", "2 4\n1 5\n3 3\n", "13 8\n15 6\n11 10\n", "8 10\n9 9\n13 5\n", "12 7\n5 14\n8 11\n", "9 6\n5 10\n3 12\n", "16 5\n13 8\n10...
CORRECT
cpp
#include <bits/stdc++.h> using namespace std; void solve(); int main() { ios_base::sync_with_stdio(false); cin.tie(NULL); int t = 1; while (t--) { solve(); } return 0; } void solve() { int r1, r2, c1, c2, d1, d2; cin >> r1 >> r2 >> c1 >> c2 >> d1 >> d2; int a; bool ans = false; for (a = 1; a <...
143_A. Help Vasilisa the Wise 2
Vasilisa the Wise from the Kingdom of Far Far Away got a magic box with a secret as a present from her friend Hellawisa the Wise from the Kingdom of A Little Closer. However, Vasilisa the Wise does not know what the box's secret is, since she cannot open it again. She hopes that you will help her one more time with tha...
{ "input": [ "1 2\n3 4\n5 6\n", "11 10\n13 8\n5 16\n", "3 7\n4 6\n5 5\n", "10 10\n10 10\n10 10\n" ], "output": [ "-1\n", "4 7\n9 1\n", "1 2\n3 4\n", "-1\n" ] }
{ "input": [ "3 14\n8 9\n10 7\n", "12 11\n11 12\n16 7\n", "12 17\n10 19\n13 16\n", "9 12\n3 17\n10 10\n", "10 7\n4 13\n11 6\n", "7 9\n4 12\n5 11\n", "2 4\n1 5\n3 3\n", "13 8\n15 6\n11 10\n", "8 10\n9 9\n13 5\n", "12 7\n5 14\n8 11\n", "9 6\n5 10\n3 12\n", "16 5\n13 8\n10...
CORRECT
java
import java.io.*; import java.util.Arrays; import java.util.Scanner; import java.lang.*; import java.lang.reflect.Array; import java.nio.charset.Charset; public class test { public static void main(String[] args) throws Exception { int r1 = nextInt(); int r2 = nextInt(); int c1 = nextInt(); int c2 = nex...
143_A. Help Vasilisa the Wise 2
Vasilisa the Wise from the Kingdom of Far Far Away got a magic box with a secret as a present from her friend Hellawisa the Wise from the Kingdom of A Little Closer. However, Vasilisa the Wise does not know what the box's secret is, since she cannot open it again. She hopes that you will help her one more time with tha...
{ "input": [ "1 2\n3 4\n5 6\n", "11 10\n13 8\n5 16\n", "3 7\n4 6\n5 5\n", "10 10\n10 10\n10 10\n" ], "output": [ "-1\n", "4 7\n9 1\n", "1 2\n3 4\n", "-1\n" ] }
{ "input": [ "3 14\n8 9\n10 7\n", "12 11\n11 12\n16 7\n", "12 17\n10 19\n13 16\n", "9 12\n3 17\n10 10\n", "10 7\n4 13\n11 6\n", "7 9\n4 12\n5 11\n", "2 4\n1 5\n3 3\n", "13 8\n15 6\n11 10\n", "8 10\n9 9\n13 5\n", "12 7\n5 14\n8 11\n", "9 6\n5 10\n3 12\n", "16 5\n13 8\n10...
CORRECT
java
import java.util.*; public class Main{ public static void main(String args[]){ Scanner in = new Scanner(System.in); int r1=in.nextInt(),r2=in.nextInt(); int c1=in.nextInt(),c2=in.nextInt(); int d1=in.nextInt(),d2=in.nextInt(); int i,j,l,m; for(i=1;i<10;i++){ for(j=1;j<10;j++){ for(l=1;l<10;l++){ for(m=...
143_A. Help Vasilisa the Wise 2
Vasilisa the Wise from the Kingdom of Far Far Away got a magic box with a secret as a present from her friend Hellawisa the Wise from the Kingdom of A Little Closer. However, Vasilisa the Wise does not know what the box's secret is, since she cannot open it again. She hopes that you will help her one more time with tha...
{ "input": [ "1 2\n3 4\n5 6\n", "11 10\n13 8\n5 16\n", "3 7\n4 6\n5 5\n", "10 10\n10 10\n10 10\n" ], "output": [ "-1\n", "4 7\n9 1\n", "1 2\n3 4\n", "-1\n" ] }
{ "input": [ "3 14\n8 9\n10 7\n", "12 11\n11 12\n16 7\n", "12 17\n10 19\n13 16\n", "9 12\n3 17\n10 10\n", "10 7\n4 13\n11 6\n", "7 9\n4 12\n5 11\n", "2 4\n1 5\n3 3\n", "13 8\n15 6\n11 10\n", "8 10\n9 9\n13 5\n", "12 7\n5 14\n8 11\n", "9 6\n5 10\n3 12\n", "16 5\n13 8\n10...
CORRECT
cpp
#include <bits/stdc++.h> using namespace std; int32_t main() { ios_base::sync_with_stdio(false); cin.tie(NULL); long long int r1, r2, c1, c2, d1, d2; cin >> r1 >> r2 >> c1 >> c2 >> d1 >> d2; for (long long int i = 1; i < 10; ++i) { for (long long int j = 1; j < 10; ++j) { for (long long int k = 1; k...
143_A. Help Vasilisa the Wise 2
Vasilisa the Wise from the Kingdom of Far Far Away got a magic box with a secret as a present from her friend Hellawisa the Wise from the Kingdom of A Little Closer. However, Vasilisa the Wise does not know what the box's secret is, since she cannot open it again. She hopes that you will help her one more time with tha...
{ "input": [ "1 2\n3 4\n5 6\n", "11 10\n13 8\n5 16\n", "3 7\n4 6\n5 5\n", "10 10\n10 10\n10 10\n" ], "output": [ "-1\n", "4 7\n9 1\n", "1 2\n3 4\n", "-1\n" ] }
{ "input": [ "3 14\n8 9\n10 7\n", "12 11\n11 12\n16 7\n", "12 17\n10 19\n13 16\n", "9 12\n3 17\n10 10\n", "10 7\n4 13\n11 6\n", "7 9\n4 12\n5 11\n", "2 4\n1 5\n3 3\n", "13 8\n15 6\n11 10\n", "8 10\n9 9\n13 5\n", "12 7\n5 14\n8 11\n", "9 6\n5 10\n3 12\n", "16 5\n13 8\n10...
CORRECT
python3
r = lambda :map(int,input().split()) r1,r2 = r() c1,c2 = r() d1,d2 = r() if (r1-c1+d2)%2==0: x2 = (r1-c1+d2)//2 x1 = r1-x2 x3 = d2-x2 x4 = c2-x2 if (0<x1<=9 and 0<x2<=9 and 0<x3<=9 and 0<x4<=9 and x1+x3==c1 and x3+x4==r2 and x1+x4==d1): if len(set([x1,x2,x3,x4]))<4: print(-1) ...
143_A. Help Vasilisa the Wise 2
Vasilisa the Wise from the Kingdom of Far Far Away got a magic box with a secret as a present from her friend Hellawisa the Wise from the Kingdom of A Little Closer. However, Vasilisa the Wise does not know what the box's secret is, since she cannot open it again. She hopes that you will help her one more time with tha...
{ "input": [ "1 2\n3 4\n5 6\n", "11 10\n13 8\n5 16\n", "3 7\n4 6\n5 5\n", "10 10\n10 10\n10 10\n" ], "output": [ "-1\n", "4 7\n9 1\n", "1 2\n3 4\n", "-1\n" ] }
{ "input": [ "3 14\n8 9\n10 7\n", "12 11\n11 12\n16 7\n", "12 17\n10 19\n13 16\n", "9 12\n3 17\n10 10\n", "10 7\n4 13\n11 6\n", "7 9\n4 12\n5 11\n", "2 4\n1 5\n3 3\n", "13 8\n15 6\n11 10\n", "8 10\n9 9\n13 5\n", "12 7\n5 14\n8 11\n", "9 6\n5 10\n3 12\n", "16 5\n13 8\n10...
CORRECT
cpp
#include <bits/stdc++.h> using namespace std; int main() { bool ff = false; int a, b, c, d, e, f; cin >> a >> b >> c >> d >> e >> f; for (int i = 1; i <= 9; i++) { for (int j = 1; j <= 9; j++) { for (int k = 1; k <= 9; k++) { for (int l = 1; l <= 9; l++) { if (i + j == a && k + l == ...
143_A. Help Vasilisa the Wise 2
Vasilisa the Wise from the Kingdom of Far Far Away got a magic box with a secret as a present from her friend Hellawisa the Wise from the Kingdom of A Little Closer. However, Vasilisa the Wise does not know what the box's secret is, since she cannot open it again. She hopes that you will help her one more time with tha...
{ "input": [ "1 2\n3 4\n5 6\n", "11 10\n13 8\n5 16\n", "3 7\n4 6\n5 5\n", "10 10\n10 10\n10 10\n" ], "output": [ "-1\n", "4 7\n9 1\n", "1 2\n3 4\n", "-1\n" ] }
{ "input": [ "3 14\n8 9\n10 7\n", "12 11\n11 12\n16 7\n", "12 17\n10 19\n13 16\n", "9 12\n3 17\n10 10\n", "10 7\n4 13\n11 6\n", "7 9\n4 12\n5 11\n", "2 4\n1 5\n3 3\n", "13 8\n15 6\n11 10\n", "8 10\n9 9\n13 5\n", "12 7\n5 14\n8 11\n", "9 6\n5 10\n3 12\n", "16 5\n13 8\n10...
CORRECT
cpp
#include <bits/stdc++.h> using namespace std; int r1, r2, c1, c2, d1, d2; int main() { scanf("%d%d%d%d%d%d", &r1, &r2, &c1, &c2, &d1, &d2); int tag = 0; for (int i = 1; i <= 9; ++i) { for (int j = 1; j <= 9; ++j) { for (int k = 1; k <= 9; ++k) { for (int l = 1; l <= 9; ++l) { if (i == ...
143_A. Help Vasilisa the Wise 2
Vasilisa the Wise from the Kingdom of Far Far Away got a magic box with a secret as a present from her friend Hellawisa the Wise from the Kingdom of A Little Closer. However, Vasilisa the Wise does not know what the box's secret is, since she cannot open it again. She hopes that you will help her one more time with tha...
{ "input": [ "1 2\n3 4\n5 6\n", "11 10\n13 8\n5 16\n", "3 7\n4 6\n5 5\n", "10 10\n10 10\n10 10\n" ], "output": [ "-1\n", "4 7\n9 1\n", "1 2\n3 4\n", "-1\n" ] }
{ "input": [ "3 14\n8 9\n10 7\n", "12 11\n11 12\n16 7\n", "12 17\n10 19\n13 16\n", "9 12\n3 17\n10 10\n", "10 7\n4 13\n11 6\n", "7 9\n4 12\n5 11\n", "2 4\n1 5\n3 3\n", "13 8\n15 6\n11 10\n", "8 10\n9 9\n13 5\n", "12 7\n5 14\n8 11\n", "9 6\n5 10\n3 12\n", "16 5\n13 8\n10...
CORRECT
python2
import sys a=sys.stdin.readline().split() r1=int(a[0]) r2=int(a[1]) b=sys.stdin.readline().split() c1=int(b[0]) c2=int(b[1]) c=sys.stdin.readline().split() d1=int(c[0]) d2=int(c[1]) if(c1+c2!=r1+r2): print -1 else: if(d1+d2!=r1+r2): print -1 else: f=(d1-r1+c2)/2 s=c2-f t=r2...
143_A. Help Vasilisa the Wise 2
Vasilisa the Wise from the Kingdom of Far Far Away got a magic box with a secret as a present from her friend Hellawisa the Wise from the Kingdom of A Little Closer. However, Vasilisa the Wise does not know what the box's secret is, since she cannot open it again. She hopes that you will help her one more time with tha...
{ "input": [ "1 2\n3 4\n5 6\n", "11 10\n13 8\n5 16\n", "3 7\n4 6\n5 5\n", "10 10\n10 10\n10 10\n" ], "output": [ "-1\n", "4 7\n9 1\n", "1 2\n3 4\n", "-1\n" ] }
{ "input": [ "3 14\n8 9\n10 7\n", "12 11\n11 12\n16 7\n", "12 17\n10 19\n13 16\n", "9 12\n3 17\n10 10\n", "10 7\n4 13\n11 6\n", "7 9\n4 12\n5 11\n", "2 4\n1 5\n3 3\n", "13 8\n15 6\n11 10\n", "8 10\n9 9\n13 5\n", "12 7\n5 14\n8 11\n", "9 6\n5 10\n3 12\n", "16 5\n13 8\n10...
CORRECT
python3
r1,r2 = map(int,input().split()) c1,c2= map(int,input().split()) d1,d2=map(int,input().split()) d = (d1-c1+r2) if d%2==0: D=d//2 c=r2-D b = c2-D a = r1-b if 9>=a>0 and 9>=b>0 and 9>=c>0 and 9>=D>0: if len(set([a,b,c,D]))==4: print(a,b) print(c,D) else: ...
143_A. Help Vasilisa the Wise 2
Vasilisa the Wise from the Kingdom of Far Far Away got a magic box with a secret as a present from her friend Hellawisa the Wise from the Kingdom of A Little Closer. However, Vasilisa the Wise does not know what the box's secret is, since she cannot open it again. She hopes that you will help her one more time with tha...
{ "input": [ "1 2\n3 4\n5 6\n", "11 10\n13 8\n5 16\n", "3 7\n4 6\n5 5\n", "10 10\n10 10\n10 10\n" ], "output": [ "-1\n", "4 7\n9 1\n", "1 2\n3 4\n", "-1\n" ] }
{ "input": [ "3 14\n8 9\n10 7\n", "12 11\n11 12\n16 7\n", "12 17\n10 19\n13 16\n", "9 12\n3 17\n10 10\n", "10 7\n4 13\n11 6\n", "7 9\n4 12\n5 11\n", "2 4\n1 5\n3 3\n", "13 8\n15 6\n11 10\n", "8 10\n9 9\n13 5\n", "12 7\n5 14\n8 11\n", "9 6\n5 10\n3 12\n", "16 5\n13 8\n10...
CORRECT
java
import java.io.*; import java.util.*; import java.lang.System; public class Solution{ static PrintStream out=System.out; static BufferedReader br=new BufferedReader(new InputStreamReader(System.in)); static StringTokenizer st; static Scanner sc=new Scanner(System.in); static void Task(){ int r1=ni(); int...
143_A. Help Vasilisa the Wise 2
Vasilisa the Wise from the Kingdom of Far Far Away got a magic box with a secret as a present from her friend Hellawisa the Wise from the Kingdom of A Little Closer. However, Vasilisa the Wise does not know what the box's secret is, since she cannot open it again. She hopes that you will help her one more time with tha...
{ "input": [ "1 2\n3 4\n5 6\n", "11 10\n13 8\n5 16\n", "3 7\n4 6\n5 5\n", "10 10\n10 10\n10 10\n" ], "output": [ "-1\n", "4 7\n9 1\n", "1 2\n3 4\n", "-1\n" ] }
{ "input": [ "3 14\n8 9\n10 7\n", "12 11\n11 12\n16 7\n", "12 17\n10 19\n13 16\n", "9 12\n3 17\n10 10\n", "10 7\n4 13\n11 6\n", "7 9\n4 12\n5 11\n", "2 4\n1 5\n3 3\n", "13 8\n15 6\n11 10\n", "8 10\n9 9\n13 5\n", "12 7\n5 14\n8 11\n", "9 6\n5 10\n3 12\n", "16 5\n13 8\n10...
CORRECT
python3
rows = list(map(int,input().split())) cols = list(map(int,input().split())) diags = list(map(int,input().split())) r1 = rows[0] r2 = rows[1] c1 = cols[0] c2 = cols[1] d1 = diags[0] d2 = diags[1] boo = True n = 9 for i in range(1,n+1): for j in range(1,n+1): for k in range(1,n+1): for l in ra...
143_A. Help Vasilisa the Wise 2
Vasilisa the Wise from the Kingdom of Far Far Away got a magic box with a secret as a present from her friend Hellawisa the Wise from the Kingdom of A Little Closer. However, Vasilisa the Wise does not know what the box's secret is, since she cannot open it again. She hopes that you will help her one more time with tha...
{ "input": [ "1 2\n3 4\n5 6\n", "11 10\n13 8\n5 16\n", "3 7\n4 6\n5 5\n", "10 10\n10 10\n10 10\n" ], "output": [ "-1\n", "4 7\n9 1\n", "1 2\n3 4\n", "-1\n" ] }
{ "input": [ "3 14\n8 9\n10 7\n", "12 11\n11 12\n16 7\n", "12 17\n10 19\n13 16\n", "9 12\n3 17\n10 10\n", "10 7\n4 13\n11 6\n", "7 9\n4 12\n5 11\n", "2 4\n1 5\n3 3\n", "13 8\n15 6\n11 10\n", "8 10\n9 9\n13 5\n", "12 7\n5 14\n8 11\n", "9 6\n5 10\n3 12\n", "16 5\n13 8\n10...
CORRECT
java
import java.util.Scanner; public class HelpVasilisaTheWise2 { public static void main(String[] args) { Scanner sc = new Scanner(System.in); int r1 = sc.nextInt(), r2 = sc.nextInt(); int c1 = sc.nextInt(), c2 = sc.nextInt(); int d1 = sc.nextInt(), d2 = sc.nextInt(); for (int a = 1; a <= 9; a++) for (int...
143_A. Help Vasilisa the Wise 2
Vasilisa the Wise from the Kingdom of Far Far Away got a magic box with a secret as a present from her friend Hellawisa the Wise from the Kingdom of A Little Closer. However, Vasilisa the Wise does not know what the box's secret is, since she cannot open it again. She hopes that you will help her one more time with tha...
{ "input": [ "1 2\n3 4\n5 6\n", "11 10\n13 8\n5 16\n", "3 7\n4 6\n5 5\n", "10 10\n10 10\n10 10\n" ], "output": [ "-1\n", "4 7\n9 1\n", "1 2\n3 4\n", "-1\n" ] }
{ "input": [ "3 14\n8 9\n10 7\n", "12 11\n11 12\n16 7\n", "12 17\n10 19\n13 16\n", "9 12\n3 17\n10 10\n", "10 7\n4 13\n11 6\n", "7 9\n4 12\n5 11\n", "2 4\n1 5\n3 3\n", "13 8\n15 6\n11 10\n", "8 10\n9 9\n13 5\n", "12 7\n5 14\n8 11\n", "9 6\n5 10\n3 12\n", "16 5\n13 8\n10...
CORRECT
java
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStream; import java.io.InputStreamReader; import java.io.PrintWriter; import java.util.StringTokenizer; public class HelpVasilisaTheWise2 { public static void main(String[] args) { PrintWriter pw = new PrintWriter(System.out); reade...
143_A. Help Vasilisa the Wise 2
Vasilisa the Wise from the Kingdom of Far Far Away got a magic box with a secret as a present from her friend Hellawisa the Wise from the Kingdom of A Little Closer. However, Vasilisa the Wise does not know what the box's secret is, since she cannot open it again. She hopes that you will help her one more time with tha...
{ "input": [ "1 2\n3 4\n5 6\n", "11 10\n13 8\n5 16\n", "3 7\n4 6\n5 5\n", "10 10\n10 10\n10 10\n" ], "output": [ "-1\n", "4 7\n9 1\n", "1 2\n3 4\n", "-1\n" ] }
{ "input": [ "3 14\n8 9\n10 7\n", "12 11\n11 12\n16 7\n", "12 17\n10 19\n13 16\n", "9 12\n3 17\n10 10\n", "10 7\n4 13\n11 6\n", "7 9\n4 12\n5 11\n", "2 4\n1 5\n3 3\n", "13 8\n15 6\n11 10\n", "8 10\n9 9\n13 5\n", "12 7\n5 14\n8 11\n", "9 6\n5 10\n3 12\n", "16 5\n13 8\n10...
CORRECT
python3
import os import sys from io import BytesIO, IOBase BUFSIZE = 8192 class FastIO(IOBase): newlines = 0 def __init__(self, file): self._fd = file.fileno() self.buffer = BytesIO() self.writable = "x" in file.mode or "r" not in file.mode self.write = self.buffer.write if self...
143_A. Help Vasilisa the Wise 2
Vasilisa the Wise from the Kingdom of Far Far Away got a magic box with a secret as a present from her friend Hellawisa the Wise from the Kingdom of A Little Closer. However, Vasilisa the Wise does not know what the box's secret is, since she cannot open it again. She hopes that you will help her one more time with tha...
{ "input": [ "1 2\n3 4\n5 6\n", "11 10\n13 8\n5 16\n", "3 7\n4 6\n5 5\n", "10 10\n10 10\n10 10\n" ], "output": [ "-1\n", "4 7\n9 1\n", "1 2\n3 4\n", "-1\n" ] }
{ "input": [ "3 14\n8 9\n10 7\n", "12 11\n11 12\n16 7\n", "12 17\n10 19\n13 16\n", "9 12\n3 17\n10 10\n", "10 7\n4 13\n11 6\n", "7 9\n4 12\n5 11\n", "2 4\n1 5\n3 3\n", "13 8\n15 6\n11 10\n", "8 10\n9 9\n13 5\n", "12 7\n5 14\n8 11\n", "9 6\n5 10\n3 12\n", "16 5\n13 8\n10...
CORRECT
cpp
#include <bits/stdc++.h> using namespace std; bool comp(int n) { return n > 0 && n < 10; } bool noteq(int a, int b, int c, int d) { return a != b && a != c && a != d && b != c && b != d && c != d; } int main() { ios_base::sync_with_stdio(false); cin.tie(NULL); int r1, r2, c1, c2, d1, d2; cin >> r1 >> r2 >> c1...
143_A. Help Vasilisa the Wise 2
Vasilisa the Wise from the Kingdom of Far Far Away got a magic box with a secret as a present from her friend Hellawisa the Wise from the Kingdom of A Little Closer. However, Vasilisa the Wise does not know what the box's secret is, since she cannot open it again. She hopes that you will help her one more time with tha...
{ "input": [ "1 2\n3 4\n5 6\n", "11 10\n13 8\n5 16\n", "3 7\n4 6\n5 5\n", "10 10\n10 10\n10 10\n" ], "output": [ "-1\n", "4 7\n9 1\n", "1 2\n3 4\n", "-1\n" ] }
{ "input": [ "3 14\n8 9\n10 7\n", "12 11\n11 12\n16 7\n", "12 17\n10 19\n13 16\n", "9 12\n3 17\n10 10\n", "10 7\n4 13\n11 6\n", "7 9\n4 12\n5 11\n", "2 4\n1 5\n3 3\n", "13 8\n15 6\n11 10\n", "8 10\n9 9\n13 5\n", "12 7\n5 14\n8 11\n", "9 6\n5 10\n3 12\n", "16 5\n13 8\n10...
CORRECT
cpp
#include <bits/stdc++.h> const int Inf = 2e9; long long LINF = (long long)4e18; using namespace std; int r1, r2, c1, c2, d1, d2; bool ok(int i, int j, int k, int l) { if (i + j != r1) return false; if (k + l != r2) return false; if (i + k != c1) return false; if (j + l != c2) return false; if (i + l != d1) re...
143_A. Help Vasilisa the Wise 2
Vasilisa the Wise from the Kingdom of Far Far Away got a magic box with a secret as a present from her friend Hellawisa the Wise from the Kingdom of A Little Closer. However, Vasilisa the Wise does not know what the box's secret is, since she cannot open it again. She hopes that you will help her one more time with tha...
{ "input": [ "1 2\n3 4\n5 6\n", "11 10\n13 8\n5 16\n", "3 7\n4 6\n5 5\n", "10 10\n10 10\n10 10\n" ], "output": [ "-1\n", "4 7\n9 1\n", "1 2\n3 4\n", "-1\n" ] }
{ "input": [ "3 14\n8 9\n10 7\n", "12 11\n11 12\n16 7\n", "12 17\n10 19\n13 16\n", "9 12\n3 17\n10 10\n", "10 7\n4 13\n11 6\n", "7 9\n4 12\n5 11\n", "2 4\n1 5\n3 3\n", "13 8\n15 6\n11 10\n", "8 10\n9 9\n13 5\n", "12 7\n5 14\n8 11\n", "9 6\n5 10\n3 12\n", "16 5\n13 8\n10...
CORRECT
cpp
#include <bits/stdc++.h> using namespace std; void SR(int &x) { scanf("%d", &x); } void SR(long long &x) { scanf("%lld", &x); } void SR(double &x) { scanf("%lf", &x); } void SR(char *s) { scanf("%s", s); } void RI() {} template <typename I, typename... T> void RI(I &x, T &...tail) { SR(x); RI(tail...); } int main()...
143_A. Help Vasilisa the Wise 2
Vasilisa the Wise from the Kingdom of Far Far Away got a magic box with a secret as a present from her friend Hellawisa the Wise from the Kingdom of A Little Closer. However, Vasilisa the Wise does not know what the box's secret is, since she cannot open it again. She hopes that you will help her one more time with tha...
{ "input": [ "1 2\n3 4\n5 6\n", "11 10\n13 8\n5 16\n", "3 7\n4 6\n5 5\n", "10 10\n10 10\n10 10\n" ], "output": [ "-1\n", "4 7\n9 1\n", "1 2\n3 4\n", "-1\n" ] }
{ "input": [ "3 14\n8 9\n10 7\n", "12 11\n11 12\n16 7\n", "12 17\n10 19\n13 16\n", "9 12\n3 17\n10 10\n", "10 7\n4 13\n11 6\n", "7 9\n4 12\n5 11\n", "2 4\n1 5\n3 3\n", "13 8\n15 6\n11 10\n", "8 10\n9 9\n13 5\n", "12 7\n5 14\n8 11\n", "9 6\n5 10\n3 12\n", "16 5\n13 8\n10...
CORRECT
python3
r1, r2 = map(int, input().split()) c1, c2 = map(int, input().split()) d1, d2 = map(int, input().split()) l1 = [] l2 = [] for i in range(1, 10): for j in range(1, 10): if i + j == r1: l1.append([i, j]) if i + j == r2: l2.append([i, j]) lp = [] for i in l1: for j in l2: if i[0] + j[0] == c1 and i[1] + ...
143_A. Help Vasilisa the Wise 2
Vasilisa the Wise from the Kingdom of Far Far Away got a magic box with a secret as a present from her friend Hellawisa the Wise from the Kingdom of A Little Closer. However, Vasilisa the Wise does not know what the box's secret is, since she cannot open it again. She hopes that you will help her one more time with tha...
{ "input": [ "1 2\n3 4\n5 6\n", "11 10\n13 8\n5 16\n", "3 7\n4 6\n5 5\n", "10 10\n10 10\n10 10\n" ], "output": [ "-1\n", "4 7\n9 1\n", "1 2\n3 4\n", "-1\n" ] }
{ "input": [ "3 14\n8 9\n10 7\n", "12 11\n11 12\n16 7\n", "12 17\n10 19\n13 16\n", "9 12\n3 17\n10 10\n", "10 7\n4 13\n11 6\n", "7 9\n4 12\n5 11\n", "2 4\n1 5\n3 3\n", "13 8\n15 6\n11 10\n", "8 10\n9 9\n13 5\n", "12 7\n5 14\n8 11\n", "9 6\n5 10\n3 12\n", "16 5\n13 8\n10...
CORRECT
cpp
#include <bits/stdc++.h> using namespace std; int c[10]; int main() { int r1, r2, c1, c2, d1, d2; cin >> r1 >> r2 >> c1 >> c2 >> d1 >> d2; int x1, x2, x3, x4; x2 = (c2 - r2 + d2) / 2; x3 = (r2 - c2 + d2) / 2; x1 = r1 - x2; x4 = c2 - x2; int flag = 0; if (x1 + x2 == r1 && x3 + x4 == r2 && x1 + x3 == c1...
143_A. Help Vasilisa the Wise 2
Vasilisa the Wise from the Kingdom of Far Far Away got a magic box with a secret as a present from her friend Hellawisa the Wise from the Kingdom of A Little Closer. However, Vasilisa the Wise does not know what the box's secret is, since she cannot open it again. She hopes that you will help her one more time with tha...
{ "input": [ "1 2\n3 4\n5 6\n", "11 10\n13 8\n5 16\n", "3 7\n4 6\n5 5\n", "10 10\n10 10\n10 10\n" ], "output": [ "-1\n", "4 7\n9 1\n", "1 2\n3 4\n", "-1\n" ] }
{ "input": [ "3 14\n8 9\n10 7\n", "12 11\n11 12\n16 7\n", "12 17\n10 19\n13 16\n", "9 12\n3 17\n10 10\n", "10 7\n4 13\n11 6\n", "7 9\n4 12\n5 11\n", "2 4\n1 5\n3 3\n", "13 8\n15 6\n11 10\n", "8 10\n9 9\n13 5\n", "12 7\n5 14\n8 11\n", "9 6\n5 10\n3 12\n", "16 5\n13 8\n10...
CORRECT
python3
# Help Vasilisa the Wise 2 import itertools def calculate(r1, r2, c1, c2, d1, d2): combinations = list(itertools.permutations([i for i in range(1,10)], 4)) for (x1, x2, x3, x4) in combinations: r1_sum = x1 + x2 r2_sum = x3 + x4 c1_sum = x1 + x3 c2_sum = x2 + x4 d1_sum ...
143_A. Help Vasilisa the Wise 2
Vasilisa the Wise from the Kingdom of Far Far Away got a magic box with a secret as a present from her friend Hellawisa the Wise from the Kingdom of A Little Closer. However, Vasilisa the Wise does not know what the box's secret is, since she cannot open it again. She hopes that you will help her one more time with tha...
{ "input": [ "1 2\n3 4\n5 6\n", "11 10\n13 8\n5 16\n", "3 7\n4 6\n5 5\n", "10 10\n10 10\n10 10\n" ], "output": [ "-1\n", "4 7\n9 1\n", "1 2\n3 4\n", "-1\n" ] }
{ "input": [ "3 14\n8 9\n10 7\n", "12 11\n11 12\n16 7\n", "12 17\n10 19\n13 16\n", "9 12\n3 17\n10 10\n", "10 7\n4 13\n11 6\n", "7 9\n4 12\n5 11\n", "2 4\n1 5\n3 3\n", "13 8\n15 6\n11 10\n", "8 10\n9 9\n13 5\n", "12 7\n5 14\n8 11\n", "9 6\n5 10\n3 12\n", "16 5\n13 8\n10...
CORRECT
python2
(r1,r2),(c1,c2),(d1,d2) = [[int(c) for c in raw_input().split()] for i in xrange(3)] A = (r1+c1-d2)/2 B = r1-A C = c1-A D = r2-C if len(set([A,B,C,D]))==4 and all(i in xrange(1,10) for i in [A,B,C,D]) and c2==B+D and d1==A+D and d2==B+C: print A,B print C,D else: print -1
143_A. Help Vasilisa the Wise 2
Vasilisa the Wise from the Kingdom of Far Far Away got a magic box with a secret as a present from her friend Hellawisa the Wise from the Kingdom of A Little Closer. However, Vasilisa the Wise does not know what the box's secret is, since she cannot open it again. She hopes that you will help her one more time with tha...
{ "input": [ "1 2\n3 4\n5 6\n", "11 10\n13 8\n5 16\n", "3 7\n4 6\n5 5\n", "10 10\n10 10\n10 10\n" ], "output": [ "-1\n", "4 7\n9 1\n", "1 2\n3 4\n", "-1\n" ] }
{ "input": [ "3 14\n8 9\n10 7\n", "12 11\n11 12\n16 7\n", "12 17\n10 19\n13 16\n", "9 12\n3 17\n10 10\n", "10 7\n4 13\n11 6\n", "7 9\n4 12\n5 11\n", "2 4\n1 5\n3 3\n", "13 8\n15 6\n11 10\n", "8 10\n9 9\n13 5\n", "12 7\n5 14\n8 11\n", "9 6\n5 10\n3 12\n", "16 5\n13 8\n10...
CORRECT
java
import java.io.*; import java.util.*; public class Test { static BufferedReader reader; static StringTokenizer tokenizer; static PrintWriter writer; static int nextInt() throws IOException { return Integer.parseInt(nextToken()); } static long nextLong() throws IOException { return Long.parseLong(nextToken(...
143_A. Help Vasilisa the Wise 2
Vasilisa the Wise from the Kingdom of Far Far Away got a magic box with a secret as a present from her friend Hellawisa the Wise from the Kingdom of A Little Closer. However, Vasilisa the Wise does not know what the box's secret is, since she cannot open it again. She hopes that you will help her one more time with tha...
{ "input": [ "1 2\n3 4\n5 6\n", "11 10\n13 8\n5 16\n", "3 7\n4 6\n5 5\n", "10 10\n10 10\n10 10\n" ], "output": [ "-1\n", "4 7\n9 1\n", "1 2\n3 4\n", "-1\n" ] }
{ "input": [ "3 14\n8 9\n10 7\n", "12 11\n11 12\n16 7\n", "12 17\n10 19\n13 16\n", "9 12\n3 17\n10 10\n", "10 7\n4 13\n11 6\n", "7 9\n4 12\n5 11\n", "2 4\n1 5\n3 3\n", "13 8\n15 6\n11 10\n", "8 10\n9 9\n13 5\n", "12 7\n5 14\n8 11\n", "9 6\n5 10\n3 12\n", "16 5\n13 8\n10...
CORRECT
python2
#################################################### # -*- coding: utf-8 -*- import sys w = sys.stdout.write read = sys.stdin.readline reads = sys.stdin.read def r(f=None): if f: return map(f, read().split()) else: return read().split() def rs(t,f=None): result = [] result_append = re...
143_A. Help Vasilisa the Wise 2
Vasilisa the Wise from the Kingdom of Far Far Away got a magic box with a secret as a present from her friend Hellawisa the Wise from the Kingdom of A Little Closer. However, Vasilisa the Wise does not know what the box's secret is, since she cannot open it again. She hopes that you will help her one more time with tha...
{ "input": [ "1 2\n3 4\n5 6\n", "11 10\n13 8\n5 16\n", "3 7\n4 6\n5 5\n", "10 10\n10 10\n10 10\n" ], "output": [ "-1\n", "4 7\n9 1\n", "1 2\n3 4\n", "-1\n" ] }
{ "input": [ "3 14\n8 9\n10 7\n", "12 11\n11 12\n16 7\n", "12 17\n10 19\n13 16\n", "9 12\n3 17\n10 10\n", "10 7\n4 13\n11 6\n", "7 9\n4 12\n5 11\n", "2 4\n1 5\n3 3\n", "13 8\n15 6\n11 10\n", "8 10\n9 9\n13 5\n", "12 7\n5 14\n8 11\n", "9 6\n5 10\n3 12\n", "16 5\n13 8\n10...
CORRECT
java
import java.util.Scanner; public class Test { public static void main(String[] args) { Scanner sc = new Scanner(System.in); int a[][] = new int[3][2]; int x, y, z, w; for (int i = 0; i < 3; i++) { for (int j = 0; j < 2; j++) { a[i][j] = sc.nextInt(); ...
143_A. Help Vasilisa the Wise 2
Vasilisa the Wise from the Kingdom of Far Far Away got a magic box with a secret as a present from her friend Hellawisa the Wise from the Kingdom of A Little Closer. However, Vasilisa the Wise does not know what the box's secret is, since she cannot open it again. She hopes that you will help her one more time with tha...
{ "input": [ "1 2\n3 4\n5 6\n", "11 10\n13 8\n5 16\n", "3 7\n4 6\n5 5\n", "10 10\n10 10\n10 10\n" ], "output": [ "-1\n", "4 7\n9 1\n", "1 2\n3 4\n", "-1\n" ] }
{ "input": [ "3 14\n8 9\n10 7\n", "12 11\n11 12\n16 7\n", "12 17\n10 19\n13 16\n", "9 12\n3 17\n10 10\n", "10 7\n4 13\n11 6\n", "7 9\n4 12\n5 11\n", "2 4\n1 5\n3 3\n", "13 8\n15 6\n11 10\n", "8 10\n9 9\n13 5\n", "12 7\n5 14\n8 11\n", "9 6\n5 10\n3 12\n", "16 5\n13 8\n10...
CORRECT
python2
r = [int(s) for s in raw_input().split()] c = [int(s) for s in raw_input().split()] d = [int(s) for s in raw_input().split()] found = False for i in range (1, 10): for j in range (1, 10): for k in range (1, 10): for l in range (1, 10): if found: break ...
143_A. Help Vasilisa the Wise 2
Vasilisa the Wise from the Kingdom of Far Far Away got a magic box with a secret as a present from her friend Hellawisa the Wise from the Kingdom of A Little Closer. However, Vasilisa the Wise does not know what the box's secret is, since she cannot open it again. She hopes that you will help her one more time with tha...
{ "input": [ "1 2\n3 4\n5 6\n", "11 10\n13 8\n5 16\n", "3 7\n4 6\n5 5\n", "10 10\n10 10\n10 10\n" ], "output": [ "-1\n", "4 7\n9 1\n", "1 2\n3 4\n", "-1\n" ] }
{ "input": [ "3 14\n8 9\n10 7\n", "12 11\n11 12\n16 7\n", "12 17\n10 19\n13 16\n", "9 12\n3 17\n10 10\n", "10 7\n4 13\n11 6\n", "7 9\n4 12\n5 11\n", "2 4\n1 5\n3 3\n", "13 8\n15 6\n11 10\n", "8 10\n9 9\n13 5\n", "12 7\n5 14\n8 11\n", "9 6\n5 10\n3 12\n", "16 5\n13 8\n10...
CORRECT
cpp
#include <bits/stdc++.h> int main() { int r1, r2, c1, c2, d1, d2; scanf("%d%d%d%d%d%d", &r1, &r2, &c1, &c2, &d1, &d2); for (int i = 1; i < 10; i++) for (int j = 1; j < 10; j++) if (i != j) for (int k = 1; k < 10; k++) if (k != i && k != j) for (int l = 1; l < 10; l++) ...
143_A. Help Vasilisa the Wise 2
Vasilisa the Wise from the Kingdom of Far Far Away got a magic box with a secret as a present from her friend Hellawisa the Wise from the Kingdom of A Little Closer. However, Vasilisa the Wise does not know what the box's secret is, since she cannot open it again. She hopes that you will help her one more time with tha...
{ "input": [ "1 2\n3 4\n5 6\n", "11 10\n13 8\n5 16\n", "3 7\n4 6\n5 5\n", "10 10\n10 10\n10 10\n" ], "output": [ "-1\n", "4 7\n9 1\n", "1 2\n3 4\n", "-1\n" ] }
{ "input": [ "3 14\n8 9\n10 7\n", "12 11\n11 12\n16 7\n", "12 17\n10 19\n13 16\n", "9 12\n3 17\n10 10\n", "10 7\n4 13\n11 6\n", "7 9\n4 12\n5 11\n", "2 4\n1 5\n3 3\n", "13 8\n15 6\n11 10\n", "8 10\n9 9\n13 5\n", "12 7\n5 14\n8 11\n", "9 6\n5 10\n3 12\n", "16 5\n13 8\n10...
CORRECT
cpp
#include <bits/stdc++.h> #pragma comment(linker, "/STACK:102400000,102400000") using namespace std; const int MAXN = 100000 + 10; const int INF = 0x7fffffff; bool vis[10]; int main() { int r1, r2, c1, c2, d1, d2, a, b, c, d; while (scanf("%d%d%d%d%d%d", &r1, &r2, &c1, &c2, &d1, &d2) == 6) { bool f = false; ...
143_A. Help Vasilisa the Wise 2
Vasilisa the Wise from the Kingdom of Far Far Away got a magic box with a secret as a present from her friend Hellawisa the Wise from the Kingdom of A Little Closer. However, Vasilisa the Wise does not know what the box's secret is, since she cannot open it again. She hopes that you will help her one more time with tha...
{ "input": [ "1 2\n3 4\n5 6\n", "11 10\n13 8\n5 16\n", "3 7\n4 6\n5 5\n", "10 10\n10 10\n10 10\n" ], "output": [ "-1\n", "4 7\n9 1\n", "1 2\n3 4\n", "-1\n" ] }
{ "input": [ "3 14\n8 9\n10 7\n", "12 11\n11 12\n16 7\n", "12 17\n10 19\n13 16\n", "9 12\n3 17\n10 10\n", "10 7\n4 13\n11 6\n", "7 9\n4 12\n5 11\n", "2 4\n1 5\n3 3\n", "13 8\n15 6\n11 10\n", "8 10\n9 9\n13 5\n", "12 7\n5 14\n8 11\n", "9 6\n5 10\n3 12\n", "16 5\n13 8\n10...
CORRECT
python2
r1, r2 = raw_input().split() c1, c2 = raw_input().split() d1, d2 = raw_input().split() sol = [0, 0, 0, 0] # [0][1] # [2][3] for num in range(1,10): numUsed = [] sol[0] = num numUsed.append(num) second = int(r1) - sol[0] if second < 1 or second > 9 or second in numUsed: continue sol[1] = second numUsed.app...
143_A. Help Vasilisa the Wise 2
Vasilisa the Wise from the Kingdom of Far Far Away got a magic box with a secret as a present from her friend Hellawisa the Wise from the Kingdom of A Little Closer. However, Vasilisa the Wise does not know what the box's secret is, since she cannot open it again. She hopes that you will help her one more time with tha...
{ "input": [ "1 2\n3 4\n5 6\n", "11 10\n13 8\n5 16\n", "3 7\n4 6\n5 5\n", "10 10\n10 10\n10 10\n" ], "output": [ "-1\n", "4 7\n9 1\n", "1 2\n3 4\n", "-1\n" ] }
{ "input": [ "3 14\n8 9\n10 7\n", "12 11\n11 12\n16 7\n", "12 17\n10 19\n13 16\n", "9 12\n3 17\n10 10\n", "10 7\n4 13\n11 6\n", "7 9\n4 12\n5 11\n", "2 4\n1 5\n3 3\n", "13 8\n15 6\n11 10\n", "8 10\n9 9\n13 5\n", "12 7\n5 14\n8 11\n", "9 6\n5 10\n3 12\n", "16 5\n13 8\n10...
CORRECT
cpp
#include <bits/stdc++.h> using namespace std; int main() { int c1, c2, r1, r2, d1, d2, x[5], i, j; cin >> r1 >> r2; cin >> c1 >> c2; cin >> d1 >> d2; x[3] = ((r1 - d1) + c2) / 2; x[2] = d2 - x[3]; x[4] = c2 - x[3]; x[1] = d1 - x[4]; if (x[1] + x[2] == c1 && x[3] + x[4] == c2 && x[1] + x[3] == r1 && ...
143_A. Help Vasilisa the Wise 2
Vasilisa the Wise from the Kingdom of Far Far Away got a magic box with a secret as a present from her friend Hellawisa the Wise from the Kingdom of A Little Closer. However, Vasilisa the Wise does not know what the box's secret is, since she cannot open it again. She hopes that you will help her one more time with tha...
{ "input": [ "1 2\n3 4\n5 6\n", "11 10\n13 8\n5 16\n", "3 7\n4 6\n5 5\n", "10 10\n10 10\n10 10\n" ], "output": [ "-1\n", "4 7\n9 1\n", "1 2\n3 4\n", "-1\n" ] }
{ "input": [ "3 14\n8 9\n10 7\n", "12 11\n11 12\n16 7\n", "12 17\n10 19\n13 16\n", "9 12\n3 17\n10 10\n", "10 7\n4 13\n11 6\n", "7 9\n4 12\n5 11\n", "2 4\n1 5\n3 3\n", "13 8\n15 6\n11 10\n", "8 10\n9 9\n13 5\n", "12 7\n5 14\n8 11\n", "9 6\n5 10\n3 12\n", "16 5\n13 8\n10...
CORRECT
java
import java.util.*; public class cf143a { public static void main(String[] args) { Scanner in = new Scanner(System.in); int r1 = in.nextInt(); int r2 = in.nextInt(); int c1 = in.nextInt(); int c2 = in.nextInt(); int d1 = in.nextInt(); int d2 = in.nextInt(); for(int a=1; a<10; a++) for(int b=1; b<10...
143_A. Help Vasilisa the Wise 2
Vasilisa the Wise from the Kingdom of Far Far Away got a magic box with a secret as a present from her friend Hellawisa the Wise from the Kingdom of A Little Closer. However, Vasilisa the Wise does not know what the box's secret is, since she cannot open it again. She hopes that you will help her one more time with tha...
{ "input": [ "1 2\n3 4\n5 6\n", "11 10\n13 8\n5 16\n", "3 7\n4 6\n5 5\n", "10 10\n10 10\n10 10\n" ], "output": [ "-1\n", "4 7\n9 1\n", "1 2\n3 4\n", "-1\n" ] }
{ "input": [ "3 14\n8 9\n10 7\n", "12 11\n11 12\n16 7\n", "12 17\n10 19\n13 16\n", "9 12\n3 17\n10 10\n", "10 7\n4 13\n11 6\n", "7 9\n4 12\n5 11\n", "2 4\n1 5\n3 3\n", "13 8\n15 6\n11 10\n", "8 10\n9 9\n13 5\n", "12 7\n5 14\n8 11\n", "9 6\n5 10\n3 12\n", "16 5\n13 8\n10...
CORRECT
java
import java.util.Scanner; public class HelpVasilisatheWise2 { public static void main(String[] args) { Scanner input = new Scanner(System.in); int r1 = input.nextInt(); int r2 = input.nextInt(); int c1 = input.nextInt(); int c2 = input.nextInt(); int d1 = input.nextInt(); int d2 = input.nextInt(); if...
143_A. Help Vasilisa the Wise 2
Vasilisa the Wise from the Kingdom of Far Far Away got a magic box with a secret as a present from her friend Hellawisa the Wise from the Kingdom of A Little Closer. However, Vasilisa the Wise does not know what the box's secret is, since she cannot open it again. She hopes that you will help her one more time with tha...
{ "input": [ "1 2\n3 4\n5 6\n", "11 10\n13 8\n5 16\n", "3 7\n4 6\n5 5\n", "10 10\n10 10\n10 10\n" ], "output": [ "-1\n", "4 7\n9 1\n", "1 2\n3 4\n", "-1\n" ] }
{ "input": [ "3 14\n8 9\n10 7\n", "12 11\n11 12\n16 7\n", "12 17\n10 19\n13 16\n", "9 12\n3 17\n10 10\n", "10 7\n4 13\n11 6\n", "7 9\n4 12\n5 11\n", "2 4\n1 5\n3 3\n", "13 8\n15 6\n11 10\n", "8 10\n9 9\n13 5\n", "12 7\n5 14\n8 11\n", "9 6\n5 10\n3 12\n", "16 5\n13 8\n10...
CORRECT
cpp
#include <bits/stdc++.h> using namespace std; int r1, r2, c1, c2, d1, d2; int board[2][2]; bool taken[10]; bool ans; void check() { int a = board[0][0] + board[0][1]; int b = board[1][0] + board[1][1]; int c = board[0][0] + board[1][1]; int d = board[0][1] + board[1][0]; int e = board[0][0] + board[1][0]; i...
143_A. Help Vasilisa the Wise 2
Vasilisa the Wise from the Kingdom of Far Far Away got a magic box with a secret as a present from her friend Hellawisa the Wise from the Kingdom of A Little Closer. However, Vasilisa the Wise does not know what the box's secret is, since she cannot open it again. She hopes that you will help her one more time with tha...
{ "input": [ "1 2\n3 4\n5 6\n", "11 10\n13 8\n5 16\n", "3 7\n4 6\n5 5\n", "10 10\n10 10\n10 10\n" ], "output": [ "-1\n", "4 7\n9 1\n", "1 2\n3 4\n", "-1\n" ] }
{ "input": [ "3 14\n8 9\n10 7\n", "12 11\n11 12\n16 7\n", "12 17\n10 19\n13 16\n", "9 12\n3 17\n10 10\n", "10 7\n4 13\n11 6\n", "7 9\n4 12\n5 11\n", "2 4\n1 5\n3 3\n", "13 8\n15 6\n11 10\n", "8 10\n9 9\n13 5\n", "12 7\n5 14\n8 11\n", "9 6\n5 10\n3 12\n", "16 5\n13 8\n10...
IN-CORRECT
python3
r1,r2=[int(x) for x in input().split()] c1,c2=[int(x) for x in input().split()] d1,d2=[int(x) for x in input().split()] a1=(r1+c1-d2)//2 a2=abs(r1-a1) a3=abs(c1-a1) a4=abs(r2-a3) if a1>0: print(a1,a2) print(a3,a4) else: print('-1')
143_A. Help Vasilisa the Wise 2
Vasilisa the Wise from the Kingdom of Far Far Away got a magic box with a secret as a present from her friend Hellawisa the Wise from the Kingdom of A Little Closer. However, Vasilisa the Wise does not know what the box's secret is, since she cannot open it again. She hopes that you will help her one more time with tha...
{ "input": [ "1 2\n3 4\n5 6\n", "11 10\n13 8\n5 16\n", "3 7\n4 6\n5 5\n", "10 10\n10 10\n10 10\n" ], "output": [ "-1\n", "4 7\n9 1\n", "1 2\n3 4\n", "-1\n" ] }
{ "input": [ "3 14\n8 9\n10 7\n", "12 11\n11 12\n16 7\n", "12 17\n10 19\n13 16\n", "9 12\n3 17\n10 10\n", "10 7\n4 13\n11 6\n", "7 9\n4 12\n5 11\n", "2 4\n1 5\n3 3\n", "13 8\n15 6\n11 10\n", "8 10\n9 9\n13 5\n", "12 7\n5 14\n8 11\n", "9 6\n5 10\n3 12\n", "16 5\n13 8\n10...
IN-CORRECT
java
import java.util.Scanner; public class HelpVasilisaTheWise2 { public static void main(String[] args) { Scanner sc = new Scanner(System.in); int r1 = sc.nextInt(), r2 = sc.nextInt(); int c1 = sc.nextInt(), c2 = sc.nextInt(); int d1 = sc.nextInt(), d2 = sc.nextInt(); for (int a = 0; a <= 9; a++) for (int...
143_A. Help Vasilisa the Wise 2
Vasilisa the Wise from the Kingdom of Far Far Away got a magic box with a secret as a present from her friend Hellawisa the Wise from the Kingdom of A Little Closer. However, Vasilisa the Wise does not know what the box's secret is, since she cannot open it again. She hopes that you will help her one more time with tha...
{ "input": [ "1 2\n3 4\n5 6\n", "11 10\n13 8\n5 16\n", "3 7\n4 6\n5 5\n", "10 10\n10 10\n10 10\n" ], "output": [ "-1\n", "4 7\n9 1\n", "1 2\n3 4\n", "-1\n" ] }
{ "input": [ "3 14\n8 9\n10 7\n", "12 11\n11 12\n16 7\n", "12 17\n10 19\n13 16\n", "9 12\n3 17\n10 10\n", "10 7\n4 13\n11 6\n", "7 9\n4 12\n5 11\n", "2 4\n1 5\n3 3\n", "13 8\n15 6\n11 10\n", "8 10\n9 9\n13 5\n", "12 7\n5 14\n8 11\n", "9 6\n5 10\n3 12\n", "16 5\n13 8\n10...
IN-CORRECT
python3
import sys import math r1, r2 = [int(x) for x in (sys.stdin.readline()).split()] c1, c2 = [int(x) for x in (sys.stdin.readline()).split()] d1, d2 = [int(x) for x in (sys.stdin.readline()).split()] for i in range(1, 10): a1 = i a2 = r1 - i a3 = c1 - i a4 = d1 - i if(a1 > 0 and a1 < 10 and a2 >...
143_A. Help Vasilisa the Wise 2
Vasilisa the Wise from the Kingdom of Far Far Away got a magic box with a secret as a present from her friend Hellawisa the Wise from the Kingdom of A Little Closer. However, Vasilisa the Wise does not know what the box's secret is, since she cannot open it again. She hopes that you will help her one more time with tha...
{ "input": [ "1 2\n3 4\n5 6\n", "11 10\n13 8\n5 16\n", "3 7\n4 6\n5 5\n", "10 10\n10 10\n10 10\n" ], "output": [ "-1\n", "4 7\n9 1\n", "1 2\n3 4\n", "-1\n" ] }
{ "input": [ "3 14\n8 9\n10 7\n", "12 11\n11 12\n16 7\n", "12 17\n10 19\n13 16\n", "9 12\n3 17\n10 10\n", "10 7\n4 13\n11 6\n", "7 9\n4 12\n5 11\n", "2 4\n1 5\n3 3\n", "13 8\n15 6\n11 10\n", "8 10\n9 9\n13 5\n", "12 7\n5 14\n8 11\n", "9 6\n5 10\n3 12\n", "16 5\n13 8\n10...
IN-CORRECT
java
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; public class WiseVasilisa{ public static void main(String[] args) throws IOException { BufferedReader bf=new BufferedReader(new InputStreamReader(System.in)); String[] s=bf.readLine().split(" "); int r1=Integer....
143_A. Help Vasilisa the Wise 2
Vasilisa the Wise from the Kingdom of Far Far Away got a magic box with a secret as a present from her friend Hellawisa the Wise from the Kingdom of A Little Closer. However, Vasilisa the Wise does not know what the box's secret is, since she cannot open it again. She hopes that you will help her one more time with tha...
{ "input": [ "1 2\n3 4\n5 6\n", "11 10\n13 8\n5 16\n", "3 7\n4 6\n5 5\n", "10 10\n10 10\n10 10\n" ], "output": [ "-1\n", "4 7\n9 1\n", "1 2\n3 4\n", "-1\n" ] }
{ "input": [ "3 14\n8 9\n10 7\n", "12 11\n11 12\n16 7\n", "12 17\n10 19\n13 16\n", "9 12\n3 17\n10 10\n", "10 7\n4 13\n11 6\n", "7 9\n4 12\n5 11\n", "2 4\n1 5\n3 3\n", "13 8\n15 6\n11 10\n", "8 10\n9 9\n13 5\n", "12 7\n5 14\n8 11\n", "9 6\n5 10\n3 12\n", "16 5\n13 8\n10...
IN-CORRECT
java
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; public class R102A { /** * @param args */ public static void main(String[] args) { int[] sums = readInts(); int i,j = 0,k = 0,l = 0; boolean hasSol = false; for(i = 1; i <= 9;...
143_A. Help Vasilisa the Wise 2
Vasilisa the Wise from the Kingdom of Far Far Away got a magic box with a secret as a present from her friend Hellawisa the Wise from the Kingdom of A Little Closer. However, Vasilisa the Wise does not know what the box's secret is, since she cannot open it again. She hopes that you will help her one more time with tha...
{ "input": [ "1 2\n3 4\n5 6\n", "11 10\n13 8\n5 16\n", "3 7\n4 6\n5 5\n", "10 10\n10 10\n10 10\n" ], "output": [ "-1\n", "4 7\n9 1\n", "1 2\n3 4\n", "-1\n" ] }
{ "input": [ "3 14\n8 9\n10 7\n", "12 11\n11 12\n16 7\n", "12 17\n10 19\n13 16\n", "9 12\n3 17\n10 10\n", "10 7\n4 13\n11 6\n", "7 9\n4 12\n5 11\n", "2 4\n1 5\n3 3\n", "13 8\n15 6\n11 10\n", "8 10\n9 9\n13 5\n", "12 7\n5 14\n8 11\n", "9 6\n5 10\n3 12\n", "16 5\n13 8\n10...
IN-CORRECT
cpp
#include <bits/stdc++.h> using namespace std; int main() { int a, b, c, d; int r1, r2, d1, d2, c1, c2; int i, j, k, l; int flag = 0; cin >> r1 >> r2 >> c1 >> c2 >> d1 >> d2; for (i = 1; i <= 9; i++) { if (flag) break; for (j = 1; j < +9; j++) { if (flag) break; for (k = 1; k <= 9; k++) ...
143_A. Help Vasilisa the Wise 2
Vasilisa the Wise from the Kingdom of Far Far Away got a magic box with a secret as a present from her friend Hellawisa the Wise from the Kingdom of A Little Closer. However, Vasilisa the Wise does not know what the box's secret is, since she cannot open it again. She hopes that you will help her one more time with tha...
{ "input": [ "1 2\n3 4\n5 6\n", "11 10\n13 8\n5 16\n", "3 7\n4 6\n5 5\n", "10 10\n10 10\n10 10\n" ], "output": [ "-1\n", "4 7\n9 1\n", "1 2\n3 4\n", "-1\n" ] }
{ "input": [ "3 14\n8 9\n10 7\n", "12 11\n11 12\n16 7\n", "12 17\n10 19\n13 16\n", "9 12\n3 17\n10 10\n", "10 7\n4 13\n11 6\n", "7 9\n4 12\n5 11\n", "2 4\n1 5\n3 3\n", "13 8\n15 6\n11 10\n", "8 10\n9 9\n13 5\n", "12 7\n5 14\n8 11\n", "9 6\n5 10\n3 12\n", "16 5\n13 8\n10...
IN-CORRECT
java
import java.util.Scanner; public class helpVasilisa { public static void main(String[] args) { Scanner input = new Scanner(System.in); int r1 = input.nextInt(); int r2 = input.nextInt(); int c1 = input.nextInt(); int c2 = input.nextInt(); int d1 = input.nextInt(); ...
143_A. Help Vasilisa the Wise 2
Vasilisa the Wise from the Kingdom of Far Far Away got a magic box with a secret as a present from her friend Hellawisa the Wise from the Kingdom of A Little Closer. However, Vasilisa the Wise does not know what the box's secret is, since she cannot open it again. She hopes that you will help her one more time with tha...
{ "input": [ "1 2\n3 4\n5 6\n", "11 10\n13 8\n5 16\n", "3 7\n4 6\n5 5\n", "10 10\n10 10\n10 10\n" ], "output": [ "-1\n", "4 7\n9 1\n", "1 2\n3 4\n", "-1\n" ] }
{ "input": [ "3 14\n8 9\n10 7\n", "12 11\n11 12\n16 7\n", "12 17\n10 19\n13 16\n", "9 12\n3 17\n10 10\n", "10 7\n4 13\n11 6\n", "7 9\n4 12\n5 11\n", "2 4\n1 5\n3 3\n", "13 8\n15 6\n11 10\n", "8 10\n9 9\n13 5\n", "12 7\n5 14\n8 11\n", "9 6\n5 10\n3 12\n", "16 5\n13 8\n10...
IN-CORRECT
java
import java.util.Scanner; public class HelpVasilisaTheWise { public static void main(String[] args) { Scanner scanner = new Scanner(System.in); int rowOne = scanner.nextInt(); int rowTwo = scanner.nextInt(); int columnOne = scanner.nextInt(); int columnTwo = scanner.nextInt(...
143_A. Help Vasilisa the Wise 2
Vasilisa the Wise from the Kingdom of Far Far Away got a magic box with a secret as a present from her friend Hellawisa the Wise from the Kingdom of A Little Closer. However, Vasilisa the Wise does not know what the box's secret is, since she cannot open it again. She hopes that you will help her one more time with tha...
{ "input": [ "1 2\n3 4\n5 6\n", "11 10\n13 8\n5 16\n", "3 7\n4 6\n5 5\n", "10 10\n10 10\n10 10\n" ], "output": [ "-1\n", "4 7\n9 1\n", "1 2\n3 4\n", "-1\n" ] }
{ "input": [ "3 14\n8 9\n10 7\n", "12 11\n11 12\n16 7\n", "12 17\n10 19\n13 16\n", "9 12\n3 17\n10 10\n", "10 7\n4 13\n11 6\n", "7 9\n4 12\n5 11\n", "2 4\n1 5\n3 3\n", "13 8\n15 6\n11 10\n", "8 10\n9 9\n13 5\n", "12 7\n5 14\n8 11\n", "9 6\n5 10\n3 12\n", "16 5\n13 8\n10...
IN-CORRECT
python3
r1,r2 = map(int,input().split()) c1,c2 = map(int,input().split()) d1,d2 = map(int,input().split()) c = abs(r1-c1-d2)//2 b = abs(r2-c2-d2)//2 a = abs(r1-b) d = abs(c2-b) res = [a,b,c,d] for i in res: if res.count(i)>1 or i >9 or i < 1: print(-1) break else: print(a,b) print(c,d)
143_A. Help Vasilisa the Wise 2
Vasilisa the Wise from the Kingdom of Far Far Away got a magic box with a secret as a present from her friend Hellawisa the Wise from the Kingdom of A Little Closer. However, Vasilisa the Wise does not know what the box's secret is, since she cannot open it again. She hopes that you will help her one more time with tha...
{ "input": [ "1 2\n3 4\n5 6\n", "11 10\n13 8\n5 16\n", "3 7\n4 6\n5 5\n", "10 10\n10 10\n10 10\n" ], "output": [ "-1\n", "4 7\n9 1\n", "1 2\n3 4\n", "-1\n" ] }
{ "input": [ "3 14\n8 9\n10 7\n", "12 11\n11 12\n16 7\n", "12 17\n10 19\n13 16\n", "9 12\n3 17\n10 10\n", "10 7\n4 13\n11 6\n", "7 9\n4 12\n5 11\n", "2 4\n1 5\n3 3\n", "13 8\n15 6\n11 10\n", "8 10\n9 9\n13 5\n", "12 7\n5 14\n8 11\n", "9 6\n5 10\n3 12\n", "16 5\n13 8\n10...
IN-CORRECT
java
import java.io.*; import java.util.*; import java.lang.System; public class Solution{ static PrintStream out=System.out; static BufferedReader br=new BufferedReader(new InputStreamReader(System.in)); static StringTokenizer st; static Scanner sc=new Scanner(System.in); static void Task(){ int r1=ni(); int...
143_A. Help Vasilisa the Wise 2
Vasilisa the Wise from the Kingdom of Far Far Away got a magic box with a secret as a present from her friend Hellawisa the Wise from the Kingdom of A Little Closer. However, Vasilisa the Wise does not know what the box's secret is, since she cannot open it again. She hopes that you will help her one more time with tha...
{ "input": [ "1 2\n3 4\n5 6\n", "11 10\n13 8\n5 16\n", "3 7\n4 6\n5 5\n", "10 10\n10 10\n10 10\n" ], "output": [ "-1\n", "4 7\n9 1\n", "1 2\n3 4\n", "-1\n" ] }
{ "input": [ "3 14\n8 9\n10 7\n", "12 11\n11 12\n16 7\n", "12 17\n10 19\n13 16\n", "9 12\n3 17\n10 10\n", "10 7\n4 13\n11 6\n", "7 9\n4 12\n5 11\n", "2 4\n1 5\n3 3\n", "13 8\n15 6\n11 10\n", "8 10\n9 9\n13 5\n", "12 7\n5 14\n8 11\n", "9 6\n5 10\n3 12\n", "16 5\n13 8\n10...
IN-CORRECT
java
import java.util.*; import java.io.*; public class MyClass { public static void main(String args[]) { try{ BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); String s1[] = br.readLine().split(" "); String s2[] = br.readLine().split(" "); ...
143_A. Help Vasilisa the Wise 2
Vasilisa the Wise from the Kingdom of Far Far Away got a magic box with a secret as a present from her friend Hellawisa the Wise from the Kingdom of A Little Closer. However, Vasilisa the Wise does not know what the box's secret is, since she cannot open it again. She hopes that you will help her one more time with tha...
{ "input": [ "1 2\n3 4\n5 6\n", "11 10\n13 8\n5 16\n", "3 7\n4 6\n5 5\n", "10 10\n10 10\n10 10\n" ], "output": [ "-1\n", "4 7\n9 1\n", "1 2\n3 4\n", "-1\n" ] }
{ "input": [ "3 14\n8 9\n10 7\n", "12 11\n11 12\n16 7\n", "12 17\n10 19\n13 16\n", "9 12\n3 17\n10 10\n", "10 7\n4 13\n11 6\n", "7 9\n4 12\n5 11\n", "2 4\n1 5\n3 3\n", "13 8\n15 6\n11 10\n", "8 10\n9 9\n13 5\n", "12 7\n5 14\n8 11\n", "9 6\n5 10\n3 12\n", "16 5\n13 8\n10...
IN-CORRECT
python3
#!/usr/bin/env python import os import re import sys from bisect import bisect, bisect_left, insort, insort_left from collections import Counter, defaultdict, deque from copy import deepcopy from decimal import Decimal from fractions import gcd from io import BytesIO, IOBase from itertools import ( accumulate, comb...
143_A. Help Vasilisa the Wise 2
Vasilisa the Wise from the Kingdom of Far Far Away got a magic box with a secret as a present from her friend Hellawisa the Wise from the Kingdom of A Little Closer. However, Vasilisa the Wise does not know what the box's secret is, since she cannot open it again. She hopes that you will help her one more time with tha...
{ "input": [ "1 2\n3 4\n5 6\n", "11 10\n13 8\n5 16\n", "3 7\n4 6\n5 5\n", "10 10\n10 10\n10 10\n" ], "output": [ "-1\n", "4 7\n9 1\n", "1 2\n3 4\n", "-1\n" ] }
{ "input": [ "3 14\n8 9\n10 7\n", "12 11\n11 12\n16 7\n", "12 17\n10 19\n13 16\n", "9 12\n3 17\n10 10\n", "10 7\n4 13\n11 6\n", "7 9\n4 12\n5 11\n", "2 4\n1 5\n3 3\n", "13 8\n15 6\n11 10\n", "8 10\n9 9\n13 5\n", "12 7\n5 14\n8 11\n", "9 6\n5 10\n3 12\n", "16 5\n13 8\n10...
IN-CORRECT
cpp
#include <bits/stdc++.h> using namespace std; bool within(signed short s) { return s >= 1 && s <= 9; } int main() { ios_base::sync_with_stdio(0); signed short r1, r2, c1, c2, d1, d2, a, b, c, d; cin >> r1 >> r2 >> c1 >> c2 >> d1 >> d2; d = (d1 - r1 + c2) / 2; b = c2 - d; a = d1 - d; c = c1 - a; if (a !=...
143_A. Help Vasilisa the Wise 2
Vasilisa the Wise from the Kingdom of Far Far Away got a magic box with a secret as a present from her friend Hellawisa the Wise from the Kingdom of A Little Closer. However, Vasilisa the Wise does not know what the box's secret is, since she cannot open it again. She hopes that you will help her one more time with tha...
{ "input": [ "1 2\n3 4\n5 6\n", "11 10\n13 8\n5 16\n", "3 7\n4 6\n5 5\n", "10 10\n10 10\n10 10\n" ], "output": [ "-1\n", "4 7\n9 1\n", "1 2\n3 4\n", "-1\n" ] }
{ "input": [ "3 14\n8 9\n10 7\n", "12 11\n11 12\n16 7\n", "12 17\n10 19\n13 16\n", "9 12\n3 17\n10 10\n", "10 7\n4 13\n11 6\n", "7 9\n4 12\n5 11\n", "2 4\n1 5\n3 3\n", "13 8\n15 6\n11 10\n", "8 10\n9 9\n13 5\n", "12 7\n5 14\n8 11\n", "9 6\n5 10\n3 12\n", "16 5\n13 8\n10...
IN-CORRECT
python3
k=[] for i in range(3): k.append(list(map(int,input().split()))) r1,r2,c1,c2,d1,d2=k[0][0],k[0][1],k[1][0],k[1][1],k[2][0],k[2][1] x1=(r1-d2+c1)//2 x2=r1-x1 x3=(d2-r1+c1)//2 x4=d1-x1 if x1<0 or x2<0 or x3<0 or x4<0 or x1>9 or x2>9 or x3>9 or x4>9:print(-1) else: print(x1,x2) print(x3,x4)
143_A. Help Vasilisa the Wise 2
Vasilisa the Wise from the Kingdom of Far Far Away got a magic box with a secret as a present from her friend Hellawisa the Wise from the Kingdom of A Little Closer. However, Vasilisa the Wise does not know what the box's secret is, since she cannot open it again. She hopes that you will help her one more time with tha...
{ "input": [ "1 2\n3 4\n5 6\n", "11 10\n13 8\n5 16\n", "3 7\n4 6\n5 5\n", "10 10\n10 10\n10 10\n" ], "output": [ "-1\n", "4 7\n9 1\n", "1 2\n3 4\n", "-1\n" ] }
{ "input": [ "3 14\n8 9\n10 7\n", "12 11\n11 12\n16 7\n", "12 17\n10 19\n13 16\n", "9 12\n3 17\n10 10\n", "10 7\n4 13\n11 6\n", "7 9\n4 12\n5 11\n", "2 4\n1 5\n3 3\n", "13 8\n15 6\n11 10\n", "8 10\n9 9\n13 5\n", "12 7\n5 14\n8 11\n", "9 6\n5 10\n3 12\n", "16 5\n13 8\n10...
IN-CORRECT
java
import java.io.*; import java.util.*; public class Test { static BufferedReader reader; static StringTokenizer tokenizer; static PrintWriter writer; static int nextInt() throws IOException { return Integer.parseInt(nextToken()); } static long nextLong() throws IOException { return Long.parseLong(nextToken(...
143_A. Help Vasilisa the Wise 2
Vasilisa the Wise from the Kingdom of Far Far Away got a magic box with a secret as a present from her friend Hellawisa the Wise from the Kingdom of A Little Closer. However, Vasilisa the Wise does not know what the box's secret is, since she cannot open it again. She hopes that you will help her one more time with tha...
{ "input": [ "1 2\n3 4\n5 6\n", "11 10\n13 8\n5 16\n", "3 7\n4 6\n5 5\n", "10 10\n10 10\n10 10\n" ], "output": [ "-1\n", "4 7\n9 1\n", "1 2\n3 4\n", "-1\n" ] }
{ "input": [ "3 14\n8 9\n10 7\n", "12 11\n11 12\n16 7\n", "12 17\n10 19\n13 16\n", "9 12\n3 17\n10 10\n", "10 7\n4 13\n11 6\n", "7 9\n4 12\n5 11\n", "2 4\n1 5\n3 3\n", "13 8\n15 6\n11 10\n", "8 10\n9 9\n13 5\n", "12 7\n5 14\n8 11\n", "9 6\n5 10\n3 12\n", "16 5\n13 8\n10...
IN-CORRECT
cpp
#include <bits/stdc++.h> int main() { int r1, r2, c1, c2, d1, d2, a, b, c, d; scanf("%d%d", &r1, &r2); scanf("%d%d", &c1, &c2); scanf("%d%d", &d1, &d2); a = (r1 + c1 - d2) / 2; b = (r1 - c1 + d2) / 2; c = (d2 - r1 + c1) / 2; d = (2 * r2 - d2 + r1 - c1) / 2; if (a == b || b == c || a == c || a == d || ...
143_A. Help Vasilisa the Wise 2
Vasilisa the Wise from the Kingdom of Far Far Away got a magic box with a secret as a present from her friend Hellawisa the Wise from the Kingdom of A Little Closer. However, Vasilisa the Wise does not know what the box's secret is, since she cannot open it again. She hopes that you will help her one more time with tha...
{ "input": [ "1 2\n3 4\n5 6\n", "11 10\n13 8\n5 16\n", "3 7\n4 6\n5 5\n", "10 10\n10 10\n10 10\n" ], "output": [ "-1\n", "4 7\n9 1\n", "1 2\n3 4\n", "-1\n" ] }
{ "input": [ "3 14\n8 9\n10 7\n", "12 11\n11 12\n16 7\n", "12 17\n10 19\n13 16\n", "9 12\n3 17\n10 10\n", "10 7\n4 13\n11 6\n", "7 9\n4 12\n5 11\n", "2 4\n1 5\n3 3\n", "13 8\n15 6\n11 10\n", "8 10\n9 9\n13 5\n", "12 7\n5 14\n8 11\n", "9 6\n5 10\n3 12\n", "16 5\n13 8\n10...
IN-CORRECT
cpp
#include <bits/stdc++.h> using namespace std; int main() { int r1, r2, d1, d2, c1, c2, a, b, c, d; cin >> r1 >> r2 >> c1 >> c2 >> d1 >> d2; a = 0.5 * (r1 - c2 + d1); b = r1 - 0.5 * (r1 - c2 + d1); c = 0.5 * (d2 - c2 + r2); d = r2 - 0.5 * (d2 - c2 + r2); if (c + b == d2 && b + d == c2 && a + b == r1 && c +...
143_A. Help Vasilisa the Wise 2
Vasilisa the Wise from the Kingdom of Far Far Away got a magic box with a secret as a present from her friend Hellawisa the Wise from the Kingdom of A Little Closer. However, Vasilisa the Wise does not know what the box's secret is, since she cannot open it again. She hopes that you will help her one more time with tha...
{ "input": [ "1 2\n3 4\n5 6\n", "11 10\n13 8\n5 16\n", "3 7\n4 6\n5 5\n", "10 10\n10 10\n10 10\n" ], "output": [ "-1\n", "4 7\n9 1\n", "1 2\n3 4\n", "-1\n" ] }
{ "input": [ "3 14\n8 9\n10 7\n", "12 11\n11 12\n16 7\n", "12 17\n10 19\n13 16\n", "9 12\n3 17\n10 10\n", "10 7\n4 13\n11 6\n", "7 9\n4 12\n5 11\n", "2 4\n1 5\n3 3\n", "13 8\n15 6\n11 10\n", "8 10\n9 9\n13 5\n", "12 7\n5 14\n8 11\n", "9 6\n5 10\n3 12\n", "16 5\n13 8\n10...
IN-CORRECT
cpp
#include <bits/stdc++.h> using namespace std; int main() { int r1, r2, c1, c2, d1, d2, a, b, c, d; cin >> r1 >> r2 >> c1 >> c2 >> d1 >> d2; for (int i = 1; i < 10; i++) { a = i; b = r1 - i; if (c1 - a == d2 - b) c = c1 - a; else continue; if (a == b || b == c || a == c) continue; ...
143_A. Help Vasilisa the Wise 2
Vasilisa the Wise from the Kingdom of Far Far Away got a magic box with a secret as a present from her friend Hellawisa the Wise from the Kingdom of A Little Closer. However, Vasilisa the Wise does not know what the box's secret is, since she cannot open it again. She hopes that you will help her one more time with tha...
{ "input": [ "1 2\n3 4\n5 6\n", "11 10\n13 8\n5 16\n", "3 7\n4 6\n5 5\n", "10 10\n10 10\n10 10\n" ], "output": [ "-1\n", "4 7\n9 1\n", "1 2\n3 4\n", "-1\n" ] }
{ "input": [ "3 14\n8 9\n10 7\n", "12 11\n11 12\n16 7\n", "12 17\n10 19\n13 16\n", "9 12\n3 17\n10 10\n", "10 7\n4 13\n11 6\n", "7 9\n4 12\n5 11\n", "2 4\n1 5\n3 3\n", "13 8\n15 6\n11 10\n", "8 10\n9 9\n13 5\n", "12 7\n5 14\n8 11\n", "9 6\n5 10\n3 12\n", "16 5\n13 8\n10...
IN-CORRECT
cpp
#include <bits/stdc++.h> using namespace std; const int N = 200005; int a[N]; int main() { int r1, r2, c1, c2, d1, d2; scanf("%d %d %d %d %d %d", &r1, &r2, &c1, &c2, &d1, &d2); int x, y, z, w; if ((r1 - c1 + d2) % 2 != 0 || (r1 - c1 + d2 <= 0)) { printf("-1\n"); return 0; } else { y = (r1 - c1 + d...
143_A. Help Vasilisa the Wise 2
Vasilisa the Wise from the Kingdom of Far Far Away got a magic box with a secret as a present from her friend Hellawisa the Wise from the Kingdom of A Little Closer. However, Vasilisa the Wise does not know what the box's secret is, since she cannot open it again. She hopes that you will help her one more time with tha...
{ "input": [ "1 2\n3 4\n5 6\n", "11 10\n13 8\n5 16\n", "3 7\n4 6\n5 5\n", "10 10\n10 10\n10 10\n" ], "output": [ "-1\n", "4 7\n9 1\n", "1 2\n3 4\n", "-1\n" ] }
{ "input": [ "3 14\n8 9\n10 7\n", "12 11\n11 12\n16 7\n", "12 17\n10 19\n13 16\n", "9 12\n3 17\n10 10\n", "10 7\n4 13\n11 6\n", "7 9\n4 12\n5 11\n", "2 4\n1 5\n3 3\n", "13 8\n15 6\n11 10\n", "8 10\n9 9\n13 5\n", "12 7\n5 14\n8 11\n", "9 6\n5 10\n3 12\n", "16 5\n13 8\n10...
IN-CORRECT
python3
r1,r2=[int(item) for item in input().split()] c1,c2=[int(item) for item in input().split()] d1,d2=[int(item) for item in input().split()] x=(c1+r1-d2)//2 if (c1+r1-d2)%2==0 and x>0: my=[x,r1-x,c1-x,r2-c1+x] my1=set(my) my2=list(my1) if sorted(my)!=sorted(my2): print(-1) else: print(x...
143_A. Help Vasilisa the Wise 2
Vasilisa the Wise from the Kingdom of Far Far Away got a magic box with a secret as a present from her friend Hellawisa the Wise from the Kingdom of A Little Closer. However, Vasilisa the Wise does not know what the box's secret is, since she cannot open it again. She hopes that you will help her one more time with tha...
{ "input": [ "1 2\n3 4\n5 6\n", "11 10\n13 8\n5 16\n", "3 7\n4 6\n5 5\n", "10 10\n10 10\n10 10\n" ], "output": [ "-1\n", "4 7\n9 1\n", "1 2\n3 4\n", "-1\n" ] }
{ "input": [ "3 14\n8 9\n10 7\n", "12 11\n11 12\n16 7\n", "12 17\n10 19\n13 16\n", "9 12\n3 17\n10 10\n", "10 7\n4 13\n11 6\n", "7 9\n4 12\n5 11\n", "2 4\n1 5\n3 3\n", "13 8\n15 6\n11 10\n", "8 10\n9 9\n13 5\n", "12 7\n5 14\n8 11\n", "9 6\n5 10\n3 12\n", "16 5\n13 8\n10...
IN-CORRECT
java
import java.util.Scanner; public class helpVasilisa { public static void main(String[] args){ Scanner input=new Scanner(System.in); int r1=input.nextInt(); int r2=input.nextInt(); int c1=input.nextInt(); int c2=input.nextInt(); int d1=input.nextInt(); int d2=...
143_A. Help Vasilisa the Wise 2
Vasilisa the Wise from the Kingdom of Far Far Away got a magic box with a secret as a present from her friend Hellawisa the Wise from the Kingdom of A Little Closer. However, Vasilisa the Wise does not know what the box's secret is, since she cannot open it again. She hopes that you will help her one more time with tha...
{ "input": [ "1 2\n3 4\n5 6\n", "11 10\n13 8\n5 16\n", "3 7\n4 6\n5 5\n", "10 10\n10 10\n10 10\n" ], "output": [ "-1\n", "4 7\n9 1\n", "1 2\n3 4\n", "-1\n" ] }
{ "input": [ "3 14\n8 9\n10 7\n", "12 11\n11 12\n16 7\n", "12 17\n10 19\n13 16\n", "9 12\n3 17\n10 10\n", "10 7\n4 13\n11 6\n", "7 9\n4 12\n5 11\n", "2 4\n1 5\n3 3\n", "13 8\n15 6\n11 10\n", "8 10\n9 9\n13 5\n", "12 7\n5 14\n8 11\n", "9 6\n5 10\n3 12\n", "16 5\n13 8\n10...
IN-CORRECT
cpp
#include <bits/stdc++.h> int main() { int i, r1, r2, c1, c2, d1, d2, a[4], tmp = 0; scanf("%d%d%d%d%d%d", &r1, &r2, &c1, &c2, &d1, &d2); for (i = 1; i <= 9 && tmp == 0; i++) { a[0] = i; if (((r1 + c1 - 2 * a[0]) == d2) && ((r1 + d1 - 2 * a[0]) == c2) && ((c1 + d1 - 2 * a[0]) == r2) && (2 * a[0] !=...
143_A. Help Vasilisa the Wise 2
Vasilisa the Wise from the Kingdom of Far Far Away got a magic box with a secret as a present from her friend Hellawisa the Wise from the Kingdom of A Little Closer. However, Vasilisa the Wise does not know what the box's secret is, since she cannot open it again. She hopes that you will help her one more time with tha...
{ "input": [ "1 2\n3 4\n5 6\n", "11 10\n13 8\n5 16\n", "3 7\n4 6\n5 5\n", "10 10\n10 10\n10 10\n" ], "output": [ "-1\n", "4 7\n9 1\n", "1 2\n3 4\n", "-1\n" ] }
{ "input": [ "3 14\n8 9\n10 7\n", "12 11\n11 12\n16 7\n", "12 17\n10 19\n13 16\n", "9 12\n3 17\n10 10\n", "10 7\n4 13\n11 6\n", "7 9\n4 12\n5 11\n", "2 4\n1 5\n3 3\n", "13 8\n15 6\n11 10\n", "8 10\n9 9\n13 5\n", "12 7\n5 14\n8 11\n", "9 6\n5 10\n3 12\n", "16 5\n13 8\n10...
IN-CORRECT
java
import java.util.ArrayList; import java.util.Arrays; import java.util.Scanner; public class Young { public static void main(String[] args) { Scanner sc = new Scanner(System.in); int r1 = sc.nextInt(); int r2 = sc.nextInt(); int c1 = sc.nextInt(); int c2 = sc.nextInt(); int d1 = sc.nextInt(); int d2 ...
143_A. Help Vasilisa the Wise 2
Vasilisa the Wise from the Kingdom of Far Far Away got a magic box with a secret as a present from her friend Hellawisa the Wise from the Kingdom of A Little Closer. However, Vasilisa the Wise does not know what the box's secret is, since she cannot open it again. She hopes that you will help her one more time with tha...
{ "input": [ "1 2\n3 4\n5 6\n", "11 10\n13 8\n5 16\n", "3 7\n4 6\n5 5\n", "10 10\n10 10\n10 10\n" ], "output": [ "-1\n", "4 7\n9 1\n", "1 2\n3 4\n", "-1\n" ] }
{ "input": [ "3 14\n8 9\n10 7\n", "12 11\n11 12\n16 7\n", "12 17\n10 19\n13 16\n", "9 12\n3 17\n10 10\n", "10 7\n4 13\n11 6\n", "7 9\n4 12\n5 11\n", "2 4\n1 5\n3 3\n", "13 8\n15 6\n11 10\n", "8 10\n9 9\n13 5\n", "12 7\n5 14\n8 11\n", "9 6\n5 10\n3 12\n", "16 5\n13 8\n10...
IN-CORRECT
java
import java.io.*; import java.util.*; public class HelpVasilisa { public static void main(String args[]) throws IOException { BufferedReader cin=new BufferedReader(new InputStreamReader(System.in)); int n=3; String[] ar = new String[n]; int r=0; while(n-->0) { String s=cin.rea...
143_A. Help Vasilisa the Wise 2
Vasilisa the Wise from the Kingdom of Far Far Away got a magic box with a secret as a present from her friend Hellawisa the Wise from the Kingdom of A Little Closer. However, Vasilisa the Wise does not know what the box's secret is, since she cannot open it again. She hopes that you will help her one more time with tha...
{ "input": [ "1 2\n3 4\n5 6\n", "11 10\n13 8\n5 16\n", "3 7\n4 6\n5 5\n", "10 10\n10 10\n10 10\n" ], "output": [ "-1\n", "4 7\n9 1\n", "1 2\n3 4\n", "-1\n" ] }
{ "input": [ "3 14\n8 9\n10 7\n", "12 11\n11 12\n16 7\n", "12 17\n10 19\n13 16\n", "9 12\n3 17\n10 10\n", "10 7\n4 13\n11 6\n", "7 9\n4 12\n5 11\n", "2 4\n1 5\n3 3\n", "13 8\n15 6\n11 10\n", "8 10\n9 9\n13 5\n", "12 7\n5 14\n8 11\n", "9 6\n5 10\n3 12\n", "16 5\n13 8\n10...
IN-CORRECT
python2
def solve(): ro = map(int, str(raw_input()).split()) co = map(int, str(raw_input()).split()) di = map(int, str(raw_input()).split()) if (sum(ro)!= sum(co)) or (sum(co) != sum(di)) or (sum(di) != sum(ro)): print '-1' return a = [] b = [] c = [] d = [] first = co[0] +di...
143_A. Help Vasilisa the Wise 2
Vasilisa the Wise from the Kingdom of Far Far Away got a magic box with a secret as a present from her friend Hellawisa the Wise from the Kingdom of A Little Closer. However, Vasilisa the Wise does not know what the box's secret is, since she cannot open it again. She hopes that you will help her one more time with tha...
{ "input": [ "1 2\n3 4\n5 6\n", "11 10\n13 8\n5 16\n", "3 7\n4 6\n5 5\n", "10 10\n10 10\n10 10\n" ], "output": [ "-1\n", "4 7\n9 1\n", "1 2\n3 4\n", "-1\n" ] }
{ "input": [ "3 14\n8 9\n10 7\n", "12 11\n11 12\n16 7\n", "12 17\n10 19\n13 16\n", "9 12\n3 17\n10 10\n", "10 7\n4 13\n11 6\n", "7 9\n4 12\n5 11\n", "2 4\n1 5\n3 3\n", "13 8\n15 6\n11 10\n", "8 10\n9 9\n13 5\n", "12 7\n5 14\n8 11\n", "9 6\n5 10\n3 12\n", "16 5\n13 8\n10...
IN-CORRECT
cpp
#include <bits/stdc++.h> using namespace std; void Open() {} double slope(pair<long long, long long> x, pair<long long, long long> y) { return (x.second - y.second) / (x.first - y.first); } int main() { ios::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL); int r1, r2, c1, c2, d1, d2, w, x, y, z; cin >...
143_A. Help Vasilisa the Wise 2
Vasilisa the Wise from the Kingdom of Far Far Away got a magic box with a secret as a present from her friend Hellawisa the Wise from the Kingdom of A Little Closer. However, Vasilisa the Wise does not know what the box's secret is, since she cannot open it again. She hopes that you will help her one more time with tha...
{ "input": [ "1 2\n3 4\n5 6\n", "11 10\n13 8\n5 16\n", "3 7\n4 6\n5 5\n", "10 10\n10 10\n10 10\n" ], "output": [ "-1\n", "4 7\n9 1\n", "1 2\n3 4\n", "-1\n" ] }
{ "input": [ "3 14\n8 9\n10 7\n", "12 11\n11 12\n16 7\n", "12 17\n10 19\n13 16\n", "9 12\n3 17\n10 10\n", "10 7\n4 13\n11 6\n", "7 9\n4 12\n5 11\n", "2 4\n1 5\n3 3\n", "13 8\n15 6\n11 10\n", "8 10\n9 9\n13 5\n", "12 7\n5 14\n8 11\n", "9 6\n5 10\n3 12\n", "16 5\n13 8\n10...
IN-CORRECT
java
import java.util.*; import java.lang.*; public class A { public static void main(String[] args) { // getting the inputs Scanner in = new Scanner(System.in); int r1 = in.nextInt(); int r2 = in.nextInt(); int c1 = in.nextInt(); int c2 = in.nextInt(); int d1 = i...
143_A. Help Vasilisa the Wise 2
Vasilisa the Wise from the Kingdom of Far Far Away got a magic box with a secret as a present from her friend Hellawisa the Wise from the Kingdom of A Little Closer. However, Vasilisa the Wise does not know what the box's secret is, since she cannot open it again. She hopes that you will help her one more time with tha...
{ "input": [ "1 2\n3 4\n5 6\n", "11 10\n13 8\n5 16\n", "3 7\n4 6\n5 5\n", "10 10\n10 10\n10 10\n" ], "output": [ "-1\n", "4 7\n9 1\n", "1 2\n3 4\n", "-1\n" ] }
{ "input": [ "3 14\n8 9\n10 7\n", "12 11\n11 12\n16 7\n", "12 17\n10 19\n13 16\n", "9 12\n3 17\n10 10\n", "10 7\n4 13\n11 6\n", "7 9\n4 12\n5 11\n", "2 4\n1 5\n3 3\n", "13 8\n15 6\n11 10\n", "8 10\n9 9\n13 5\n", "12 7\n5 14\n8 11\n", "9 6\n5 10\n3 12\n", "16 5\n13 8\n10...
IN-CORRECT
cpp
#include <bits/stdc++.h> using namespace std; int main() { int r1, r2, c1, c2, d1, d2; cin >> r1 >> r2 >> c1 >> c2 >> d1 >> d2; int num1, num2, num3, num4, flag = 0; for (int i = 1; i < r1; i++) { num1 = i; num2 = r1 - i; if (c1 - num1 > 0 && num1 <= 9) { flag++; num3 = c1 - num1; } ...
143_A. Help Vasilisa the Wise 2
Vasilisa the Wise from the Kingdom of Far Far Away got a magic box with a secret as a present from her friend Hellawisa the Wise from the Kingdom of A Little Closer. However, Vasilisa the Wise does not know what the box's secret is, since she cannot open it again. She hopes that you will help her one more time with tha...
{ "input": [ "1 2\n3 4\n5 6\n", "11 10\n13 8\n5 16\n", "3 7\n4 6\n5 5\n", "10 10\n10 10\n10 10\n" ], "output": [ "-1\n", "4 7\n9 1\n", "1 2\n3 4\n", "-1\n" ] }
{ "input": [ "3 14\n8 9\n10 7\n", "12 11\n11 12\n16 7\n", "12 17\n10 19\n13 16\n", "9 12\n3 17\n10 10\n", "10 7\n4 13\n11 6\n", "7 9\n4 12\n5 11\n", "2 4\n1 5\n3 3\n", "13 8\n15 6\n11 10\n", "8 10\n9 9\n13 5\n", "12 7\n5 14\n8 11\n", "9 6\n5 10\n3 12\n", "16 5\n13 8\n10...
IN-CORRECT
cpp
#include <bits/stdc++.h> using namespace std; vector<int> solve(int r1, int r2, int c1, int c2, int d1, int d2) { for (int a = 0; a <= 9; ++a) for (int b = 0; b <= 9; ++b) for (int c = 0; c <= 9; ++c) for (int d = 0; d <= 9; ++d) if (a + b == r1 and c + d == r2 and a + c == c1 and b + d ==...
143_A. Help Vasilisa the Wise 2
Vasilisa the Wise from the Kingdom of Far Far Away got a magic box with a secret as a present from her friend Hellawisa the Wise from the Kingdom of A Little Closer. However, Vasilisa the Wise does not know what the box's secret is, since she cannot open it again. She hopes that you will help her one more time with tha...
{ "input": [ "1 2\n3 4\n5 6\n", "11 10\n13 8\n5 16\n", "3 7\n4 6\n5 5\n", "10 10\n10 10\n10 10\n" ], "output": [ "-1\n", "4 7\n9 1\n", "1 2\n3 4\n", "-1\n" ] }
{ "input": [ "3 14\n8 9\n10 7\n", "12 11\n11 12\n16 7\n", "12 17\n10 19\n13 16\n", "9 12\n3 17\n10 10\n", "10 7\n4 13\n11 6\n", "7 9\n4 12\n5 11\n", "2 4\n1 5\n3 3\n", "13 8\n15 6\n11 10\n", "8 10\n9 9\n13 5\n", "12 7\n5 14\n8 11\n", "9 6\n5 10\n3 12\n", "16 5\n13 8\n10...
IN-CORRECT
java
import java.util.Scanner; public class Main { public static void main(String[] args) { Scanner input=new Scanner(System.in); int r1=input.nextInt(); int r2=input.nextInt(); int c1=input.nextInt(); int c2=input.nextInt(); int d1=input.nextInt(); int d2=inp...
143_A. Help Vasilisa the Wise 2
Vasilisa the Wise from the Kingdom of Far Far Away got a magic box with a secret as a present from her friend Hellawisa the Wise from the Kingdom of A Little Closer. However, Vasilisa the Wise does not know what the box's secret is, since she cannot open it again. She hopes that you will help her one more time with tha...
{ "input": [ "1 2\n3 4\n5 6\n", "11 10\n13 8\n5 16\n", "3 7\n4 6\n5 5\n", "10 10\n10 10\n10 10\n" ], "output": [ "-1\n", "4 7\n9 1\n", "1 2\n3 4\n", "-1\n" ] }
{ "input": [ "3 14\n8 9\n10 7\n", "12 11\n11 12\n16 7\n", "12 17\n10 19\n13 16\n", "9 12\n3 17\n10 10\n", "10 7\n4 13\n11 6\n", "7 9\n4 12\n5 11\n", "2 4\n1 5\n3 3\n", "13 8\n15 6\n11 10\n", "8 10\n9 9\n13 5\n", "12 7\n5 14\n8 11\n", "9 6\n5 10\n3 12\n", "16 5\n13 8\n10...
IN-CORRECT
java
import java.io.*; import java.util.*; public class JavaApplication14 { public static void main(String[] args) { FastReader sc = new FastReader(); int r1 = sc.nextInt(), r2 = sc.nextInt(); int c1 = sc.nextInt(), c2 = sc.nextInt(); int d1 = sc.nextInt(), d2 = sc.nextInt(); ...
143_A. Help Vasilisa the Wise 2
Vasilisa the Wise from the Kingdom of Far Far Away got a magic box with a secret as a present from her friend Hellawisa the Wise from the Kingdom of A Little Closer. However, Vasilisa the Wise does not know what the box's secret is, since she cannot open it again. She hopes that you will help her one more time with tha...
{ "input": [ "1 2\n3 4\n5 6\n", "11 10\n13 8\n5 16\n", "3 7\n4 6\n5 5\n", "10 10\n10 10\n10 10\n" ], "output": [ "-1\n", "4 7\n9 1\n", "1 2\n3 4\n", "-1\n" ] }
{ "input": [ "3 14\n8 9\n10 7\n", "12 11\n11 12\n16 7\n", "12 17\n10 19\n13 16\n", "9 12\n3 17\n10 10\n", "10 7\n4 13\n11 6\n", "7 9\n4 12\n5 11\n", "2 4\n1 5\n3 3\n", "13 8\n15 6\n11 10\n", "8 10\n9 9\n13 5\n", "12 7\n5 14\n8 11\n", "9 6\n5 10\n3 12\n", "16 5\n13 8\n10...
IN-CORRECT
cpp
#include <bits/stdc++.h> using namespace std; int main() { ios::sync_with_stdio(0); cin.tie(0); int r1, r2, d1, d2, c1, c2, w, x, y, z; cin >> r1 >> r2; cin >> c1 >> c2; cin >> d1 >> d2; set<int> s; w = (r1 + d1 - c2) / 2; x = (r1 + c2 - d1) / 2; y = (2 * c1 + c2 - d1 - r1) / 2; z = (d1 + c2 - r1)...
143_A. Help Vasilisa the Wise 2
Vasilisa the Wise from the Kingdom of Far Far Away got a magic box with a secret as a present from her friend Hellawisa the Wise from the Kingdom of A Little Closer. However, Vasilisa the Wise does not know what the box's secret is, since she cannot open it again. She hopes that you will help her one more time with tha...
{ "input": [ "1 2\n3 4\n5 6\n", "11 10\n13 8\n5 16\n", "3 7\n4 6\n5 5\n", "10 10\n10 10\n10 10\n" ], "output": [ "-1\n", "4 7\n9 1\n", "1 2\n3 4\n", "-1\n" ] }
{ "input": [ "3 14\n8 9\n10 7\n", "12 11\n11 12\n16 7\n", "12 17\n10 19\n13 16\n", "9 12\n3 17\n10 10\n", "10 7\n4 13\n11 6\n", "7 9\n4 12\n5 11\n", "2 4\n1 5\n3 3\n", "13 8\n15 6\n11 10\n", "8 10\n9 9\n13 5\n", "12 7\n5 14\n8 11\n", "9 6\n5 10\n3 12\n", "16 5\n13 8\n10...
IN-CORRECT
python3
import math def invalid(a, b, x): if (a+b==x): return 0 else: return 1 r1 , r2 = input().split() r1 = int(r1) r2 = int(r2) c1, c2 = input().split() c1 = int(c1) c2 = int(c2) e1, e2 = input().split() e1 = int(e1) e2 = int(e2) x = 9 flag = 1 while(x): x -= 1 a1, a2, a3, a4 = 0, 0, ...
143_A. Help Vasilisa the Wise 2
Vasilisa the Wise from the Kingdom of Far Far Away got a magic box with a secret as a present from her friend Hellawisa the Wise from the Kingdom of A Little Closer. However, Vasilisa the Wise does not know what the box's secret is, since she cannot open it again. She hopes that you will help her one more time with tha...
{ "input": [ "1 2\n3 4\n5 6\n", "11 10\n13 8\n5 16\n", "3 7\n4 6\n5 5\n", "10 10\n10 10\n10 10\n" ], "output": [ "-1\n", "4 7\n9 1\n", "1 2\n3 4\n", "-1\n" ] }
{ "input": [ "3 14\n8 9\n10 7\n", "12 11\n11 12\n16 7\n", "12 17\n10 19\n13 16\n", "9 12\n3 17\n10 10\n", "10 7\n4 13\n11 6\n", "7 9\n4 12\n5 11\n", "2 4\n1 5\n3 3\n", "13 8\n15 6\n11 10\n", "8 10\n9 9\n13 5\n", "12 7\n5 14\n8 11\n", "9 6\n5 10\n3 12\n", "16 5\n13 8\n10...
IN-CORRECT
cpp
#include <bits/stdc++.h> using namespace std; int main() { int i; int w; int x; int y; int z; pair<int, int> p[100]; for (i = 0; i < 3; i++) { cin >> p[i].first; cin >> p[i].second; } w = (p[1].first - abs(p[0].first - p[2].second)) / 2; x = p[0].first - w; y = p[1].first - w; z = p[1].s...
143_A. Help Vasilisa the Wise 2
Vasilisa the Wise from the Kingdom of Far Far Away got a magic box with a secret as a present from her friend Hellawisa the Wise from the Kingdom of A Little Closer. However, Vasilisa the Wise does not know what the box's secret is, since she cannot open it again. She hopes that you will help her one more time with tha...
{ "input": [ "1 2\n3 4\n5 6\n", "11 10\n13 8\n5 16\n", "3 7\n4 6\n5 5\n", "10 10\n10 10\n10 10\n" ], "output": [ "-1\n", "4 7\n9 1\n", "1 2\n3 4\n", "-1\n" ] }
{ "input": [ "3 14\n8 9\n10 7\n", "12 11\n11 12\n16 7\n", "12 17\n10 19\n13 16\n", "9 12\n3 17\n10 10\n", "10 7\n4 13\n11 6\n", "7 9\n4 12\n5 11\n", "2 4\n1 5\n3 3\n", "13 8\n15 6\n11 10\n", "8 10\n9 9\n13 5\n", "12 7\n5 14\n8 11\n", "9 6\n5 10\n3 12\n", "16 5\n13 8\n10...
IN-CORRECT
python3
r1, r2 = map(int, input().split()) c1, c2 = map(int, input().split()) d1, d2 = map(int, input().split()) gems = [i for i in range(1, 10)] required_sum = r1 + r2 + c1 + c2 + d1 + d2 if required_sum % 3 == 0: sum_to = required_sum / 3 for i in range(1, 10): a = r1 - i b = c1 - i c = r2 -...
143_A. Help Vasilisa the Wise 2
Vasilisa the Wise from the Kingdom of Far Far Away got a magic box with a secret as a present from her friend Hellawisa the Wise from the Kingdom of A Little Closer. However, Vasilisa the Wise does not know what the box's secret is, since she cannot open it again. She hopes that you will help her one more time with tha...
{ "input": [ "1 2\n3 4\n5 6\n", "11 10\n13 8\n5 16\n", "3 7\n4 6\n5 5\n", "10 10\n10 10\n10 10\n" ], "output": [ "-1\n", "4 7\n9 1\n", "1 2\n3 4\n", "-1\n" ] }
{ "input": [ "3 14\n8 9\n10 7\n", "12 11\n11 12\n16 7\n", "12 17\n10 19\n13 16\n", "9 12\n3 17\n10 10\n", "10 7\n4 13\n11 6\n", "7 9\n4 12\n5 11\n", "2 4\n1 5\n3 3\n", "13 8\n15 6\n11 10\n", "8 10\n9 9\n13 5\n", "12 7\n5 14\n8 11\n", "9 6\n5 10\n3 12\n", "16 5\n13 8\n10...
IN-CORRECT
python2
r1, r2 = map(int, raw_input().split()) c1, c2 = map(int, raw_input().split()) d1, d2 = map(int, raw_input().split()) c = (c1 + d2 - r1) / 2 a = c1 - c b = d2 - c d = r2 - c if (r1 + r2) != (c1 + c2) or (r1 + r2) != (d1 + d2) or a == b or c == d or a == c or b == c or b == d or a == d or max(a, b, c, d) > 9: print -...
143_A. Help Vasilisa the Wise 2
Vasilisa the Wise from the Kingdom of Far Far Away got a magic box with a secret as a present from her friend Hellawisa the Wise from the Kingdom of A Little Closer. However, Vasilisa the Wise does not know what the box's secret is, since she cannot open it again. She hopes that you will help her one more time with tha...
{ "input": [ "1 2\n3 4\n5 6\n", "11 10\n13 8\n5 16\n", "3 7\n4 6\n5 5\n", "10 10\n10 10\n10 10\n" ], "output": [ "-1\n", "4 7\n9 1\n", "1 2\n3 4\n", "-1\n" ] }
{ "input": [ "3 14\n8 9\n10 7\n", "12 11\n11 12\n16 7\n", "12 17\n10 19\n13 16\n", "9 12\n3 17\n10 10\n", "10 7\n4 13\n11 6\n", "7 9\n4 12\n5 11\n", "2 4\n1 5\n3 3\n", "13 8\n15 6\n11 10\n", "8 10\n9 9\n13 5\n", "12 7\n5 14\n8 11\n", "9 6\n5 10\n3 12\n", "16 5\n13 8\n10...
IN-CORRECT
cpp
#include <bits/stdc++.h> using namespace std; int main() { int r1, r2, c1, c2, d1, d2, z1, z2, z3, z4; cin >> r1 >> r2; cin >> c1 >> c2; cin >> d1 >> d2; if ((r1 + c1 - d1) % 2 == 0) { z1 = (r1 + c1 - d1) / 2; z2 = r1 - z1; z3 = d2 - z2; z4 = d1 - z1; if (z1 >= 1 && z1 <= 9 && z2 >= 1 && z...
143_A. Help Vasilisa the Wise 2
Vasilisa the Wise from the Kingdom of Far Far Away got a magic box with a secret as a present from her friend Hellawisa the Wise from the Kingdom of A Little Closer. However, Vasilisa the Wise does not know what the box's secret is, since she cannot open it again. She hopes that you will help her one more time with tha...
{ "input": [ "1 2\n3 4\n5 6\n", "11 10\n13 8\n5 16\n", "3 7\n4 6\n5 5\n", "10 10\n10 10\n10 10\n" ], "output": [ "-1\n", "4 7\n9 1\n", "1 2\n3 4\n", "-1\n" ] }
{ "input": [ "3 14\n8 9\n10 7\n", "12 11\n11 12\n16 7\n", "12 17\n10 19\n13 16\n", "9 12\n3 17\n10 10\n", "10 7\n4 13\n11 6\n", "7 9\n4 12\n5 11\n", "2 4\n1 5\n3 3\n", "13 8\n15 6\n11 10\n", "8 10\n9 9\n13 5\n", "12 7\n5 14\n8 11\n", "9 6\n5 10\n3 12\n", "16 5\n13 8\n10...
IN-CORRECT
cpp
#include <bits/stdc++.h> using namespace std; int main(void) { int c1, c2, r1, r2, d1, d2, i, j, k, l; cin >> r1 >> r2 >> c1 >> c2 >> d1 >> d2; i = (r1 - r2 + c1) / 2; j = (c2 - r2 + d2) / 2; k = (r2 - c2 + d2) / 2; l = (c2 - r1 + d1) / 2; if ((i >= 1 && i <= 9) && (j >= 1 && j <= 9) && (k >= 1 && k <= 9)...
143_A. Help Vasilisa the Wise 2
Vasilisa the Wise from the Kingdom of Far Far Away got a magic box with a secret as a present from her friend Hellawisa the Wise from the Kingdom of A Little Closer. However, Vasilisa the Wise does not know what the box's secret is, since she cannot open it again. She hopes that you will help her one more time with tha...
{ "input": [ "1 2\n3 4\n5 6\n", "11 10\n13 8\n5 16\n", "3 7\n4 6\n5 5\n", "10 10\n10 10\n10 10\n" ], "output": [ "-1\n", "4 7\n9 1\n", "1 2\n3 4\n", "-1\n" ] }
{ "input": [ "3 14\n8 9\n10 7\n", "12 11\n11 12\n16 7\n", "12 17\n10 19\n13 16\n", "9 12\n3 17\n10 10\n", "10 7\n4 13\n11 6\n", "7 9\n4 12\n5 11\n", "2 4\n1 5\n3 3\n", "13 8\n15 6\n11 10\n", "8 10\n9 9\n13 5\n", "12 7\n5 14\n8 11\n", "9 6\n5 10\n3 12\n", "16 5\n13 8\n10...
IN-CORRECT
java
import java.io.*; import java.util.*; public class Main implements Runnable { void solve() throws IOException { int r1 = sc.nextInt(); int r2 = sc.nextInt(); int c1 = sc.nextInt(); int c2 = sc.nextInt(); int d1 = sc.nextInt(); int d2 = sc.nextInt(); int a1 = r1+c1-d2; in...
143_A. Help Vasilisa the Wise 2
Vasilisa the Wise from the Kingdom of Far Far Away got a magic box with a secret as a present from her friend Hellawisa the Wise from the Kingdom of A Little Closer. However, Vasilisa the Wise does not know what the box's secret is, since she cannot open it again. She hopes that you will help her one more time with tha...
{ "input": [ "1 2\n3 4\n5 6\n", "11 10\n13 8\n5 16\n", "3 7\n4 6\n5 5\n", "10 10\n10 10\n10 10\n" ], "output": [ "-1\n", "4 7\n9 1\n", "1 2\n3 4\n", "-1\n" ] }
{ "input": [ "3 14\n8 9\n10 7\n", "12 11\n11 12\n16 7\n", "12 17\n10 19\n13 16\n", "9 12\n3 17\n10 10\n", "10 7\n4 13\n11 6\n", "7 9\n4 12\n5 11\n", "2 4\n1 5\n3 3\n", "13 8\n15 6\n11 10\n", "8 10\n9 9\n13 5\n", "12 7\n5 14\n8 11\n", "9 6\n5 10\n3 12\n", "16 5\n13 8\n10...
IN-CORRECT
java
import java.util.Scanner; public class Main { public static void main(String[] args) { Scanner input=new Scanner(System.in); int r1=input.nextInt(); int r2=input.nextInt(); int c1=input.nextInt(); int c2=input.nextInt(); int d1=input.nextInt(); int d2=inpu...
143_A. Help Vasilisa the Wise 2
Vasilisa the Wise from the Kingdom of Far Far Away got a magic box with a secret as a present from her friend Hellawisa the Wise from the Kingdom of A Little Closer. However, Vasilisa the Wise does not know what the box's secret is, since she cannot open it again. She hopes that you will help her one more time with tha...
{ "input": [ "1 2\n3 4\n5 6\n", "11 10\n13 8\n5 16\n", "3 7\n4 6\n5 5\n", "10 10\n10 10\n10 10\n" ], "output": [ "-1\n", "4 7\n9 1\n", "1 2\n3 4\n", "-1\n" ] }
{ "input": [ "3 14\n8 9\n10 7\n", "12 11\n11 12\n16 7\n", "12 17\n10 19\n13 16\n", "9 12\n3 17\n10 10\n", "10 7\n4 13\n11 6\n", "7 9\n4 12\n5 11\n", "2 4\n1 5\n3 3\n", "13 8\n15 6\n11 10\n", "8 10\n9 9\n13 5\n", "12 7\n5 14\n8 11\n", "9 6\n5 10\n3 12\n", "16 5\n13 8\n10...
IN-CORRECT
python3
r1,r2 = map(int,input().split()) c1,c2 = map(int,input().split()) d1,d2 = map(int,input().split()) a=0 ;b=0;c=0;d=0 if (r1+c1-d2)%2==0: a = (r1+c1-d2)//2 if (r1+c2-d1)%2==0: b = (r1-d1+c2)//2 c = c1-a d = d1-a set1 = {a,b,c,d} # print(set1) if 0<a<10 and 0<b<10 and 0<c<10 and 0<d<10 and len(set1)==4 : prin...
143_A. Help Vasilisa the Wise 2
Vasilisa the Wise from the Kingdom of Far Far Away got a magic box with a secret as a present from her friend Hellawisa the Wise from the Kingdom of A Little Closer. However, Vasilisa the Wise does not know what the box's secret is, since she cannot open it again. She hopes that you will help her one more time with tha...
{ "input": [ "1 2\n3 4\n5 6\n", "11 10\n13 8\n5 16\n", "3 7\n4 6\n5 5\n", "10 10\n10 10\n10 10\n" ], "output": [ "-1\n", "4 7\n9 1\n", "1 2\n3 4\n", "-1\n" ] }
{ "input": [ "3 14\n8 9\n10 7\n", "12 11\n11 12\n16 7\n", "12 17\n10 19\n13 16\n", "9 12\n3 17\n10 10\n", "10 7\n4 13\n11 6\n", "7 9\n4 12\n5 11\n", "2 4\n1 5\n3 3\n", "13 8\n15 6\n11 10\n", "8 10\n9 9\n13 5\n", "12 7\n5 14\n8 11\n", "9 6\n5 10\n3 12\n", "16 5\n13 8\n10...
IN-CORRECT
python3
numbers = list(range(1, 10)) r1, r2 = list(map(int, input().split())) c1, c2 = list(map(int, input().split())) d1, d2 = list(map(int, input().split())) rec = [] for w in numbers: for y in numbers: for x in numbers: for z in numbers: if w != y != x !=z: if w + ...
143_A. Help Vasilisa the Wise 2
Vasilisa the Wise from the Kingdom of Far Far Away got a magic box with a secret as a present from her friend Hellawisa the Wise from the Kingdom of A Little Closer. However, Vasilisa the Wise does not know what the box's secret is, since she cannot open it again. She hopes that you will help her one more time with tha...
{ "input": [ "1 2\n3 4\n5 6\n", "11 10\n13 8\n5 16\n", "3 7\n4 6\n5 5\n", "10 10\n10 10\n10 10\n" ], "output": [ "-1\n", "4 7\n9 1\n", "1 2\n3 4\n", "-1\n" ] }
{ "input": [ "3 14\n8 9\n10 7\n", "12 11\n11 12\n16 7\n", "12 17\n10 19\n13 16\n", "9 12\n3 17\n10 10\n", "10 7\n4 13\n11 6\n", "7 9\n4 12\n5 11\n", "2 4\n1 5\n3 3\n", "13 8\n15 6\n11 10\n", "8 10\n9 9\n13 5\n", "12 7\n5 14\n8 11\n", "9 6\n5 10\n3 12\n", "16 5\n13 8\n10...
IN-CORRECT
python3
import os import sys from io import BytesIO, IOBase BUFSIZE = 8192 class FastIO(IOBase): newlines = 0 def __init__(self, file): self._fd = file.fileno() self.buffer = BytesIO() self.writable = "x" in file.mode or "r" not in file.mode self.write = self.buffer.write if self...
143_A. Help Vasilisa the Wise 2
Vasilisa the Wise from the Kingdom of Far Far Away got a magic box with a secret as a present from her friend Hellawisa the Wise from the Kingdom of A Little Closer. However, Vasilisa the Wise does not know what the box's secret is, since she cannot open it again. She hopes that you will help her one more time with tha...
{ "input": [ "1 2\n3 4\n5 6\n", "11 10\n13 8\n5 16\n", "3 7\n4 6\n5 5\n", "10 10\n10 10\n10 10\n" ], "output": [ "-1\n", "4 7\n9 1\n", "1 2\n3 4\n", "-1\n" ] }
{ "input": [ "3 14\n8 9\n10 7\n", "12 11\n11 12\n16 7\n", "12 17\n10 19\n13 16\n", "9 12\n3 17\n10 10\n", "10 7\n4 13\n11 6\n", "7 9\n4 12\n5 11\n", "2 4\n1 5\n3 3\n", "13 8\n15 6\n11 10\n", "8 10\n9 9\n13 5\n", "12 7\n5 14\n8 11\n", "9 6\n5 10\n3 12\n", "16 5\n13 8\n10...
IN-CORRECT
java
import java.util.*; public class Main { public static void main(String[] args) { Scanner in = new Scanner(System.in); int r1= in.nextInt(); int r2= in.nextInt(); int c1= in.nextInt(); int c2= in.nextInt(); int d1= in.nextInt(); int d2= in.nextInt(); b...
143_A. Help Vasilisa the Wise 2
Vasilisa the Wise from the Kingdom of Far Far Away got a magic box with a secret as a present from her friend Hellawisa the Wise from the Kingdom of A Little Closer. However, Vasilisa the Wise does not know what the box's secret is, since she cannot open it again. She hopes that you will help her one more time with tha...
{ "input": [ "1 2\n3 4\n5 6\n", "11 10\n13 8\n5 16\n", "3 7\n4 6\n5 5\n", "10 10\n10 10\n10 10\n" ], "output": [ "-1\n", "4 7\n9 1\n", "1 2\n3 4\n", "-1\n" ] }
{ "input": [ "3 14\n8 9\n10 7\n", "12 11\n11 12\n16 7\n", "12 17\n10 19\n13 16\n", "9 12\n3 17\n10 10\n", "10 7\n4 13\n11 6\n", "7 9\n4 12\n5 11\n", "2 4\n1 5\n3 3\n", "13 8\n15 6\n11 10\n", "8 10\n9 9\n13 5\n", "12 7\n5 14\n8 11\n", "9 6\n5 10\n3 12\n", "16 5\n13 8\n10...
IN-CORRECT
java
import java.io.IOException; import java.io.OutputStreamWriter; import java.io.BufferedWriter; import java.util.InputMismatchException; import java.io.OutputStream; import java.io.PrintWriter; import java.util.NoSuchElementException; import java.io.Writer; import java.math.BigInteger; import java.io.InputStream; /** *...
143_A. Help Vasilisa the Wise 2
Vasilisa the Wise from the Kingdom of Far Far Away got a magic box with a secret as a present from her friend Hellawisa the Wise from the Kingdom of A Little Closer. However, Vasilisa the Wise does not know what the box's secret is, since she cannot open it again. She hopes that you will help her one more time with tha...
{ "input": [ "1 2\n3 4\n5 6\n", "11 10\n13 8\n5 16\n", "3 7\n4 6\n5 5\n", "10 10\n10 10\n10 10\n" ], "output": [ "-1\n", "4 7\n9 1\n", "1 2\n3 4\n", "-1\n" ] }
{ "input": [ "3 14\n8 9\n10 7\n", "12 11\n11 12\n16 7\n", "12 17\n10 19\n13 16\n", "9 12\n3 17\n10 10\n", "10 7\n4 13\n11 6\n", "7 9\n4 12\n5 11\n", "2 4\n1 5\n3 3\n", "13 8\n15 6\n11 10\n", "8 10\n9 9\n13 5\n", "12 7\n5 14\n8 11\n", "9 6\n5 10\n3 12\n", "16 5\n13 8\n10...
IN-CORRECT
python3
r1,r2 = map(int,input().split()) c1,c2 = map(int,input().split()) d1,d2 = map(int,input().split()) c = abs(r1-c1-d2)//2 b = abs(r2-c2-d2)//2 a = abs(r1-b) d = abs(c2-b) res = [a,b,c,d] for i in res: if res.count(i)>1 or i >9: print(-1) break else: print(a,b) print(c,d)
143_A. Help Vasilisa the Wise 2
Vasilisa the Wise from the Kingdom of Far Far Away got a magic box with a secret as a present from her friend Hellawisa the Wise from the Kingdom of A Little Closer. However, Vasilisa the Wise does not know what the box's secret is, since she cannot open it again. She hopes that you will help her one more time with tha...
{ "input": [ "1 2\n3 4\n5 6\n", "11 10\n13 8\n5 16\n", "3 7\n4 6\n5 5\n", "10 10\n10 10\n10 10\n" ], "output": [ "-1\n", "4 7\n9 1\n", "1 2\n3 4\n", "-1\n" ] }
{ "input": [ "3 14\n8 9\n10 7\n", "12 11\n11 12\n16 7\n", "12 17\n10 19\n13 16\n", "9 12\n3 17\n10 10\n", "10 7\n4 13\n11 6\n", "7 9\n4 12\n5 11\n", "2 4\n1 5\n3 3\n", "13 8\n15 6\n11 10\n", "8 10\n9 9\n13 5\n", "12 7\n5 14\n8 11\n", "9 6\n5 10\n3 12\n", "16 5\n13 8\n10...
IN-CORRECT
python3
r1,r2=map(int,input().split()) c1,c2=map(int,input().split()) d1,d2=map(int,input().split()) c=0 for a in range (1,10): for b in range (1,10): for x in range (1,10): for y in range (1,10): if a +b ==r1 and x+y==r2 and a+x== c1 and b+y==c2 and a+y==d1 and b+x==d2 and a!=b and x!=y...
143_A. Help Vasilisa the Wise 2
Vasilisa the Wise from the Kingdom of Far Far Away got a magic box with a secret as a present from her friend Hellawisa the Wise from the Kingdom of A Little Closer. However, Vasilisa the Wise does not know what the box's secret is, since she cannot open it again. She hopes that you will help her one more time with tha...
{ "input": [ "1 2\n3 4\n5 6\n", "11 10\n13 8\n5 16\n", "3 7\n4 6\n5 5\n", "10 10\n10 10\n10 10\n" ], "output": [ "-1\n", "4 7\n9 1\n", "1 2\n3 4\n", "-1\n" ] }
{ "input": [ "3 14\n8 9\n10 7\n", "12 11\n11 12\n16 7\n", "12 17\n10 19\n13 16\n", "9 12\n3 17\n10 10\n", "10 7\n4 13\n11 6\n", "7 9\n4 12\n5 11\n", "2 4\n1 5\n3 3\n", "13 8\n15 6\n11 10\n", "8 10\n9 9\n13 5\n", "12 7\n5 14\n8 11\n", "9 6\n5 10\n3 12\n", "16 5\n13 8\n10...
IN-CORRECT
python3
m=input() n=input() o=input() r1,r2=m.split(" ") c1,c2=n.split(" ") d1,d2=o.split(" ") x=int((int(r1)+int(d1)-int(c2))/2) w=int((int(r2)+int(d2)-int(c2))/2) y=int((int(r1)+int(d2)-int(c1))/2) z=int((int(r2)+int(d1)-int(c1))/2) if x==y or y==z or z==w or w==x or y==w or x==z: print(-1) else: print(str(x)+" "+st...
143_A. Help Vasilisa the Wise 2
Vasilisa the Wise from the Kingdom of Far Far Away got a magic box with a secret as a present from her friend Hellawisa the Wise from the Kingdom of A Little Closer. However, Vasilisa the Wise does not know what the box's secret is, since she cannot open it again. She hopes that you will help her one more time with tha...
{ "input": [ "1 2\n3 4\n5 6\n", "11 10\n13 8\n5 16\n", "3 7\n4 6\n5 5\n", "10 10\n10 10\n10 10\n" ], "output": [ "-1\n", "4 7\n9 1\n", "1 2\n3 4\n", "-1\n" ] }
{ "input": [ "3 14\n8 9\n10 7\n", "12 11\n11 12\n16 7\n", "12 17\n10 19\n13 16\n", "9 12\n3 17\n10 10\n", "10 7\n4 13\n11 6\n", "7 9\n4 12\n5 11\n", "2 4\n1 5\n3 3\n", "13 8\n15 6\n11 10\n", "8 10\n9 9\n13 5\n", "12 7\n5 14\n8 11\n", "9 6\n5 10\n3 12\n", "16 5\n13 8\n10...
IN-CORRECT
cpp
#include <bits/stdc++.h> using namespace std; bool inrange(int y) { return 1 <= y && y <= 10; } int main() { int r1, r2, c1, c2, d1, d2; bool taken[10] = {false}; cin >> r1 >> r2 >> c1 >> c2 >> d1 >> d2; int x = (r1 + r2); int y = (c1 + c2); int z = (d1 + d2); int w; if (x == y && y == z) { y = (r1 ...
143_A. Help Vasilisa the Wise 2
Vasilisa the Wise from the Kingdom of Far Far Away got a magic box with a secret as a present from her friend Hellawisa the Wise from the Kingdom of A Little Closer. However, Vasilisa the Wise does not know what the box's secret is, since she cannot open it again. She hopes that you will help her one more time with tha...
{ "input": [ "1 2\n3 4\n5 6\n", "11 10\n13 8\n5 16\n", "3 7\n4 6\n5 5\n", "10 10\n10 10\n10 10\n" ], "output": [ "-1\n", "4 7\n9 1\n", "1 2\n3 4\n", "-1\n" ] }
{ "input": [ "3 14\n8 9\n10 7\n", "12 11\n11 12\n16 7\n", "12 17\n10 19\n13 16\n", "9 12\n3 17\n10 10\n", "10 7\n4 13\n11 6\n", "7 9\n4 12\n5 11\n", "2 4\n1 5\n3 3\n", "13 8\n15 6\n11 10\n", "8 10\n9 9\n13 5\n", "12 7\n5 14\n8 11\n", "9 6\n5 10\n3 12\n", "16 5\n13 8\n10...
IN-CORRECT
python3
r1,r2=map(int,input().split()) c1,c2=map(int,input().split()) d1,d2=map(int,input().split()) if r1+r2==c1+c2==d1+d2: if r1==c1 or r1==c2 or r1==d1 or r1==d2 or r2==c1 or r2==c2 or r2==d1 or r2==d2: print(-1) else: if (d1+r1-c2)%2==0 and (c1+r1-d2)%2==0 and c1+c2-r1==r2: if (d1+r1-c2)...
143_A. Help Vasilisa the Wise 2
Vasilisa the Wise from the Kingdom of Far Far Away got a magic box with a secret as a present from her friend Hellawisa the Wise from the Kingdom of A Little Closer. However, Vasilisa the Wise does not know what the box's secret is, since she cannot open it again. She hopes that you will help her one more time with tha...
{ "input": [ "1 2\n3 4\n5 6\n", "11 10\n13 8\n5 16\n", "3 7\n4 6\n5 5\n", "10 10\n10 10\n10 10\n" ], "output": [ "-1\n", "4 7\n9 1\n", "1 2\n3 4\n", "-1\n" ] }
{ "input": [ "3 14\n8 9\n10 7\n", "12 11\n11 12\n16 7\n", "12 17\n10 19\n13 16\n", "9 12\n3 17\n10 10\n", "10 7\n4 13\n11 6\n", "7 9\n4 12\n5 11\n", "2 4\n1 5\n3 3\n", "13 8\n15 6\n11 10\n", "8 10\n9 9\n13 5\n", "12 7\n5 14\n8 11\n", "9 6\n5 10\n3 12\n", "16 5\n13 8\n10...
IN-CORRECT
python3
r1,r2=map(int,input().split()) c1,c2=map(int,input().split()) d1,d2=map(int,input().split()) x,y=(r1+c1-d2)//2,(r1-c1+d2)//2 p,q=(c1-r1+d2)//2,(2*c2+c1-r1-d2)//2 if p<=0 or q<=0 or x<=0 or y<=0: print("-1") elif x==y and p==q and x==p: print("-1") else: print(x,y) print(p,q)
143_A. Help Vasilisa the Wise 2
Vasilisa the Wise from the Kingdom of Far Far Away got a magic box with a secret as a present from her friend Hellawisa the Wise from the Kingdom of A Little Closer. However, Vasilisa the Wise does not know what the box's secret is, since she cannot open it again. She hopes that you will help her one more time with tha...
{ "input": [ "1 2\n3 4\n5 6\n", "11 10\n13 8\n5 16\n", "3 7\n4 6\n5 5\n", "10 10\n10 10\n10 10\n" ], "output": [ "-1\n", "4 7\n9 1\n", "1 2\n3 4\n", "-1\n" ] }
{ "input": [ "3 14\n8 9\n10 7\n", "12 11\n11 12\n16 7\n", "12 17\n10 19\n13 16\n", "9 12\n3 17\n10 10\n", "10 7\n4 13\n11 6\n", "7 9\n4 12\n5 11\n", "2 4\n1 5\n3 3\n", "13 8\n15 6\n11 10\n", "8 10\n9 9\n13 5\n", "12 7\n5 14\n8 11\n", "9 6\n5 10\n3 12\n", "16 5\n13 8\n10...
IN-CORRECT
java
/* package whatever; // don't place package name! */ import java.util.*; import java.lang.*; import java.io.*; import java.io.BufferedReader; import java.io.File; import java.io.FileReader; import java.io.IOException; /* Name of the class has to be "Main" only if the class is public. */ public class bbg { public...
143_A. Help Vasilisa the Wise 2
Vasilisa the Wise from the Kingdom of Far Far Away got a magic box with a secret as a present from her friend Hellawisa the Wise from the Kingdom of A Little Closer. However, Vasilisa the Wise does not know what the box's secret is, since she cannot open it again. She hopes that you will help her one more time with tha...
{ "input": [ "1 2\n3 4\n5 6\n", "11 10\n13 8\n5 16\n", "3 7\n4 6\n5 5\n", "10 10\n10 10\n10 10\n" ], "output": [ "-1\n", "4 7\n9 1\n", "1 2\n3 4\n", "-1\n" ] }
{ "input": [ "3 14\n8 9\n10 7\n", "12 11\n11 12\n16 7\n", "12 17\n10 19\n13 16\n", "9 12\n3 17\n10 10\n", "10 7\n4 13\n11 6\n", "7 9\n4 12\n5 11\n", "2 4\n1 5\n3 3\n", "13 8\n15 6\n11 10\n", "8 10\n9 9\n13 5\n", "12 7\n5 14\n8 11\n", "9 6\n5 10\n3 12\n", "16 5\n13 8\n10...
IN-CORRECT
cpp
#include <bits/stdc++.h> using namespace std; int main() { int r1, r2, c1, c2, d1, d2; cin >> r1 >> r2 >> c1 >> c2 >> d1 >> d2; int a = (d1 + c1 - r2) / 2; int b = (d2 + c2 - r2) / 2; int c = c1 - a; int d = c2 - b; int x = 0; if (a + b == r1) x++; if (c + d == r2) x++; if (a + c == c1) x++; if (b...
143_A. Help Vasilisa the Wise 2
Vasilisa the Wise from the Kingdom of Far Far Away got a magic box with a secret as a present from her friend Hellawisa the Wise from the Kingdom of A Little Closer. However, Vasilisa the Wise does not know what the box's secret is, since she cannot open it again. She hopes that you will help her one more time with tha...
{ "input": [ "1 2\n3 4\n5 6\n", "11 10\n13 8\n5 16\n", "3 7\n4 6\n5 5\n", "10 10\n10 10\n10 10\n" ], "output": [ "-1\n", "4 7\n9 1\n", "1 2\n3 4\n", "-1\n" ] }
{ "input": [ "3 14\n8 9\n10 7\n", "12 11\n11 12\n16 7\n", "12 17\n10 19\n13 16\n", "9 12\n3 17\n10 10\n", "10 7\n4 13\n11 6\n", "7 9\n4 12\n5 11\n", "2 4\n1 5\n3 3\n", "13 8\n15 6\n11 10\n", "8 10\n9 9\n13 5\n", "12 7\n5 14\n8 11\n", "9 6\n5 10\n3 12\n", "16 5\n13 8\n10...
IN-CORRECT
java
import java.io.OutputStream; import java.io.IOException; import java.io.InputStream; import java.io.PrintWriter; import java.util.InputMismatchException; import java.io.IOException; import java.io.InputStream; /** * Built using CHelper plug-in * Actual solution is at the top * * @author Pranay2516 */ public class...
143_A. Help Vasilisa the Wise 2
Vasilisa the Wise from the Kingdom of Far Far Away got a magic box with a secret as a present from her friend Hellawisa the Wise from the Kingdom of A Little Closer. However, Vasilisa the Wise does not know what the box's secret is, since she cannot open it again. She hopes that you will help her one more time with tha...
{ "input": [ "1 2\n3 4\n5 6\n", "11 10\n13 8\n5 16\n", "3 7\n4 6\n5 5\n", "10 10\n10 10\n10 10\n" ], "output": [ "-1\n", "4 7\n9 1\n", "1 2\n3 4\n", "-1\n" ] }
{ "input": [ "3 14\n8 9\n10 7\n", "12 11\n11 12\n16 7\n", "12 17\n10 19\n13 16\n", "9 12\n3 17\n10 10\n", "10 7\n4 13\n11 6\n", "7 9\n4 12\n5 11\n", "2 4\n1 5\n3 3\n", "13 8\n15 6\n11 10\n", "8 10\n9 9\n13 5\n", "12 7\n5 14\n8 11\n", "9 6\n5 10\n3 12\n", "16 5\n13 8\n10...
IN-CORRECT
python3
r=list(map(int,input().split())) c=list(map(int,input().split())) d=list(map(int,input().split())) for i in range(1,10): ans1=[0,0] ans2=[0,0] if i<d[0] and i<r[0] and i<c[0]: ans1[0]=i ans2[1]=d[0]-ans1[0] ans1[1]=r[0]-ans1[0] if ans1[1]+ans2[1]==c[1]: ans2[0]=a...
143_A. Help Vasilisa the Wise 2
Vasilisa the Wise from the Kingdom of Far Far Away got a magic box with a secret as a present from her friend Hellawisa the Wise from the Kingdom of A Little Closer. However, Vasilisa the Wise does not know what the box's secret is, since she cannot open it again. She hopes that you will help her one more time with tha...
{ "input": [ "1 2\n3 4\n5 6\n", "11 10\n13 8\n5 16\n", "3 7\n4 6\n5 5\n", "10 10\n10 10\n10 10\n" ], "output": [ "-1\n", "4 7\n9 1\n", "1 2\n3 4\n", "-1\n" ] }
{ "input": [ "3 14\n8 9\n10 7\n", "12 11\n11 12\n16 7\n", "12 17\n10 19\n13 16\n", "9 12\n3 17\n10 10\n", "10 7\n4 13\n11 6\n", "7 9\n4 12\n5 11\n", "2 4\n1 5\n3 3\n", "13 8\n15 6\n11 10\n", "8 10\n9 9\n13 5\n", "12 7\n5 14\n8 11\n", "9 6\n5 10\n3 12\n", "16 5\n13 8\n10...
IN-CORRECT
java
//package com.prituladima.codeforce.a2oj.div2A; import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.io.PrintWriter; import java.util.*; import static java.util.stream.IntStream.range; public class Pro74 { private void solve() { int r1 = nextInt(), r...