problem_id
int64
0
1.52k
problem_name
stringlengths
5
112
description
stringlengths
209
6.47k
lang
stringclasses
4 values
code
stringlengths
7
95.5k
status
stringclasses
3 values
passed
int64
0
24
total
int64
0
25
error
stringclasses
567 values
failures
stringlengths
2
2k
source
stringclasses
5 values
difficulty
stringclasses
13 values
685
97_B. Superset
A set of points on a plane is called good, if for any two points at least one of the three conditions is true: * those two points lie on same horizontal line; * those two points lie on same vertical line; * the rectangle, with corners in these two points, contains inside or on its borders at least one point of...
python2
s = set() def build(l, r): if (l >= r): return mid = (l+r) >> 1 for i in range(l, r): s.add((a[mid][0], a[i][1])) build(l, mid) build(mid+1, r) n = input() a = [] for i in range(0, n): x, y = map(int, raw_input().split()) a.append((x, y)) a.sort() build(0, n) print len(s) for...
partial
3
16
[{"idx": 0, "reason": "wrong_answer", "expected": "3\n1 1\n1 2\n2 2", "got": "3\n1 1\n2 1\n2 2"}, {"idx": 1, "reason": "wrong_answer", "expected": "3\n0 0\n0 1\n1 0", "got": "3\n0 1\n1 0\n1 1"}, {"idx": 2, "reason": "wrong_answer", "expected": "8\n-10 1\n-2 -5\n-2 -3\n-2 -2\n-2 1\n-1 -3\n-1 -2\n4 -3", "got": "8\n-1 -5\...
codeforces
B
685
97_B. Superset
A set of points on a plane is called good, if for any two points at least one of the three conditions is true: * those two points lie on same horizontal line; * those two points lie on same vertical line; * the rectangle, with corners in these two points, contains inside or on its borders at least one point of...
python2
s = set() def build(l, r): if (l >= r): return mid = (l+r) >> 1 for i in range(l, r): s.add((a[mid][0], a[i][1])) build(l, mid) build(mid+1, r) n = input() a = [] for i in range(0, n): x, y = map(int, raw_input().split()) a.append((x, y)) a.sort() build(0, n) print len(s) for...
partial
3
16
[{"idx": 0, "reason": "wrong_answer", "expected": "3\n1 1\n1 2\n2 2", "got": "3\n1 1\n2 1\n2 2"}, {"idx": 1, "reason": "wrong_answer", "expected": "3\n0 0\n0 1\n1 0", "got": "3\n0 1\n1 0\n1 1"}, {"idx": 2, "reason": "wrong_answer", "expected": "8\n-10 1\n-2 -5\n-2 -3\n-2 -2\n-2 1\n-1 -3\n-1 -2\n4 -3", "got": "8\n-1 -5\...
codeforces
B
686
99_B. Help Chef Gerasim
In a far away kingdom young pages help to set the table for the King. As they are terribly mischievous, one needs to keep an eye on the control whether they have set everything correctly. This time the royal chef Gerasim had the impression that the pages have played a prank again: they had poured the juice from one cup...
java
//package round78; import java.io.PrintWriter; import java.util.Arrays; import java.util.Scanner; public class Div2B { Scanner in; PrintWriter out; String INPUT = ""; void solve() { int n = ni(); int[] a = new int[n]; for(int i = 0;i < n;i++) a[i] = ni(); int sum = 0; for(int i = 0;i < n;i++) { ...
all_fail
0
25
[{"idx": 0, "reason": "runtime_error", "rc": 1, "stderr": "Exception in thread \"main\" java.util.NoSuchElementException\n\tat java.base/java.util.Scanner.throwFor(Scanner.java:937)\n\tat java.base/java.util.Scanner.next(Scanner.java:1478)\n\tat Div2B.ni(Div2B.java:6", "stdout_tail": ""}, {"idx": 1, "reason": "runtime_...
codeforces
B
691
marut-and-girls
Marut is now a well settled person. Impressed by the coding skills of Marut, N girls wish to marry him. Marut will consider marriage proposals of only those girls who have some special qualities. Qualities are represented by positive non-zero integers. Marut has a list of M qualities which he wants in a girl. He can a...
python2
m = int(raw_input()) dict = {} for i in raw_input().split(" "): dict[int(i)] = 0 girls = 0 for j in range(input()): count = 0 for e in raw_input().split(" "): if int(e) in dict: count+=1 if (count >= m): girls+=1 print girls
partial
1
2
[{"idx": 0, "reason": "runtime_error", "rc": 1, "stderr": "Traceback (most recent call last):\n File \"/tmp/sbx_rrknkhw2/tmpz1jqdd56.py\", line 9, in <module>\n if int(e) in dict:\nValueError: invalid literal for int() with base 10: '4SAMPLE'\n", "stdout_tail": ""}]
hackerearth
UNKNOWN
691
marut-and-girls
Marut is now a well settled person. Impressed by the coding skills of Marut, N girls wish to marry him. Marut will consider marriage proposals of only those girls who have some special qualities. Qualities are represented by positive non-zero integers. Marut has a list of M qualities which he wants in a girl. He can a...
python2
import sys m=int(raw_input()) # mQuality=map(int,raw_input().split()) myQual={}; myCount=0; for i in raw_input().split(): myQual[(int(i))]=1; myCount=myCount+1; n=int(raw_input()) totalCount =0; # print myCount for i in range(0,n): count=0; for ele in raw_input().split(): if(myQual.has_key(int(ele))==True): ...
partial
1
2
[{"idx": 0, "reason": "runtime_error", "rc": 1, "stderr": "Traceback (most recent call last):\n File \"/tmp/sbx_dv2gs5_1/tmpd_lpfdey.py\", line 17, in <module>\n if(myQual.has_key(int(ele))==True):\nValueError: invalid literal for int() with base 10: '4SAMPLE'", "stdout_tail": ""}]
hackerearth
UNKNOWN
696
p02539 ACL Beginner Contest - Heights and Pairs
There are 2N people numbered 1 through 2N. The height of Person i is h_i. How many ways are there to make N pairs of people such that the following conditions are satisfied? Compute the answer modulo 998,244,353. * Each person is contained in exactly one pair. * For each pair, the heights of the two people in the pai...
java
import java.io.InputStream; import java.util.Arrays; import java.util.PriorityQueue; import java.util.function.IntUnaryOperator; import java.util.function.LongUnaryOperator; public class Main { static final long mod = Const.MOD998244353; static final ModArithmetic ma = ModArithmetic.of(mod); static final ...
all_fail
0
2
[{"idx": 0, "reason": "runtime_error", "rc": 1, "stderr": "Exception in thread \"main\" java.lang.reflect.InaccessibleObjectException: Unable to make field private final byte[] java.lang.String.value accessible: module java.base does not \"opens java.lang\" to un", "stdout_tail": ""}, {"idx": 1, "reason": "runtime_erro...
atcoder
UNKNOWN
698
p02799 Keyence Programming Contest 2020 - Bichromization
We have a connected undirected graph with N vertices and M edges. Edge i in this graph (1 \leq i \leq M) connects Vertex U_i and Vertex V_i bidirectionally. We are additionally given N integers D_1, D_2, ..., D_N. Determine whether the conditions below can be satisfied by assigning a color - white or black - to each v...
python3
""" 明らかに無理→最小が2つ無い or 最小同士がペアになってない (最小から接続する頂点に最小がない) 満たしてる→最小の辺を置いちゃおう 小さい奴からGreedyに置いてく? 自分の周りにendしてるやつ or 大きさが同じやつがあったら繋げちゃう そのとき白黒はどうでも良さそう? """ import sys N,M = map(int,input().split()) D = list(map(int,input().split())) dic2 = [[] for i in range(N)] for i in range(M): U,V = map(int,input().split()) ...
partial
1
3
[{"idx": 0, "reason": "wrong_answer", "expected": "BWWBB\n4\n3\n1\n5\n2", "got": "WBBWB\n4 3 1000000000 5 7"}, {"idx": 1, "reason": "wrong_answer", "expected": "BBBW\n1\n1\n1\n2\n1\n1", "got": "WBBB\n1 1 1 1000000000 1000000000 1000000000"}]
atcoder
UNKNOWN
698
p02799 Keyence Programming Contest 2020 - Bichromization
We have a connected undirected graph with N vertices and M edges. Edge i in this graph (1 \leq i \leq M) connects Vertex U_i and Vertex V_i bidirectionally. We are additionally given N integers D_1, D_2, ..., D_N. Determine whether the conditions below can be satisfied by assigning a color - white or black - to each v...
cpp
#include<bits/stdc++.h> #define LL long long #define uLL unsigned long long using namespace std; const int N=2e5+10,inf=1e9; int rd() { int x=0,w=1;char ch=0; while(ch<'0'||ch>'9'){if(ch=='-') w=-1;ch=getchar();} while(ch>='0'&&ch<='9'){x=x*10+(ch^48);ch=getchar();} return x*w; } int to[N<<1],nt[N<<1],...
partial
1
3
[{"idx": 0, "reason": "wrong_answer", "expected": "BWWBB\n4\n3\n1\n5\n2", "got": "BWWWW\n1000000000\n3\n1\n1\n2"}, {"idx": 1, "reason": "wrong_answer", "expected": "BBBW\n1\n1\n1\n2\n1\n1", "got": "BWWW\n1\n1\n1\n1000000000\n1000000000\n1000000000"}]
atcoder
UNKNOWN
698
p02799 Keyence Programming Contest 2020 - Bichromization
We have a connected undirected graph with N vertices and M edges. Edge i in this graph (1 \leq i \leq M) connects Vertex U_i and Vertex V_i bidirectionally. We are additionally given N integers D_1, D_2, ..., D_N. Determine whether the conditions below can be satisfied by assigning a color - white or black - to each v...
cpp
#include <string> #include <vector> #include <sstream> #include <iostream> #include <algorithm> #include <map> #include <list> #include <set> #include <numeric> #include <queue> #include <stack> #include <cstdio> #include <cmath> #include <cstdlib> #include <cctype> #include <cstring> #include <climits> #include <cfloa...
partial
1
3
[{"idx": 0, "reason": "wrong_answer", "expected": "BWWBB\n4\n3\n1\n5\n2", "got": "BWWBW\n4\n3\n4\n5\n7"}, {"idx": 1, "reason": "wrong_answer", "expected": "BBBW\n1\n1\n1\n2\n1\n1", "got": "BWWW\n1\n1\n1\n1\n1\n1"}]
atcoder
UNKNOWN
698
p02799 Keyence Programming Contest 2020 - Bichromization
We have a connected undirected graph with N vertices and M edges. Edge i in this graph (1 \leq i \leq M) connects Vertex U_i and Vertex V_i bidirectionally. We are additionally given N integers D_1, D_2, ..., D_N. Determine whether the conditions below can be satisfied by assigning a color - white or black - to each v...
python3
from collections import defaultdict import sys sys.setrecursionlimit(10 ** 6) int1 = lambda x: int(x) - 1 p2D = lambda x: print(*x, sep="\n") def II(): return int(sys.stdin.readline()) def MI(): return map(int, sys.stdin.readline().split()) def MI1(): return map(int1, sys.stdin.readline().split()) def LI(): return lis...
partial
1
3
[{"idx": 0, "reason": "wrong_answer", "expected": "BWWBB\n4\n3\n1\n5\n2", "got": "WBBWB\n4\n3\n1000000000\n5\n7"}, {"idx": 1, "reason": "wrong_answer", "expected": "BBBW\n1\n1\n1\n2\n1\n1", "got": "WBBB\n1\n1\n1\n1000000000\n1000000000\n1000000000"}]
atcoder
UNKNOWN
698
p02799 Keyence Programming Contest 2020 - Bichromization
We have a connected undirected graph with N vertices and M edges. Edge i in this graph (1 \leq i \leq M) connects Vertex U_i and Vertex V_i bidirectionally. We are additionally given N integers D_1, D_2, ..., D_N. Determine whether the conditions below can be satisfied by assigning a color - white or black - to each v...
cpp
#include <bits/stdc++.h> using namespace std; using ll = long long; template<class T,class U> using P = pair<T,U>; template<class T> using vec = vector<T>; template<class T> using vvec = vector<vec<T>>; struct edge{ ll to,id; }; int main(){ cin.tie(0); ios::sync_with_stdio(false); int N,M; cin >> ...
partial
1
3
[{"idx": 0, "reason": "wrong_answer", "expected": "BWWBB\n4\n3\n1\n5\n2", "got": "BBWBB\n1\n3\n1000000000\n1\n2"}, {"idx": 1, "reason": "wrong_answer", "expected": "BBBW\n1\n1\n1\n2\n1\n1", "got": "BWWW\n1\n1\n1\n1000000000\n1000000000\n1000000000"}]
atcoder
UNKNOWN
698
p02799 Keyence Programming Contest 2020 - Bichromization
We have a connected undirected graph with N vertices and M edges. Edge i in this graph (1 \leq i \leq M) connects Vertex U_i and Vertex V_i bidirectionally. We are additionally given N integers D_1, D_2, ..., D_N. Determine whether the conditions below can be satisfied by assigning a color - white or black - to each v...
python3
class UnionFind: def __init__(self, n): self.parent = list(range(n)) #親ノード self.size = [1]*n #グループの要素数 def root(self, x): #root(x): xの根ノードを返す. while self.parent[x] != x: self.parent[x] = self.parent[self.parent[x]] x = self.parent[x] return x def ...
partial
1
3
[{"idx": 0, "reason": "wrong_answer", "expected": "BWWBB\n4\n3\n1\n5\n2", "got": "WBBWB\n4\n3\n1000000000\n5\n7"}, {"idx": 1, "reason": "wrong_answer", "expected": "BBBW\n1\n1\n1\n2\n1\n1", "got": "WBBB\n1\n1\n1\n1000000000\n1000000000\n1000000000"}]
atcoder
UNKNOWN
698
p02799 Keyence Programming Contest 2020 - Bichromization
We have a connected undirected graph with N vertices and M edges. Edge i in this graph (1 \leq i \leq M) connects Vertex U_i and Vertex V_i bidirectionally. We are additionally given N integers D_1, D_2, ..., D_N. Determine whether the conditions below can be satisfied by assigning a color - white or black - to each v...
java
import java.util.*; import java.io.*; public class Main { static ArrayList<Edge>[] graph; public static void main(String[] args) { FastScanner scanner = new FastScanner(); PrintWriter out = new PrintWriter(System.out,false); int n = scanner.nextInt(); int m = scanner.nextInt(); ...
partial
1
3
[{"idx": 0, "reason": "wrong_answer", "expected": "BWWBB\n4\n3\n1\n5\n2", "got": "BWWBW\n4\n3\n1000000000\n5\n7"}, {"idx": 1, "reason": "wrong_answer", "expected": "BBBW\n1\n1\n1\n2\n1\n1", "got": "BWWW\n1\n1\n1\n1000000000\n1000000000\n1000000000"}]
atcoder
UNKNOWN
698
p02799 Keyence Programming Contest 2020 - Bichromization
We have a connected undirected graph with N vertices and M edges. Edge i in this graph (1 \leq i \leq M) connects Vertex U_i and Vertex V_i bidirectionally. We are additionally given N integers D_1, D_2, ..., D_N. Determine whether the conditions below can be satisfied by assigning a color - white or black - to each v...
java
import java.util.*; import java.io.*; public class Main { static ArrayList<Edge>[] graph; public static void main(String[] args) { FastScanner scanner = new FastScanner(); PrintWriter out = new PrintWriter(System.out,false); int n = scanner.nextInt(); int m = scanner.nextInt(); ...
partial
1
3
[{"idx": 0, "reason": "wrong_answer", "expected": "BWWBB\n4\n3\n1\n5\n2", "got": "BBWBB\n1\n3\n1000000000\n1\n2"}, {"idx": 1, "reason": "wrong_answer", "expected": "BBBW\n1\n1\n1\n2\n1\n1", "got": "BWWW\n1\n1\n1\n1000000000\n1000000000\n1000000000"}]
atcoder
UNKNOWN
698
p02799 Keyence Programming Contest 2020 - Bichromization
We have a connected undirected graph with N vertices and M edges. Edge i in this graph (1 \leq i \leq M) connects Vertex U_i and Vertex V_i bidirectionally. We are additionally given N integers D_1, D_2, ..., D_N. Determine whether the conditions below can be satisfied by assigning a color - white or black - to each v...
java
import java.awt.Point; import java.io.File; import java.io.FileInputStream; import java.io.FileNotFoundException; import java.io.FileOutputStream; import java.io.IOException; import java.io.InputStream; import java.io.PrintStream; import java.io.PrintWriter; import java.io.Serializable; import java.util.AbstractLis...
partial
1
3
[{"idx": 0, "reason": "wrong_answer", "expected": "BWWBB\n4\n3\n1\n5\n2", "got": "WBBWB\n4\n3\n1000000000\n5\n7"}, {"idx": 1, "reason": "wrong_answer", "expected": "BBBW\n1\n1\n1\n2\n1\n1", "got": "WBBB\n1\n1\n1\n1000000000\n1000000000\n1000000000"}]
atcoder
UNKNOWN
703
p03521 CODE FESTIVAL 2017 Exhibition (Parallel) - Awkward
ButCoder Inc. is a startup company whose main business is the development and operation of the programming competition site "ButCoder". There are N members of the company including the president, and each member except the president has exactly one direct boss. Each member has a unique ID number from 1 to N, and the m...
cpp
#include <bits/stdc++.h> using namespace std; #define pb push_back #define mp make_pair #define x first #define y second typedef long long ll; typedef pair<int,int> pii; typedef vector<int> vi; typedef vector<pii> vpii; const int N=2010; const int mod=1000000007; const int inv2=(mod+1)/2; vi e[2010]; int dp[2010][2...
compile_error
0
0
COMPILE_ERROR:/tmp/sbx_11zhyu_9/tmp4yiiikoe.cpp: In function ‘void dfs(int)’: /tmp/sbx_11zhyu_9/tmp4yiiikoe.cpp:34:23: error: reference to ‘size’ is ambiguous 34 | dp[k][1][0]=1;size[k]=1; | ^~~~ In file included from /usr/include/c++/11/string:54, from /usr/inclu...
[]
atcoder
UNKNOWN
714
p01756 Longest Match
Given the string S and m queries. The i-th query is given by the two strings xi and yi. For each query, answer the longest substring of the string S, starting with xi and ending with yi. For the string S, | S | represents the length of S. Also, the fact that the character string T is a substring of the character stri...
cpp
#include<stdio.h> #include<algorithm> #include<string> #include<iostream> using namespace std; #define MAX 200005 #define INF (1<<26) int segN=1000000; struct data{ int value; data* ch[2]; void init(){ value=INF; ch[0]=new data; ch[1]=new data; ch[0]->ch[0]=NULL; ...
compile_error
0
0
COMPILE_ERROR:/tmp/sbx__zp19351/tmpcn38g3_h.cpp:111:1: error: reference to ‘data’ is ambiguous 111 | data T,T2; | ^~~~ In file included from /usr/include/c++/11/array:41, from /usr/include/c++/11/tuple:39, from /usr/include/c++/11/functional:54, from /usr/inclu...
[]
aizu
UNKNOWN
726
1025_B. Weakened Common Divisor
During the research on properties of the greatest common divisor (GCD) of a set of numbers, Ildar, a famous mathematician, introduced a brand new concept of the weakened common divisor (WCD) of a list of pairs of integers. For a given list of pairs of integers (a_1, b_1), (a_2, b_2), ..., (a_n, b_n) their WCD is arbit...
java
import java.util.*; import java.util.stream.*; import java.io.*; import java.math.*; public class Main { static boolean FROM_FILE = false; static class FastReader { BufferedReader br; StringTokenizer st; public FastReader() { if (FROM_FILE) { t...
partial
20
25
[{"idx": 1, "reason": "wrong_answer", "expected": "2", "got": "6"}, {"idx": 2, "reason": "wrong_answer", "expected": "3", "got": "15"}, {"idx": 5, "reason": "wrong_answer", "expected": "2", "got": "9"}, {"idx": 10, "reason": "wrong_answer", "expected": "1000000007", "got": "998244353"}, {"idx": 23, "reason": "wrong_ans...
codeforces
B
726
1025_B. Weakened Common Divisor
During the research on properties of the greatest common divisor (GCD) of a set of numbers, Ildar, a famous mathematician, introduced a brand new concept of the weakened common divisor (WCD) of a list of pairs of integers. For a given list of pairs of integers (a_1, b_1), (a_2, b_2), ..., (a_n, b_n) their WCD is arbit...
cpp
#include <bits/stdc++.h> using namespace std; long long mod = 1e9 + 7; const double pi = acos(-1); int n; pair<int, int> arr[150005]; unordered_map<int, int> mp, mp2; int main() { scanf("%d", &n); for (int i = 0; i < n; i++) scanf("%d%d", &arr[i].first, &arr[i].second); for (int i = 2; i <= sqrt(arr[n - 1].first)...
partial
18
25
[{"idx": 1, "reason": "wrong_answer", "expected": "2", "got": "3"}, {"idx": 2, "reason": "wrong_answer", "expected": "3", "got": "5"}, {"idx": 5, "reason": "wrong_answer", "expected": "2", "got": "3"}, {"idx": 10, "reason": "wrong_answer", "expected": "1000000007", "got": "998244353"}, {"idx": 12, "reason": "wrong_answ...
codeforces
B
726
1025_B. Weakened Common Divisor
During the research on properties of the greatest common divisor (GCD) of a set of numbers, Ildar, a famous mathematician, introduced a brand new concept of the weakened common divisor (WCD) of a list of pairs of integers. For a given list of pairs of integers (a_1, b_1), (a_2, b_2), ..., (a_n, b_n) their WCD is arbit...
java
import java.util.Scanner; import java.util.HashSet; public class ProbB { private static void getPrimeFactor(int n, HashSet<Integer> primeFactor){ for(int i=2; i*i<=n; i++){ if(n%i==0){ primeFactor.add(i); while(n%i==0){ n /= i; } } } if(n!=1&&n!=0){ primeFactor.add(n); } } public...
partial
23
25
[{"idx": 8, "reason": "wrong_answer", "expected": "1999349071", "got": "1999608911"}, {"idx": 10, "reason": "wrong_answer", "expected": "1000000007", "got": "998244353"}]
codeforces
B
726
1025_B. Weakened Common Divisor
During the research on properties of the greatest common divisor (GCD) of a set of numbers, Ildar, a famous mathematician, introduced a brand new concept of the weakened common divisor (WCD) of a list of pairs of integers. For a given list of pairs of integers (a_1, b_1), (a_2, b_2), ..., (a_n, b_n) their WCD is arbit...
java
import java.util.*; import java.io.*; public class Solve{ public static void main(String[] args) throws Exception{ Fast sc=new Fast(); StringBuilder sb=new StringBuilder(); int n=sc.nextInt(); int[] ar=new int[n]; int[] br=new int[n]; f...
partial
18
25
[{"idx": 1, "reason": "wrong_answer", "expected": "2", "got": "6"}, {"idx": 2, "reason": "wrong_answer", "expected": "3", "got": "15"}, {"idx": 5, "reason": "wrong_answer", "expected": "2", "got": "10"}, {"idx": 8, "reason": "wrong_answer", "expected": "1999349071", "got": "1999608911"}, {"idx": 12, "reason": "wrong_an...
codeforces
B
726
1025_B. Weakened Common Divisor
During the research on properties of the greatest common divisor (GCD) of a set of numbers, Ildar, a famous mathematician, introduced a brand new concept of the weakened common divisor (WCD) of a list of pairs of integers. For a given list of pairs of integers (a_1, b_1), (a_2, b_2), ..., (a_n, b_n) their WCD is arbit...
cpp
#include <bits/stdc++.h> using namespace std; template <class t, class u> void chmax(t& first, u second) { if (first < second) first = second; } template <class t, class u> void chmin(t& first, u second) { if (second < first) first = second; } vector<pair<int, int> > first; int n; set<int> cand; void factorise(long...
partial
24
25
[{"idx": 10, "reason": "wrong_answer", "expected": "1000000007", "got": "998244353"}]
codeforces
B
726
1025_B. Weakened Common Divisor
During the research on properties of the greatest common divisor (GCD) of a set of numbers, Ildar, a famous mathematician, introduced a brand new concept of the weakened common divisor (WCD) of a list of pairs of integers. For a given list of pairs of integers (a_1, b_1), (a_2, b_2), ..., (a_n, b_n) their WCD is arbit...
python3
def gcd(a,b): if a%b==0: return b else: return gcd(b,a%b) import math def pr(n): a=[] while n % 2 == 0: a.append(2) n = n / 2 for i in range(3,int(math.sqrt(n))+1,2): while n % i== 0: a.append(i) n = n /...
partial
23
25
[{"idx": 5, "reason": "wrong_answer", "expected": "2", "got": "10"}, {"idx": 8, "reason": "wrong_answer", "expected": "1999349071", "got": "1999608911"}]
codeforces
B
726
1025_B. Weakened Common Divisor
During the research on properties of the greatest common divisor (GCD) of a set of numbers, Ildar, a famous mathematician, introduced a brand new concept of the weakened common divisor (WCD) of a list of pairs of integers. For a given list of pairs of integers (a_1, b_1), (a_2, b_2), ..., (a_n, b_n) their WCD is arbit...
python3
import sys import math f=sys.stdin def prime_factors(n): factors = [] d=2 while n>1: while n%d==0: factors.append(d) n/=d d=d+1 if d*d>n: if n>1: factors.append(n) break return factors[0] n=int(f.readline().rstrip('\r...
partial
24
25
[{"idx": 8, "reason": "wrong_answer", "expected": "1999349071", "got": "1999608911"}]
codeforces
B
726
1025_B. Weakened Common Divisor
During the research on properties of the greatest common divisor (GCD) of a set of numbers, Ildar, a famous mathematician, introduced a brand new concept of the weakened common divisor (WCD) of a list of pairs of integers. For a given list of pairs of integers (a_1, b_1), (a_2, b_2), ..., (a_n, b_n) their WCD is arbit...
python2
def gcd(a,b): return a if b==0 else gcd(b,a%b) n,g=int(raw_input()),0 a,b=[0]*n,[0]*n for i in range(n): a[i],b[i]=map(int,raw_input().split()) g=gcd(g,a[i]*b[i]) for i in range(n): if gcd(g,a[i])>1: g=gcd(g,a[i]) else: g=gcd(g,b[i]) print(g if g>1 else -1)
partial
23
25
[{"idx": 1, "reason": "wrong_answer", "expected": "2", "got": "3"}, {"idx": 5, "reason": "wrong_answer", "expected": "2", "got": "10"}]
codeforces
B
726
1025_B. Weakened Common Divisor
During the research on properties of the greatest common divisor (GCD) of a set of numbers, Ildar, a famous mathematician, introduced a brand new concept of the weakened common divisor (WCD) of a list of pairs of integers. For a given list of pairs of integers (a_1, b_1), (a_2, b_2), ..., (a_n, b_n) their WCD is arbit...
python2
def gcd(a, b): if a % b == 0: return b return gcd(b, a % b) n = input() pairs = [map(int, raw_input().strip().split()) for _ in range(n)] g = pairs[0][0] * pairs[0][1] for pair in pairs[1:]: g = gcd(pair[0] * pair[1], g) if g == 1: print -1 exit() for pair in pairs: gt = gcd(pair[0...
partial
23
25
[{"idx": 1, "reason": "wrong_answer", "expected": "2", "got": "3"}, {"idx": 5, "reason": "wrong_answer", "expected": "2", "got": "10"}]
codeforces
B
726
1025_B. Weakened Common Divisor
During the research on properties of the greatest common divisor (GCD) of a set of numbers, Ildar, a famous mathematician, introduced a brand new concept of the weakened common divisor (WCD) of a list of pairs of integers. For a given list of pairs of integers (a_1, b_1), (a_2, b_2), ..., (a_n, b_n) their WCD is arbit...
python2
from sys import stdin def fast2(): import os, sys, atexit from cStringIO import StringIO as BytesIO # range = xrange sys.stdout = BytesIO() atexit.register(lambda: os.write(1, sys.stdout.getvalue())) return BytesIO(os.read(0, os.fstat(0).st_size)).readline def factorize(n): # o(sqr(n)) ...
all_fail
0
25
[{"idx": 0, "reason": "runtime_error", "rc": 1, "stderr": "Traceback (most recent call last):\n File \"/tmp/sbx_rnu2gv0z/tmp894j1yc8.py\", line 33, in <module>\n n = int(input())\nValueError: invalid literal for int() with base 10: ''\n", "stdout_tail": ""}, {"idx": 1, "reason": "runtime_error", "rc": 1, "stderr": ...
codeforces
B
727
1068_D. Array Without Local Maximums
Ivan unexpectedly saw a present from one of his previous birthdays. It is array of n numbers from 1 to 200. Array is old and some numbers are hard to read. Ivan remembers that for all elements at least one of its neighbours ls not less than it, more formally: a_{1} ≤ a_{2}, a_{n} ≤ a_{n-1} and a_{i} ≤ max(a_{i-1}, ...
python3
import os from io import BytesIO from math import trunc input = BytesIO(os.read(0, os.fstat(0).st_size)).readline MX = 201 MOD = 998244353 MODF = float(MOD) quickmod = lambda x: x - MODF * trunc(x / MODF) def main(): n = int(input()) a = map(int, input().split()) dp0 = [1.0] * MX dp1 = [0.0] * MX ...
all_fail
0
18
[{"idx": 0, "reason": "runtime_error", "rc": 1, "stderr": "Traceback (most recent call last):\n File \"/tmp/sbx_50ggw9jc/tmp838m7t45.py\", line 44, in <module>\n main()\n File \"/tmp/sbx_50ggw9jc/tmp838m7t45.py\", line 15, in main\n n = int(input())\n ^", "stdout_tail": ""}, {"idx": 1, "reason": "runtime...
codeforces
D
727
1068_D. Array Without Local Maximums
Ivan unexpectedly saw a present from one of his previous birthdays. It is array of n numbers from 1 to 200. Array is old and some numbers are hard to read. Ivan remembers that for all elements at least one of its neighbours ls not less than it, more formally: a_{1} ≤ a_{2}, a_{n} ≤ a_{n-1} and a_{i} ≤ max(a_{i-1}, ...
python2
import os from io import BytesIO range = xrange input = BytesIO(os.read(0, os.fstat(0).st_size)).readline MOD = 998244353 MODF = 1.0*MOD from math import trunc def quickmod(a): return a-MODF*trunc(a/MODF) def main(): n = int(input()) a = [int(i) for i in input().split()] f0, f1 = [1.0] * 201, [0.0] ...
all_fail
0
18
[{"idx": 0, "reason": "runtime_error", "rc": 1, "stderr": "Traceback (most recent call last):\n File \"/tmp/sbx_7mlgguik/tmp9vnc_vbw.py\", line 36, in <module>\n main()\n File \"/tmp/sbx_7mlgguik/tmp9vnc_vbw.py\", line 14, in main\n n = int(input())\nValueErro", "stdout_tail": ""}, {"idx": 1, "reason": "runtime...
codeforces
D
728
1090_C. New Year Presents
Santa has prepared boxes with presents for n kids, one box for each kid. There are m kinds of presents: balloons, sweets, chocolate bars, toy cars... A child would be disappointed to receive two presents of the same kind, so all kinds of presents in one box are distinct. Having packed all the presents, Santa realized ...
cpp
#include <bits/stdc++.h> using namespace std; const int maxn = 100005; pair<int, int> qq[maxn]; int q[maxn], s, o[maxn]; set<int> w[maxn], z; vector<pair<pair<int, int>, int> > r; int main() { int n, m, a, b, qa, qb; ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0); cin >> n >> m; for (int i = 0; i < n...
partial
8
12
[{"idx": 0, "reason": "wrong_answer", "expected": "2\n1 2 3\n1 3 1", "got": "2\n1 3 1\n1 2 3"}, {"idx": 3, "reason": "wrong_answer", "expected": "9\n1 2 1\n1 2 2\n1 2 3\n1 2 4\n1 2 5\n4 3 1\n4 3 2\n4 3 4\n4 3 5", "got": "9\n1 2 1\n4 3 1\n1 2 2\n4 3 2\n1 2 3\n1 2 4\n4 3 4\n1 2 5\n4 3 5"}, {"idx": 5, "reason": "wrong_ans...
codeforces
C
728
1090_C. New Year Presents
Santa has prepared boxes with presents for n kids, one box for each kid. There are m kinds of presents: balloons, sweets, chocolate bars, toy cars... A child would be disappointed to receive two presents of the same kind, so all kinds of presents in one box are distinct. Having packed all the presents, Santa realized ...
cpp
#include <bits/stdc++.h> template <class t> inline void read(t &s) { s = 0; register int f = 1; register char c = getchar(); while (!isdigit(c)) { if (c == '-') f = -1; c = getchar(); } while (isdigit(c)) s = (s << 3) + (s << 1) + (c ^ 48), c = getchar(); s *= f; return; } template <class t, cla...
partial
6
12
[{"idx": 0, "reason": "wrong_answer", "expected": "2\n1 2 3\n1 3 1", "got": "2\n1 3 5\n1 2 3"}, {"idx": 3, "reason": "wrong_answer", "expected": "9\n1 2 1\n1 2 2\n1 2 3\n1 2 4\n1 2 5\n4 3 1\n4 3 2\n4 3 4\n4 3 5", "got": "9\n1 2 8\n1 2 5\n1 2 10\n1 2 3\n1 2 2\n4 3 8\n4 3 5\n4 3 10\n4 3 2"}, {"idx": 5, "reason": "wrong_a...
codeforces
C
728
1090_C. New Year Presents
Santa has prepared boxes with presents for n kids, one box for each kid. There are m kinds of presents: balloons, sweets, chocolate bars, toy cars... A child would be disappointed to receive two presents of the same kind, so all kinds of presents in one box are distinct. Having packed all the presents, Santa realized ...
cpp
#include <bits/stdc++.h> using namespace std; const int N = 100100; int n, pos[N], f[N], m, sz[N]; set<int> mp1[N]; bool cmp(int fi, int se) { return sz[fi] > sz[se]; } int main() { ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0); cin >> n >> m; int sum = 0; for (int i = 1; i <= n; i++) { cin >> s...
partial
6
12
[{"idx": 0, "reason": "wrong_answer", "expected": "2\n1 2 3\n1 3 1", "got": "2\n1 3 1\n1 2 3"}, {"idx": 3, "reason": "wrong_answer", "expected": "9\n1 2 1\n1 2 2\n1 2 3\n1 2 4\n1 2 5\n4 3 1\n4 3 2\n4 3 4\n4 3 5", "got": "9\n1 2 1\n1 2 3\n1 2 5\n1 2 8\n1 2 10\n4 3 1\n4 3 4\n4 3 6\n4 3 8"}, {"idx": 5, "reason": "wrong_an...
codeforces
C
728
1090_C. New Year Presents
Santa has prepared boxes with presents for n kids, one box for each kid. There are m kinds of presents: balloons, sweets, chocolate bars, toy cars... A child would be disappointed to receive two presents of the same kind, so all kinds of presents in one box are distinct. Having packed all the presents, Santa realized ...
java
import java.util.*; import java.io.*; import java.lang.reflect.Array; import java.math.BigInteger; public class A { FastScanner in; PrintWriter out; boolean systemIO = true; public int gcd(int a, int b) { if (a == 0) { return b; } return gcd(b % a, a); } public class Pair { int x; int y; public...
partial
10
12
[{"idx": 0, "reason": "wrong_answer", "expected": "2\n1 2 3\n1 3 1", "got": "2\n1 3 1\n1 2 3"}, {"idx": 7, "reason": "wrong_answer", "expected": "3\n3 1 1\n3 2 2\n3 2 3", "got": "3\n3 2 1\n3 1 2\n3 1 3"}]
codeforces
C
728
1090_C. New Year Presents
Santa has prepared boxes with presents for n kids, one box for each kid. There are m kinds of presents: balloons, sweets, chocolate bars, toy cars... A child would be disappointed to receive two presents of the same kind, so all kinds of presents in one box are distinct. Having packed all the presents, Santa realized ...
java
import java.io.*; import java.util.*; import java.math.*; import java.lang.*; import static java.lang.Math.*; public class Main implements Runnable { static class InputReader { private InputStream stream; private byte[] buf = new byte[1024]; private int curChar; private int numCha...
partial
10
12
[{"idx": 7, "reason": "wrong_answer", "expected": "3\n3 1 1\n3 2 2\n3 2 3", "got": "3\n3 1 1\n3 1 2\n3 2 3"}, {"idx": 8, "reason": "wrong_answer", "expected": "9\n3 2 2\n3 2 4\n3 2 5\n3 2 6\n3 2 7\n3 2 8\n3 1 11\n3 1 12\n3 1 13", "got": "9\n3 1 5\n3 1 6\n3 1 8\n3 2 2\n3 2 4\n3 2 7\n3 2 10\n3 2 11\n3 2 12"}]
codeforces
C
728
1090_C. New Year Presents
Santa has prepared boxes with presents for n kids, one box for each kid. There are m kinds of presents: balloons, sweets, chocolate bars, toy cars... A child would be disappointed to receive two presents of the same kind, so all kinds of presents in one box are distinct. Having packed all the presents, Santa realized ...
python2
n, m = map(int, raw_input().split()) a = [] u = [{} for i in xrange(n)] k = 0 for i in xrange(n): s = map(int, raw_input().split()) a.append([s[0], i]) for x in s[1:]: u[i][x] = 1 k += s[0] a = sorted(a) h = n - (k % n) k = k / n wi = 0 w = [() for i in xrange(10 ** 6)] for i in xrange(n): if a[i]...
partial
9
12
[{"idx": 0, "reason": "wrong_answer", "expected": "2\n1 2 3\n1 3 1", "got": "2\n1 2 3\n1 3 5"}, {"idx": 3, "reason": "wrong_answer", "expected": "9\n1 2 1\n1 2 2\n1 2 3\n1 2 4\n1 2 5\n4 3 1\n4 3 2\n4 3 4\n4 3 5", "got": "9\n4 2 1\n4 2 2\n4 2 4\n4 2 5\n1 2 3\n1 3 4\n1 3 5\n1 3 6\n1 3 8"}, {"idx": 5, "reason": "wrong_ans...
codeforces
C
729
1157_C2. Increasing Subsequence (hard version)
The only difference between problems C1 and C2 is that all values in input of problem C1 are distinct (this condition may be false for problem C2). You are given a sequence a consisting of n integers. You are making a sequence of moves. During each move you must take either the leftmost element of the sequence or the...
java
import java.util.Scanner; public class C1157 { public static void main(String[] args) { Scanner in = new Scanner(System.in); int N = in.nextInt(); int[] A = new int[N]; for (int n=0; n<N; n++) { A[n] = in.nextInt(); } StringBuilder output = new StringBui...
partial
24
25
[{"idx": 2, "reason": "wrong_answer", "expected": "4\nLLRR", "got": "4\nLLRL"}]
codeforces
C
729
1157_C2. Increasing Subsequence (hard version)
The only difference between problems C1 and C2 is that all values in input of problem C1 are distinct (this condition may be false for problem C2). You are given a sequence a consisting of n integers. You are making a sequence of moves. During each move you must take either the leftmost element of the sequence or the...
java
//package CF_555; import java.util.Scanner; public class C2 { public static void main(String[] args) { // TODO Auto-generated method stub Scanner scan = new Scanner(System.in); int n = scan.nextInt(); int[] a = new int[n]; for (int i = 0; i < n; i++) { a[i] = scan.nextInt(); } int res = 0; String...
partial
19
25
[{"idx": 0, "reason": "wrong_answer", "expected": "6\nLRLRRR", "got": "6\nLRLRLL"}, {"idx": 2, "reason": "wrong_answer", "expected": "4\nLLRR", "got": "4\nLLRL"}, {"idx": 3, "reason": "wrong_answer", "expected": "1\nR", "got": "1\nL"}, {"idx": 10, "reason": "wrong_answer", "expected": "2\nRR", "got": "2\nRL"}, {"idx": ...
codeforces
C
729
1157_C2. Increasing Subsequence (hard version)
The only difference between problems C1 and C2 is that all values in input of problem C1 are distinct (this condition may be false for problem C2). You are given a sequence a consisting of n integers. You are making a sequence of moves. During each move you must take either the leftmost element of the sequence or the...
python2
import decimal,math from collections import Counter,defaultdict from fractions import gcd decimal.getcontext().prec = 100 def divisors(n) : abc=[] i = 1 while i <= math.sqrt(n): if (n % i == 0) : if (n / i == i) : abc.append(i) else : abc.append(i) abc.append(n/i) i = i + 1 ab...
partial
19
25
[{"idx": 0, "reason": "wrong_answer", "expected": "6\nLRLRRR", "got": "6\nLRLRLL"}, {"idx": 2, "reason": "wrong_answer", "expected": "4\nLLRR", "got": "4\nLLRL"}, {"idx": 3, "reason": "wrong_answer", "expected": "1\nR", "got": "1\nL"}, {"idx": 10, "reason": "wrong_answer", "expected": "2\nRR", "got": "2\nRL"}, {"idx": ...
codeforces
C
729
1157_C2. Increasing Subsequence (hard version)
The only difference between problems C1 and C2 is that all values in input of problem C1 are distinct (this condition may be false for problem C2). You are given a sequence a consisting of n integers. You are making a sequence of moves. During each move you must take either the leftmost element of the sequence or the...
cpp
#include <bits/stdc++.h> using namespace std; const int mx = 2e5 + 10; int n; int a[mx]; char ans[mx]; char res[2][mx]; int num; int main() { scanf("%d", &n); for (int i = 1; i <= n; ++i) { scanf("%d", &a[i]); } int l = 1, r = n; int minn = -1; while (l <= r) { if (a[l] < a[r]) { if (a[l] > mi...
partial
24
25
[{"idx": 2, "reason": "wrong_answer", "expected": "4\nLLRR", "got": "4\nLLRL"}]
codeforces
C
729
1157_C2. Increasing Subsequence (hard version)
The only difference between problems C1 and C2 is that all values in input of problem C1 are distinct (this condition may be false for problem C2). You are given a sequence a consisting of n integers. You are making a sequence of moves. During each move you must take either the leftmost element of the sequence or the...
python2
##################################### import atexit, io, sys, collections, math, heapq, fractions, bisect,copy buffer = io.BytesIO() sys.stdout = buffer @atexit.register def write(): sys.__stdout__.write(buffer.getvalue()) ##################################### n = int(raw_input()) q = collections.deque(map(in...
partial
19
25
[{"idx": 0, "reason": "wrong_answer", "expected": "6\nLRLRRR", "got": "6\nLRLRLL"}, {"idx": 2, "reason": "wrong_answer", "expected": "4\nLLRR", "got": "4\nLLRL"}, {"idx": 3, "reason": "wrong_answer", "expected": "1\nR", "got": "1\nL"}, {"idx": 10, "reason": "wrong_answer", "expected": "2\nRR", "got": "2\nRL"}, {"idx": ...
codeforces
C
730
1179_E. Alesya and Discrete Math
We call a function good if its domain of definition is some set of integers and if in case it's defined in x and x-1, f(x) = f(x-1) + 1 or f(x) = f(x-1). Tanya has found n good functions f_{1}, …, f_{n}, which are defined on all integers from 0 to 10^{18} and f_i(0) = 0 and f_i(10^{18}) = L for all i from 1 to n. It's...
cpp
#include <bits/stdc++.h> using namespace std; long long query(int i, long long x) { cout << "? " << i + 1 << ' ' << x << endl; long long r; cin >> r; return r; } pair<long long, long long> ans[1000]; mt19937_64 mrand(chrono::steady_clock::now().time_since_epoch().count()); double log_fac[2000]; double log_ncr(i...
partial
3
5
[{"idx": 0, "reason": "timeout"}, {"idx": 4, "reason": "timeout"}]
codeforces
E
730
1179_E. Alesya and Discrete Math
We call a function good if its domain of definition is some set of integers and if in case it's defined in x and x-1, f(x) = f(x-1) + 1 or f(x) = f(x-1). Tanya has found n good functions f_{1}, …, f_{n}, which are defined on all integers from 0 to 10^{18} and f_i(0) = 0 and f_i(10^{18}) = L for all i from 1 to n. It's...
cpp
#include <bits/stdc++.h> using namespace std; long long SIZE = (long long)1e18; int remains = 200000; vector<set<pair<long long, long long>>> evals; long long need; vector<long long> resLeft; vector<long long> resRight; long long realEval(int fid, long long x) { --remains; assert(remains >= 0); printf("? %d %lld\...
all_fail
0
5
[{"idx": 0, "reason": "runtime_error", "rc": -6, "stderr": "tmp_p2x5s1g.cpp.bin: /tmp/sbx_9p8jcnjh/tmp_p2x5s1g.cpp:105: int main(): Assertion `realEval(i, resRight[i]) - realEval(i, resLeft[i]) >= need' failed.\n", "stdout_tail": "000000444\n? 1 500000000000000222\n? 1 500000000000000111\n? 1 500000000000000055\n? 1 50...
codeforces
E
730
1179_E. Alesya and Discrete Math
We call a function good if its domain of definition is some set of integers and if in case it's defined in x and x-1, f(x) = f(x-1) + 1 or f(x) = f(x-1). Tanya has found n good functions f_{1}, …, f_{n}, which are defined on all integers from 0 to 10^{18} and f_i(0) = 0 and f_i(10^{18}) = L for all i from 1 to n. It's...
cpp
#include <bits/stdc++.h> using namespace std; const int N = 1e3 + 5; vector<int> operator+(vector<int> a, const vector<int>& b) { for (auto x : b) { a.push_back(x); } return a; } class rnd { public: rnd() { srand((unsigned)time(NULL)); } int rand(int l, int r) { return ::rand() % (r - l) + l; } } rnd; in...
partial
3
5
[{"idx": 0, "reason": "timeout"}, {"idx": 4, "reason": "timeout"}]
codeforces
E
733
12_B. Correct Solution?
One cold winter evening Alice and her older brother Bob was sitting at home near the fireplace and giving each other interesting problems to solve. When it was Alice's turn, she told the number n to Bob and said: —Shuffle the digits in this number in order to obtain the smallest possible number without leading zeroes....
cpp
#include <bits/stdc++.h> using namespace std; long long n, m, i, j; int a[50], x; char b[50]; bool f; int main() { cin >> n; i = 1; while (n > 0) { a[i] = n % 10; n = n / 10; i++; } sort(a + 1, a + i); if (a[1] == 0) { for (j = 2; j < i; j++) { if (a[j] > 0) { swap(a[1], a[j]);...
compile_error
0
0
COMPILE_ERROR:/tmp/sbx_172m7bh8/tmp6aq95a13.cpp: In function ‘int main()’: /tmp/sbx_172m7bh8/tmp6aq95a13.cpp:24:3: error: ‘gets’ was not declared in this scope; did you mean ‘getw’? 24 | gets(b); | ^~~~ | getw
[]
codeforces
B
736
1364_C. Ehab and Prefix MEXs
Given an array a of length n, find another array, b, of length n such that: * for each i (1 ≤ i ≤ n) MEX(\\{b_1, b_2, …, b_i\})=a_i. The MEX of a set of integers is the smallest non-negative integer that doesn't belong to this set. If such array doesn't exist, determine this. Input The first line contains an ...
python2
import sys if sys.subversion[0] == "PyPy": import io, atexit sys.stdout = io.BytesIO() atexit.register(lambda: sys.__stdout__.write(sys.stdout.getvalue())) sys.stdin = io.BytesIO(sys.stdin.read()) raw_input = lambda: sys.stdin.readline().rstrip() RS = raw_input RI = lambda : map(int,RS().split...
partial
3
7
[{"idx": 2, "reason": "wrong_answer", "expected": "1 3 4 0", "got": "1000000 1000000 1 0"}, {"idx": 3, "reason": "wrong_answer", "expected": "1 3 0 4 2 7 5", "got": "4 1 0 3 2 1000000 5"}, {"idx": 5, "reason": "wrong_answer", "expected": "0 1 2 3 5 6 4 8 9 7", "got": "0 1 2 3 6 5 4 9 8 7"}, {"idx": 6, "reason": "wrong_...
codeforces
C
736
1364_C. Ehab and Prefix MEXs
Given an array a of length n, find another array, b, of length n such that: * for each i (1 ≤ i ≤ n) MEX(\\{b_1, b_2, …, b_i\})=a_i. The MEX of a set of integers is the smallest non-negative integer that doesn't belong to this set. If such array doesn't exist, determine this. Input The first line contains an ...
cpp
#include <bits/stdc++.h> using namespace std; bool vis[1000008]; int link[1000008]; void solve() { int a, k, i, j, n, sum = 0, mx = 0, ind, ct = 1, curr = 0, remain = -1; cin >> n; int D[n + 5]; for (i = 0; i < n; i++) { cin >> D[i]; vis[D[i]] = 1; } link[D[n - 1]] = D[n - 1]; for (i = 0; i < n - ...
compile_error
0
0
COMPILE_ERROR:/tmp/sbx_qea_9iov/tmpcx5xf1yg.cpp:4:17: error: ‘int link [1000008]’ redeclared as different kind of entity 4 | int link[1000008]; | ^ In file included from /usr/include/x86_64-linux-gnu/bits/sigstksz.h:24, from /usr/include/signal.h:328, from /us...
[]
codeforces
C
736
1364_C. Ehab and Prefix MEXs
Given an array a of length n, find another array, b, of length n such that: * for each i (1 ≤ i ≤ n) MEX(\\{b_1, b_2, …, b_i\})=a_i. The MEX of a set of integers is the smallest non-negative integer that doesn't belong to this set. If such array doesn't exist, determine this. Input The first line contains an ...
cpp
#include <bits/stdc++.h> using namespace std; int t, n, a[100010], b[100010]; int f[1000010], exist[1000010]; int main() { for (int i = 0; i < 100010; ++i) { b[i] = -1; } scanf("%d ", &n); for (int j = 1; j <= n; ++j) { scanf("%d", &a[j]); exist[a[j]] = j; if (a[j] > j) { puts("-1"); ...
partial
6
7
[{"idx": 2, "reason": "wrong_answer", "expected": "1 3 4 0", "got": "1 3 3 0"}]
codeforces
C
736
1364_C. Ehab and Prefix MEXs
Given an array a of length n, find another array, b, of length n such that: * for each i (1 ≤ i ≤ n) MEX(\\{b_1, b_2, …, b_i\})=a_i. The MEX of a set of integers is the smallest non-negative integer that doesn't belong to this set. If such array doesn't exist, determine this. Input The first line contains an ...
python2
from __future__ import print_function, division from sys import stdin, stdout from fractions import gcd from math import * from collections import * rstr = lambda: stdin.readline().strip() rstrs = lambda: [str(x) for x in stdin.readline().split()] rint = lambda: int(stdin.readline()) rints = lambda: [int(x) for x in s...
partial
6
7
[{"idx": 2, "reason": "wrong_answer", "expected": "1 3 4 0", "got": "1 3 3 0"}]
codeforces
C
737
1384_D. GameGame
Koa the Koala and her best friend want to play a game. The game starts with an array a of length n consisting of non-negative integers. Koa and her best friend move in turns and each have initially a score equal to 0. Koa starts. Let's describe a move in the game: * During his move, a player chooses any element of...
python2
# Author: yumtam # Created at: 2020-09-10 20:19 from __future__ import division, print_function _interactive = False def main(): for _ in range(int(input())): n = int(input()) ar = input_as_list() mx = 1<<30 while mx: cnt = 0 for x in ar: ...
all_fail
0
2
[{"idx": 0, "reason": "runtime_error", "rc": 1, "stderr": "Traceback (most recent call last):\n File \"/tmp/sbx_lju492xw/tmpgss86oyb.py\", line 85, in <module>\n main()\n File \"/tmp/sbx_lju492xw/tmpgss86oyb.py\", line 8, in main\n for _ in range(int(input())", "stdout_tail": ""}, {"idx": 1, "reason": "runtime_...
codeforces
D
739
1427_B. Chess Cheater
You like playing chess tournaments online. In your last tournament you played n games. For the sake of this problem, each chess game is either won or lost (no draws). When you lose a game you get 0 points. When you win you get 1 or 2 points: if you have won also the previous game you get 2 points, otherwise you get 1 ...
java
import java.io.ByteArrayInputStream; import java.io.IOException; import java.io.InputStream; import java.io.PrintWriter; import java.util.Arrays; import java.util.InputMismatchException; public class B { InputStream is; PrintWriter out; String INPUT = ""; void solve() { for(int T = ni();T > 0;T--)go(); } ...
all_fail
0
1
[{"idx": 0, "reason": "wrong_answer", "expected": "7\n11\n6\n26\n46\n0\n1\n6", "got": "[0ms]"}]
codeforces
B
747
317_B. Ants
It has been noted that if some ants are put in the junctions of the graphene integer lattice then they will act in the following fashion: every minute at each junction (x, y) containing at least four ants a group of four ants will be formed, and these four ants will scatter to the neighbouring junctions (x + 1, y), (x ...
python3
from sys import * f = lambda: map(int, stdin.readline().split()) n, t = f() m = 65 r = range(m) p = [[0] * m for i in r] p[1][0] = n // 4 p[0][0] = n % 4 q = k = 1 while q: k += 1 q = 0 for x in r[1:k]: for y in r[:x + 1]: if p[x][y] < 4: continue q = 1 d = ...
partial
9
19
[{"idx": 3, "reason": "timeout"}, {"idx": 4, "reason": "timeout"}, {"idx": 5, "reason": "runtime_error", "rc": -24, "stderr": "", "stdout_tail": ""}, {"idx": 6, "reason": "timeout"}, {"idx": 10, "reason": "runtime_error", "rc": -24, "stderr": "", "stdout_tail": ""}]
codeforces
B
747
317_B. Ants
It has been noted that if some ants are put in the junctions of the graphene integer lattice then they will act in the following fashion: every minute at each junction (x, y) containing at least four ants a group of four ants will be formed, and these four ants will scatter to the neighbouring junctions (x + 1, y), (x ...
python3
from sys import * f = lambda: map(int, stdin.readline().split()) n, t = f() m = 65 r = range(m) p = [[0] * m for i in r] p[1][0] = n // 4 p[0][0] = n % 4 ultima = 5 q = k = 1 while q: k += 1 q = 0 for x in r[1:k]: for y in r[:x + 1]: if p[x][y] < 4: continue ...
partial
9
19
[{"idx": 3, "reason": "runtime_error", "rc": -24, "stderr": "", "stdout_tail": ""}, {"idx": 4, "reason": "runtime_error", "rc": -24, "stderr": "", "stdout_tail": ""}, {"idx": 5, "reason": "timeout"}, {"idx": 6, "reason": "timeout"}, {"idx": 10, "reason": "runtime_error", "rc": -24, "stderr": "", "stdout_tail": ""}]
codeforces
B
747
317_B. Ants
It has been noted that if some ants are put in the junctions of the graphene integer lattice then they will act in the following fashion: every minute at each junction (x, y) containing at least four ants a group of four ants will be formed, and these four ants will scatter to the neighbouring junctions (x + 1, y), (x ...
python3
from sys import * f = lambda: map(int, stdin.readline().split()) n, t = f() m = 65 r = range(1, m) p = [[0] * m for i in range(m)] p[1][0] = n // 4 p[0][0] = n % 4 s = k = 1 while s: s = 0 for x in r[:k]: if p[x][0] > 3: s = 1 d = p[x][0] // 4 p[x][0] %= 4 ...
partial
9
19
[{"idx": 3, "reason": "runtime_error", "rc": -24, "stderr": "", "stdout_tail": ""}, {"idx": 4, "reason": "runtime_error", "rc": -24, "stderr": "", "stdout_tail": ""}, {"idx": 5, "reason": "timeout"}, {"idx": 6, "reason": "timeout"}, {"idx": 10, "reason": "timeout"}]
codeforces
B
749
364_D. Ghd
John Doe offered his sister Jane Doe find the gcd of some set of numbers a. Gcd is a positive integer g, such that all number from the set are evenly divisible by g and there isn't such g' (g' > g), that all numbers of the set are evenly divisible by g'. Unfortunately Jane couldn't cope with the task and John offered...
cpp
#include <bits/stdc++.h> using namespace std; inline long long read() { long long x = 0, f = 1; char ch = getchar(); for (; ch < '0' || ch > '9'; ch = getchar()) if (ch == '-') f = -1; for (; ch >= '0' && ch <= '9'; ch = getchar()) x = (x << 1) + (x << 3) + ch - 48; return x * f; } inline long long gc...
partial
6
7
[{"idx": 5, "reason": "runtime_error", "rc": -11, "stderr": "", "stdout_tail": ""}]
codeforces
D
751
409_A. The Great Game
Two teams meet in The Game World Championship. Some scientists consider this game to be the most intellectually challenging game in the world. You are given two strings describing the teams' actions in the final battle. Figure out who became the champion. Input The input contains two strings of equal length (between ...
java
import java.util.*; import static java.lang.System.out; import static java.lang.Math.*; public class T { public static void main(String... args) { Scanner in = new Scanner(System.in); String s1 = in.next(); String s2 = in.next(); int score = 0; for (int i = 0; i < s1.length()-1; i+=2) { String t1 = s1.su...
partial
24
25
[{"idx": 1, "reason": "runtime_error", "rc": 1, "stderr": "Exception in thread \"main\" java.lang.StringIndexOutOfBoundsException: begin 8, end 10, length 9\n\tat java.base/java.lang.String.checkBoundsBeginEnd(String.java:4606)\n\tat java.base/java.lang.String.subs", "stdout_tail": ""}]
codeforces
A
751
409_A. The Great Game
Two teams meet in The Game World Championship. Some scientists consider this game to be the most intellectually challenging game in the world. You are given two strings describing the teams' actions in the final battle. Figure out who became the champion. Input The input contains two strings of equal length (between ...
cpp
#include <bits/stdc++.h> using namespace std; string s, s1; long long a, b, n; int main() { ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0); cin >> s; cin >> s1; n = (long long)s.size(); for (long long i = 0; i < n; i += 2) { if (s[i] == s1[i]) continue; if (s[i] == '8') { if (s1[i] ==...
partial
24
25
[{"idx": 0, "reason": "wrong_answer", "expected": "TEAM 2 WINS", "got": "TEAM 1 WINS"}]
codeforces
A
751
409_A. The Great Game
Two teams meet in The Game World Championship. Some scientists consider this game to be the most intellectually challenging game in the world. You are given two strings describing the teams' actions in the final battle. Figure out who became the champion. Input The input contains two strings of equal length (between ...
python3
""" Codeforces April Fools Contest 2014 Problem A Author : chaotic_iak Language: Python 3.3.4 """ class InputHandlerObject(object): inputs = [] def getInput(self, n = 0): res = "" inputs = self.inputs if not inputs: inputs.extend(input().split(" ")) if n == 0: res...
partial
23
25
[{"idx": 0, "reason": "runtime_error", "rc": 1, "stderr": "Traceback (most recent call last):\n File \"/tmp/sbx_4wpflwsx/tmp1jduangw.py\", line 35, in <module>\n n = plays.index(y[2*i:2*i+2])\n ^^^^^^^^^^^^^^^^^^^^^^^^^\nValueError: '8&' is not in list\n", "stdout_tail": ""}, {"idx": 1, "reason": "runtime_er...
codeforces
A
751
409_A. The Great Game
Two teams meet in The Game World Championship. Some scientists consider this game to be the most intellectually challenging game in the world. You are given two strings describing the teams' actions in the final battle. Figure out who became the champion. Input The input contains two strings of equal length (between ...
cpp
#include <bits/stdc++.h> using namespace std; int main() { string s1, s2, ds1, ds2; int b; b = 0; cin >> s1; cin >> s2; for (int i = 0; i < s1.length(); i += 2) { ds1 = ""; ds2 = ""; ds1 += s1[i]; ds1 += s1[i + 1]; ds2 += s2[i]; ds2 += s2[i + 1]; if (ds1 == "8<" && ds2 == "[]") ...
partial
23
25
[{"idx": 0, "reason": "wrong_answer", "expected": "TEAM 2 WINS", "got": "TIE"}, {"idx": 1, "reason": "wrong_answer", "expected": "TEAM 1 WINS", "got": "TIE"}]
codeforces
A
751
409_A. The Great Game
Two teams meet in The Game World Championship. Some scientists consider this game to be the most intellectually challenging game in the world. You are given two strings describing the teams' actions in the final battle. Figure out who became the champion. Input The input contains two strings of equal length (between ...
java
import java.util.Scanner; /** * Created by maxim on 23.03.16. */ public class game { public static void main(String args[]){ Scanner in = new Scanner(System.in); String firstLine = in.nextLine(); String secondLine = in.nextLine(); int counter1 = 0; int cointer2 = 0; ...
partial
24
25
[{"idx": 1, "reason": "runtime_error", "rc": 1, "stderr": "Exception in thread \"main\" java.lang.StringIndexOutOfBoundsException: String index out of range: 10\n\tat java.base/java.lang.StringLatin1.charAt(StringLatin1.java:48)\n\tat java.base/java.lang.String.cha", "stdout_tail": ""}]
codeforces
A
751
409_A. The Great Game
Two teams meet in The Game World Championship. Some scientists consider this game to be the most intellectually challenging game in the world. You are given two strings describing the teams' actions in the final battle. Figure out who became the champion. Input The input contains two strings of equal length (between ...
java
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; /** * * @author gEoRgE-PC */ public class TheGreatGame { public static void main(String[] args) throws IOException { InputStreamReader isr = new InputStreamReader(System.in); BufferedReader br = new Buff...
partial
24
25
[{"idx": 1, "reason": "runtime_error", "rc": 1, "stderr": "Exception in thread \"main\" java.lang.StringIndexOutOfBoundsException: String index out of range: 9\n\tat java.base/java.lang.StringLatin1.charAt(StringLatin1.java:48)\n\tat java.base/java.lang.String.char", "stdout_tail": ""}]
codeforces
A
751
409_A. The Great Game
Two teams meet in The Game World Championship. Some scientists consider this game to be the most intellectually challenging game in the world. You are given two strings describing the teams' actions in the final battle. Figure out who became the champion. Input The input contains two strings of equal length (between ...
python3
cnt=0 t1=input() t2=input() for i in range(0,len(t1),2): p1=t1[i:i+2] p2=t2[i:i+2] if(p1=="8<"): if(p2=="[]"): cnt+=1 elif(p2=="()"): cnt-=1 elif(p1=="[]"): if(p2=="()"): cnt+=1 elif(p2=="8<"): cnt-=1 else: if(p2...
partial
23
25
[{"idx": 0, "reason": "wrong_answer", "expected": "TEAM 2 WINS", "got": "TIE"}, {"idx": 1, "reason": "wrong_answer", "expected": "TEAM 1 WINS", "got": "TEAM 2 WINS"}]
codeforces
A
751
409_A. The Great Game
Two teams meet in The Game World Championship. Some scientists consider this game to be the most intellectually challenging game in the world. You are given two strings describing the teams' actions in the final battle. Figure out who became the champion. Input The input contains two strings of equal length (between ...
python2
import sys def compare_figures(first, second): #print 'Compare_figures called. First: {0}, second: {1}'.format(first, second) return \ first == '[]' and second == '8<' or \ first == '()' and second == '[]' or \ first == '8<' and second == '()' class Figure(object): def __init__(sel...
partial
23
25
[{"idx": 0, "reason": "runtime_error", "rc": 1, "stderr": "Traceback (most recent call last):\n File \"/tmp/sbx_14ciovv_/tmppcpewpb3.py\", line 65, in <module>\n main()\n File \"/tmp/sbx_14ciovv_/tmppcpewpb3.py\", line 50, in main\n first = parse_game(first)\n", "stdout_tail": ""}, {"idx": 1, "reason": "runtime...
codeforces
A
751
409_A. The Great Game
Two teams meet in The Game World Championship. Some scientists consider this game to be the most intellectually challenging game in the world. You are given two strings describing the teams' actions in the final battle. Figure out who became the champion. Input The input contains two strings of equal length (between ...
python3
def ii(): return int(input()) def fi(): return float(input()) def si(): return input() def mi(): return map(int,input().split()) def li(): return list(mi()) s=si() t=si() c=d=0 for i in range(0,len(s)-1,2): if s[i]=="8": if t[i]=="[": c+=1 elif t[i]=="(": d+=1 elif s[...
partial
24
25
[{"idx": 1, "reason": "runtime_error", "rc": 1, "stderr": "Traceback (most recent call last):\n File \"/tmp/sbx_iafa_jro/tmp6cuenbfx.py\", line 17, in <module>\n if t[i]==\"8\":\n ~^^^\nIndexError: string index out of range\n", "stdout_tail": ""}]
codeforces
A
751
409_A. The Great Game
Two teams meet in The Game World Championship. Some scientists consider this game to be the most intellectually challenging game in the world. You are given two strings describing the teams' actions in the final battle. Figure out who became the champion. Input The input contains two strings of equal length (between ...
python2
c, a = {'(': 0, '[': 1, '8': 2}, 0 for x, y in zip(raw_input()[::2], raw_input()[::2]): if c[x] == (c[y] + 1) % 3: a += 1 elif c[y] == (c[x] + 1) % 3: a -= 1 print 'TEAM 1 WINS' if a > 0 else 'TEAM 2 WINS' if a < 0 else 'TIE'
partial
23
25
[{"idx": 0, "reason": "runtime_error", "rc": 1, "stderr": "Traceback (most recent call last):\n File \"/tmp/sbx_pewswcj6/tmpvym7z6cf.py\", line 3, in <module>\n if c[x] == (c[y] + 1) % 3: a += 1\nKeyError: 'l'\n", "stdout_tail": ""}, {"idx": 1, "reason": "runtime_error", "rc": 1, "stderr": "Traceback (most recent c...
codeforces
A
751
409_A. The Great Game
Two teams meet in The Game World Championship. Some scientists consider this game to be the most intellectually challenging game in the world. You are given two strings describing the teams' actions in the final battle. Figure out who became the champion. Input The input contains two strings of equal length (between ...
python2
s1 = raw_input() s2 = raw_input() def calc(a, b): a = [a[i:i+2] for i in range(0, len(a), 2)] b = [b[i:i+2] for i in range(0, len(b), 2)] v = map(lambda a, b: {'()[]': 1, '()8<': -1, '()()': 0, '8<[]': -1, '8<()': 1, '8<8<': 0, '[]8<': 1, '[]()': -1, '[][]': 0}[a+b], a, b) return sum(v) v = calc(s1, s2)...
partial
23
25
[{"idx": 0, "reason": "runtime_error", "rc": 1, "stderr": "Traceback (most recent call last):\n File \"/tmp/sbx_mouttg6v/tmpdyi4rps5.py\", line 8, in <module>\n v = calc(s1, s2)\n File \"/tmp/sbx_mouttg6v/tmpdyi4rps5.py\", line 6, in calc\n v = map(lambda a, ", "stdout_tail": ""}, {"idx": 1, "reason": "runtime_...
codeforces
A
752
459_C. Pashmak and Buses
Recently Pashmak has been employed in a transportation company. The company has k buses and has a contract with a school which has n students. The school planned to take the students to d different places for d days (each day in one place). Each day the company provides all the buses for the trip. Pashmak has to arrang...
cpp
#include <bits/stdc++.h> using namespace std; template <typename T, size_t N> int SIZE(const T (&t)[N]) { return N; } template <typename T> int SIZE(const T &t) { return t.size(); } string to_string(const string s, int x1 = 0, int x2 = 1e9) { return '"' + ((x1 < s.size()) ? s.substr(x1, x2 - x1 + 1) : "") + '"'; ...
partial
10
25
[{"idx": 0, "reason": "wrong_answer", "expected": "1 2 1\n1 1 2", "got": "2 1 2\n1 2 2"}, {"idx": 4, "reason": "wrong_answer", "expected": "1 2 3 4 5 6 7 8 1 2 3 4 5 6 7 8 1 2 3 4 5 6 7 8 1 2 3 4 5 6 7 8 1 2 3 4 5 6 7 8 1 2 3 4 5 6 7 8 1 2 3 4 5 6 7 8 1 2 3 4 5 6 7 8 1 2 3 4 5 6 7 8 1 2 3 4 5 6 7 8 1 2 3 4 5 6 7 8 1 2 ...
codeforces
C
752
459_C. Pashmak and Buses
Recently Pashmak has been employed in a transportation company. The company has k buses and has a contract with a school which has n students. The school planned to take the students to d different places for d days (each day in one place). Each day the company provides all the buses for the trip. Pashmak has to arrang...
java
import java.util.ArrayList; import java.util.Arrays; import java.util.Scanner; public class C { MyScanner sc = new MyScanner(); Scanner sc2 = new Scanner(System.in); final int MOD = 1000000007; int[] dx = { 1, 0, 0, -1 }; int[] dy = { 0, 1, -1, 0 }; ArrayList<int[]> list; int n, k, d; void run() { n = sc.n...
partial
14
25
[{"idx": 0, "reason": "wrong_answer", "expected": "1 2 1\n1 1 2", "got": "1 1 2\n1 2 1"}, {"idx": 4, "reason": "wrong_answer", "expected": "1 2 3 4 5 6 7 8 1 2 3 4 5 6 7 8 1 2 3 4 5 6 7 8 1 2 3 4 5 6 7 8 1 2 3 4 5 6 7 8 1 2 3 4 5 6 7 8 1 2 3 4 5 6 7 8 1 2 3 4 5 6 7 8 1 2 3 4 5 6 7 8 1 2 3 4 5 6 7 8 1 2 3 4 5 6 7 8 1 2 ...
codeforces
C
752
459_C. Pashmak and Buses
Recently Pashmak has been employed in a transportation company. The company has k buses and has a contract with a school which has n students. The school planned to take the students to d different places for d days (each day in one place). Each day the company provides all the buses for the trip. Pashmak has to arrang...
cpp
#include <bits/stdc++.h> int n, k, d, tot, a[1010], ans[1010][1010]; void tr(int x) { if (x > d) { ++tot; for (int i = 1; i <= d; ++i) ans[i][tot] = a[i]; return; } for (int i = 1; i <= k; ++i) { a[x] = i; tr(x + 1); if (tot >= n) return; } } int main() { scanf("%d%d%d", &n, &k, &d); ...
partial
14
25
[{"idx": 0, "reason": "wrong_answer", "expected": "1 2 1\n1 1 2", "got": "1 1 2\n1 2 1"}, {"idx": 4, "reason": "wrong_answer", "expected": "1 2 3 4 5 6 7 8 1 2 3 4 5 6 7 8 1 2 3 4 5 6 7 8 1 2 3 4 5 6 7 8 1 2 3 4 5 6 7 8 1 2 3 4 5 6 7 8 1 2 3 4 5 6 7 8 1 2 3 4 5 6 7 8 1 2 3 4 5 6 7 8 1 2 3 4 5 6 7 8 1 2 3 4 5 6 7 8 1 2 ...
codeforces
C
752
459_C. Pashmak and Buses
Recently Pashmak has been employed in a transportation company. The company has k buses and has a contract with a school which has n students. The school planned to take the students to d different places for d days (each day in one place). Each day the company provides all the buses for the trip. Pashmak has to arrang...
cpp
#include <bits/stdc++.h> using namespace std; const int Maxn = 1005; int n, k, d; int res[Maxn][Maxn]; bool Check(int n, int k, int d) { long long cur = 1; while (cur < n && d) { cur *= k; d--; } return n <= cur; } void Solve(int num) { int j = num; for (int i = d - 1; i >= 0; i--) { int cur = n...
partial
14
25
[{"idx": 0, "reason": "wrong_answer", "expected": "1 2 1\n1 1 2", "got": "1 1 2\n1 2 1"}, {"idx": 4, "reason": "wrong_answer", "expected": "1 2 3 4 5 6 7 8 1 2 3 4 5 6 7 8 1 2 3 4 5 6 7 8 1 2 3 4 5 6 7 8 1 2 3 4 5 6 7 8 1 2 3 4 5 6 7 8 1 2 3 4 5 6 7 8 1 2 3 4 5 6 7 8 1 2 3 4 5 6 7 8 1 2 3 4 5 6 7 8 1 2 3 4 5 6 7 8 1 2 ...
codeforces
C
752
459_C. Pashmak and Buses
Recently Pashmak has been employed in a transportation company. The company has k buses and has a contract with a school which has n students. The school planned to take the students to d different places for d days (each day in one place). Each day the company provides all the buses for the trip. Pashmak has to arrang...
python3
# by the authority of GOD author: manhar singh sachdev # import os,sys from io import BytesIO, IOBase def base(x,k,d): ans = [] while x: ans.append(x%k+1) x //= k ans.reverse() return [1]*(d-len(ans))+ans def main(): n,k,d = map(int,input().split()) if n == 1: for ...
partial
14
25
[{"idx": 0, "reason": "wrong_answer", "expected": "1 2 1\n1 1 2", "got": "1 1 2\n1 2 1"}, {"idx": 4, "reason": "wrong_answer", "expected": "1 2 3 4 5 6 7 8 1 2 3 4 5 6 7 8 1 2 3 4 5 6 7 8 1 2 3 4 5 6 7 8 1 2 3 4 5 6 7 8 1 2 3 4 5 6 7 8 1 2 3 4 5 6 7 8 1 2 3 4 5 6 7 8 1 2 3 4 5 6 7 8 1 2 3 4 5 6 7 8 1 2 3 4 5 6 7 8 1 2 ...
codeforces
C
752
459_C. Pashmak and Buses
Recently Pashmak has been employed in a transportation company. The company has k buses and has a contract with a school which has n students. The school planned to take the students to d different places for d days (each day in one place). Each day the company provides all the buses for the trip. Pashmak has to arrang...
java
import java.util.Scanner; public class CodeForces { public static void main(String[] args) { Scanner sc = new Scanner(System.in); int n = sc.nextInt(); int k = sc.nextInt(); int d = sc.nextInt(); int[][] arrangement = new int[n][d]; for (int j =0; j <d; j+...
partial
14
25
[{"idx": 0, "reason": "wrong_answer", "expected": "1 2 1\n1 1 2", "got": "1 1 2\n1 2 1"}, {"idx": 4, "reason": "wrong_answer", "expected": "1 2 3 4 5 6 7 8 1 2 3 4 5 6 7 8 1 2 3 4 5 6 7 8 1 2 3 4 5 6 7 8 1 2 3 4 5 6 7 8 1 2 3 4 5 6 7 8 1 2 3 4 5 6 7 8 1 2 3 4 5 6 7 8 1 2 3 4 5 6 7 8 1 2 3 4 5 6 7 8 1 2 3 4 5 6 7 8 1 2 ...
codeforces
C
752
459_C. Pashmak and Buses
Recently Pashmak has been employed in a transportation company. The company has k buses and has a contract with a school which has n students. The school planned to take the students to d different places for d days (each day in one place). Each day the company provides all the buses for the trip. Pashmak has to arrang...
java
import java.io.*; import java.util.*; import java.math.*; public class Main { public void solve() throws IOException{ long n = in.nextLong(); long k = in.nextLong(); long d = in.nextLong(); if(!check(n, k, d)){ out.println(-1); return; }else{ ...
partial
14
25
[{"idx": 0, "reason": "wrong_answer", "expected": "1 2 1\n1 1 2", "got": "1 1 2\n1 2 1"}, {"idx": 4, "reason": "wrong_answer", "expected": "1 2 3 4 5 6 7 8 1 2 3 4 5 6 7 8 1 2 3 4 5 6 7 8 1 2 3 4 5 6 7 8 1 2 3 4 5 6 7 8 1 2 3 4 5 6 7 8 1 2 3 4 5 6 7 8 1 2 3 4 5 6 7 8 1 2 3 4 5 6 7 8 1 2 3 4 5 6 7 8 1 2 3 4 5 6 7 8 1 2 ...
codeforces
C
752
459_C. Pashmak and Buses
Recently Pashmak has been employed in a transportation company. The company has k buses and has a contract with a school which has n students. The school planned to take the students to d different places for d days (each day in one place). Each day the company provides all the buses for the trip. Pashmak has to arrang...
python3
import copy inp = list(map(int, input().split())) n, k, d = inp[0], inp[1], inp[2] c = 0 ans = [] def rec(arr): global c if c >= n: return if len(arr) == d: c += 1 ans.append(copy.deepcopy(arr)) return temp = copy.deepcopy(arr) temp.append(0) for i in range(1, k + 1): if c >= n: brea...
partial
14
25
[{"idx": 0, "reason": "wrong_answer", "expected": "1 2 1\n1 1 2", "got": "1 1 2\n1 2 1"}, {"idx": 4, "reason": "wrong_answer", "expected": "1 2 3 4 5 6 7 8 1 2 3 4 5 6 7 8 1 2 3 4 5 6 7 8 1 2 3 4 5 6 7 8 1 2 3 4 5 6 7 8 1 2 3 4 5 6 7 8 1 2 3 4 5 6 7 8 1 2 3 4 5 6 7 8 1 2 3 4 5 6 7 8 1 2 3 4 5 6 7 8 1 2 3 4 5 6 7 8 1 2 ...
codeforces
C
753
480_B. Long Jumps
Valery is a PE teacher at a school in Berland. Soon the students are going to take a test in long jumps, and Valery has lost his favorite ruler! However, there is no reason for disappointment, as Valery has found another ruler, its length is l centimeters. The ruler already has n marks, with which he can make measure...
cpp
#include <bits/stdc++.h> using namespace std; map<long long, bool> m; int n, l; long long x, y; int s = -1; int main() { ios::sync_with_stdio(false); bool f1 = false, f2 = false; cin >> n >> l >> x >> y; for (int i = 1; i <= n; i++) { long long t; cin >> t; m[t] = true; if (t - x >= 0) if ...
partial
18
25
[{"idx": 5, "reason": "wrong_answer", "expected": "1\n43", "got": "1\n45"}, {"idx": 6, "reason": "wrong_answer", "expected": "1\n50", "got": "1\n70"}, {"idx": 10, "reason": "wrong_answer", "expected": "1\n150", "got": "1\n160"}, {"idx": 13, "reason": "wrong_answer", "expected": "1\n1808", "got": "1\n54"}, {"idx": 16, "...
codeforces
B
753
480_B. Long Jumps
Valery is a PE teacher at a school in Berland. Soon the students are going to take a test in long jumps, and Valery has lost his favorite ruler! However, there is no reason for disappointment, as Valery has found another ruler, its length is l centimeters. The ruler already has n marks, with which he can make measure...
java
import java.util.*; public class Ishani { public static void main(String [] args){ Scanner in=new Scanner(System.in); int n=in.nextInt(); long l=in.nextLong(); long x=in.nextLong(); long y=in.nextLong(); long array[]=new long[n]; HashSet<Long>hs=new HashSet<Long>(); for(int i=0;i<n;i++){ array[i]=in.nextLong(); hs...
partial
22
25
[{"idx": 6, "reason": "wrong_answer", "expected": "1\n50", "got": "1\n70"}, {"idx": 13, "reason": "wrong_answer", "expected": "1\n1808", "got": "1\n54"}, {"idx": 23, "reason": "wrong_answer", "expected": "1\n10", "got": "1\n11"}]
codeforces
B
753
480_B. Long Jumps
Valery is a PE teacher at a school in Berland. Soon the students are going to take a test in long jumps, and Valery has lost his favorite ruler! However, there is no reason for disappointment, as Valery has found another ruler, its length is l centimeters. The ruler already has n marks, with which he can make measure...
python2
import math from bisect import bisect_left n, l, x, y = map(int, raw_input().split()) marks = map(int, raw_input().split()) markx = set() marky = set() def in_range(x): return x >= 0 and x <= l for mark in marks: if in_range(mark + x): markx.add(mark + x) if in_range(mark - x): markx.add(mark - x) i...
partial
23
25
[{"idx": 10, "reason": "wrong_answer", "expected": "1\n150", "got": "1\n160"}, {"idx": 16, "reason": "wrong_answer", "expected": "1\n510", "got": "1\n520"}]
codeforces
B
753
480_B. Long Jumps
Valery is a PE teacher at a school in Berland. Soon the students are going to take a test in long jumps, and Valery has lost his favorite ruler! However, there is no reason for disappointment, as Valery has found another ruler, its length is l centimeters. The ruler already has n marks, with which he can make measure...
python2
n,l,x,y=map(int,raw_input().split()) ori=map(int,raw_input().split()) boy=[] girl=[] for i in ori: if i+y<=l: boy.append(i+y) if 0<=i-y: boy.append(i-y) if i+x<=l: girl.append(i+x) if i-x>=0: girl.append(i-x) tem=0 boy.sort() girl.sort() bh=False gh=False for i in boy: ...
partial
24
25
[{"idx": 13, "reason": "wrong_answer", "expected": "1\n1808", "got": "1\n54"}]
codeforces
B
753
480_B. Long Jumps
Valery is a PE teacher at a school in Berland. Soon the students are going to take a test in long jumps, and Valery has lost his favorite ruler! However, there is no reason for disappointment, as Valery has found another ruler, its length is l centimeters. The ruler already has n marks, with which he can make measure...
python3
#Adapted from code of hatsuyuki15 in this contest n, l, x, y = map(int, input().split()) a = set(map(int, input().split())) boy = False girl = False one = False where = -1 for i in a: if i + x in a: boy = True if i + y in a: girl = True if i - x > 0 and i - x + y in a: one = True ...
partial
23
25
[{"idx": 13, "reason": "wrong_answer", "expected": "1\n1808", "got": "1\n54"}, {"idx": 23, "reason": "wrong_answer", "expected": "1\n10", "got": "1\n11"}]
codeforces
B
759
73_F. Plane of Tanks
Vasya plays the Plane of Tanks. The tanks in this game keep trying to finish each other off. But your "Pedalny" is not like that... He just needs to drive in a straight line from point A to point B on the plane. Unfortunately, on the same plane are n enemy tanks. We shall regard all the tanks as points. At the initial ...
cpp
#include <bits/stdc++.h> using namespace std; const int MAXN = 10000; int n; double x1, y3223789, x2, y2; double x[MAXN], y[MAXN], w[MAXN], a0[MAXN]; double t1[MAXN], t2[MAXN], d[MAXN], p[MAXN]; double pi = 2 * acos(0.0); double cross(double x1, double y3223789, double x2, double y2) { return x1 * y2 - x2 * y3223789;...
partial
3
7
[{"idx": 0, "reason": "wrong_answer", "expected": "4.244116", "got": "4.2441"}, {"idx": 2, "reason": "wrong_answer", "expected": "14.142079", "got": "14.1421"}, {"idx": 3, "reason": "wrong_answer", "expected": "7.216642", "got": "7.2166"}, {"idx": 4, "reason": "wrong_answer", "expected": "7.071084", "got": "7.0711"}]
codeforces
F
759
73_F. Plane of Tanks
Vasya plays the Plane of Tanks. The tanks in this game keep trying to finish each other off. But your "Pedalny" is not like that... He just needs to drive in a straight line from point A to point B on the plane. Unfortunately, on the same plane are n enemy tanks. We shall regard all the tanks as points. At the initial ...
cpp
#include <bits/stdc++.h> using namespace std; double cal_ang(double x, double y) { double res = acos(abs(x / hypot(x, y))); if (x <= 0 && y >= 0) return acos(-1) - res; if (x <= 0 && y < 0) return acos(-1) + res; if (x > 0 && y < 0) return acos(-1) * 2.0 - res; return res; } int main() { double x0, x1, y0, ...
partial
3
7
[{"idx": 0, "reason": "wrong_answer", "expected": "4.244116", "got": "4.2441"}, {"idx": 2, "reason": "wrong_answer", "expected": "14.142079", "got": "14.1421"}, {"idx": 3, "reason": "wrong_answer", "expected": "7.216642", "got": "7.2166"}, {"idx": 4, "reason": "wrong_answer", "expected": "7.071084", "got": "7.0711"}]
codeforces
F
760
763_D. Timofey and a flat tree
Little Timofey has a big tree — an undirected connected graph with n vertices and no simple cycles. He likes to walk along it. His tree is flat so when he walks along it he sees it entirely. Quite naturally, when he stands on a vertex, he sees the tree as a rooted tree with the root in this vertex. Timofey assumes tha...
cpp
#include <bits/stdc++.h> using namespace std; const int MOD = (int)1e9 + 7; const int INF = (int)1e9; const long long LINF = (long long)1e18; const long double PI = acos((long double)-1); const long double EPS = 1e-9; inline long long gcd(long long a, long long b) { long long r; while (b) { r = a % b; a = b...
partial
4
16
[{"idx": 0, "reason": "wrong_answer", "expected": "2", "got": "8"}, {"idx": 1, "reason": "wrong_answer", "expected": "1", "got": "3"}, {"idx": 2, "reason": "wrong_answer", "expected": "1", "got": "5"}, {"idx": 5, "reason": "wrong_answer", "expected": "1", "got": "5"}, {"idx": 6, "reason": "wrong_answer", "expected": "1...
codeforces
D
760
763_D. Timofey and a flat tree
Little Timofey has a big tree — an undirected connected graph with n vertices and no simple cycles. He likes to walk along it. His tree is flat so when he walks along it he sees it entirely. Quite naturally, when he stands on a vertex, he sees the tree as a rooted tree with the root in this vertex. Timofey assumes tha...
cpp
#include <bits/stdc++.h> #pragma comment(linker, "/STACK:512000000") using namespace std; void solve(bool); void precalc(); clock_t start; int testNumber = 1; bool todo = true; int main() { start = clock(); int t = 1; cout.sync_with_stdio(0); cin.tie(0); precalc(); cout.precision(10); cout << fixed; int...
partial
12
16
[{"idx": 3, "reason": "wrong_answer", "expected": "9", "got": "2"}, {"idx": 9, "reason": "wrong_answer", "expected": "10", "got": "2"}, {"idx": 10, "reason": "wrong_answer", "expected": "18", "got": "3"}, {"idx": 12, "reason": "wrong_answer", "expected": "13", "got": "4"}]
codeforces
D
760
763_D. Timofey and a flat tree
Little Timofey has a big tree — an undirected connected graph with n vertices and no simple cycles. He likes to walk along it. His tree is flat so when he walks along it he sees it entirely. Quite naturally, when he stands on a vertex, he sees the tree as a rooted tree with the root in this vertex. Timofey assumes tha...
cpp
#include <bits/stdc++.h> using namespace std; const int N = 1e5 + 5; int n, head[N], cnt, base1, base2, base3, dfn[N], idx, idfn[N], sz[N], fa[N]; int d[N], a[N]; unsigned long long hx[N]; struct edge { int to, nxt; } e[N << 1]; struct data { unsigned long long val; int sz, l, r; inline bool operator<(const dat...
compile_error
0
0
COMPILE_ERROR:/tmp/sbx_n1zali33/tmp25xqb4k_.cpp:18:12: error: template argument 1 is invalid 18 | vector<data> vec; | ^ /tmp/sbx_n1zali33/tmp25xqb4k_.cpp:18:12: error: template argument 2 is invalid /tmp/sbx_n1zali33/tmp25xqb4k_.cpp: In function ‘void dfs(int)’: /tmp/sbx_n1zali33/tmp25xqb4k_.cpp:32:...
[]
codeforces
D
760
763_D. Timofey and a flat tree
Little Timofey has a big tree — an undirected connected graph with n vertices and no simple cycles. He likes to walk along it. His tree is flat so when he walks along it he sees it entirely. Quite naturally, when he stands on a vertex, he sees the tree as a rooted tree with the root in this vertex. Timofey assumes tha...
java
import java.io.OutputStream; import java.io.IOException; import java.io.InputStream; import java.util.Arrays; import java.util.Random; import java.util.ArrayList; import java.io.OutputStreamWriter; import java.io.OutputStream; import java.io.PrintStream; import java.io.IOException; import java.io.UncheckedIOException; ...
partial
13
16
[{"idx": 0, "reason": "wrong_answer", "expected": "2", "got": "7"}, {"idx": 12, "reason": "wrong_answer", "expected": "13", "got": "7"}, {"idx": 14, "reason": "wrong_answer", "expected": "3", "got": "16"}]
codeforces
D
760
763_D. Timofey and a flat tree
Little Timofey has a big tree — an undirected connected graph with n vertices and no simple cycles. He likes to walk along it. His tree is flat so when he walks along it he sees it entirely. Quite naturally, when he stands on a vertex, he sees the tree as a rooted tree with the root in this vertex. Timofey assumes tha...
java
//package round395; import java.io.ByteArrayInputStream; import java.io.IOException; import java.io.InputStream; import java.io.PrintWriter; import java.math.BigInteger; import java.util.Arrays; import java.util.HashMap; import java.util.InputMismatchException; import java.util.Map; import java.util.Random; public cla...
all_fail
0
16
[{"idx": 0, "reason": "runtime_error", "rc": 1, "stderr": "Exception in thread \"main\" java.lang.NegativeArraySizeException: -1\n\tat D2.solve(D2.java:26)\n\tat D2.run(D2.java:220)\n\tat D2.main(D2.java:225)\n", "stdout_tail": ""}, {"idx": 1, "reason": "runtime_error", "rc": 1, "stderr": "Exception in thread \"main\" ...
codeforces
D
760
763_D. Timofey and a flat tree
Little Timofey has a big tree — an undirected connected graph with n vertices and no simple cycles. He likes to walk along it. His tree is flat so when he walks along it he sees it entirely. Quite naturally, when he stands on a vertex, he sees the tree as a rooted tree with the root in this vertex. Timofey assumes tha...
java
import java.io.OutputStream; import java.io.IOException; import java.io.InputStream; import java.io.PrintWriter; import java.util.Random; import java.util.HashMap; import java.io.IOException; import java.io.InputStreamReader; import java.util.ArrayList; import java.util.List; import java.util.StringTokenizer; import ja...
partial
13
16
[{"idx": 0, "reason": "wrong_answer", "expected": "2", "got": "7"}, {"idx": 12, "reason": "wrong_answer", "expected": "13", "got": "7"}, {"idx": 14, "reason": "wrong_answer", "expected": "3", "got": "16"}]
codeforces
D
762
878_B. Teams Formation
This time the Berland Team Olympiad in Informatics is held in a remote city that can only be reached by one small bus. Bus has n passenger seats, seat i can be occupied only by a participant from the city ai. Today the bus has completed m trips, each time bringing n participants. The participants were then aligned in ...
cpp
#include <bits/stdc++.h> using namespace std; const int N = 1e5 + 50; int zhan[N], arr[N], top, cnt[N]; long long n, m, K; int main() { int i, j; top = 0; scanf("%I64d%I64d%I64d", &n, &K, &m); bool flag = 1; for (i = 1; i <= n; i++) { scanf("%d", &arr[i]); if (arr[i] != arr[1]) flag = 0; } if (fla...
partial
9
10
[{"idx": 3, "reason": "wrong_answer", "expected": "10000000000", "got": " 1410065408"}]
codeforces
B
763
901_D. Weighting a Tree
You are given a connected undirected graph with n vertices and m edges. The vertices are enumerated from 1 to n. You are given n integers c1, c2, ..., cn, each of them is between - n and n, inclusive. It is also guaranteed that the parity of cv equals the parity of degree of vertex v. The degree of a vertex is the n...
cpp
#include <bits/stdc++.h> using namespace std; const int N = 1e5 + 5; const int M = N * 25; int n, m; long long C[M], x, y, tar[N], dep[N], in[M]; int fir[N], ne[M], to[M], cnt = 1, fa[N], fan[N]; void add(int x, int y) { ne[++cnt] = fir[x]; fir[x] = cnt; to[cnt] = y; } void link(int x, int y) { add(x, y); add...
partial
8
12
[{"idx": 6, "reason": "wrong_answer", "expected": "YES\n -7\n 10\n -16\n ", "got": "YES\n-10\n13\n-19\n0\n16\n0\n4\n8\n0\n-9\n0\n3\n1"}, {...
codeforces
D
763
901_D. Weighting a Tree
You are given a connected undirected graph with n vertices and m edges. The vertices are enumerated from 1 to n. You are given n integers c1, c2, ..., cn, each of them is between - n and n, inclusive. It is also guaranteed that the parity of cv equals the parity of degree of vertex v. The degree of a vertex is the n...
cpp
#include <bits/stdc++.h> using namespace std; vector<vector<pair<long long, long long> > > g; vector<long long> ans; vector<long long> c; vector<bool> used; vector<long long> dp; vector<long long> col; vector<long long> p; long long val = 0; long long pos = 0; long long pos2 = 0; void doit(long long v) { used[v] = 1;...
partial
11
12
[{"idx": 10, "reason": "wrong_answer", "expected": "YES\n-4\n1\n1\n17\n-7\n-3\n6\n-3\n-3\n5\n0\n0", "got": "YES\n-4\n1\n1\n11\n-7\n3\n0\n-3\n-3\n5\n0\n6"}]
codeforces
D
763
901_D. Weighting a Tree
You are given a connected undirected graph with n vertices and m edges. The vertices are enumerated from 1 to n. You are given n integers c1, c2, ..., cn, each of them is between - n and n, inclusive. It is also guaranteed that the parity of cv equals the parity of degree of vertex v. The degree of a vertex is the n...
python3
def divisors(M): d=[] i=1 while M>=i**2: if M%i==0: d.append(i) if i**2!=M: d.append(M//i) i=i+1 return d def popcount(x): x = x - ((x >> 1) & 0x55555555) x = (x & 0x33333333) + ((x >> 2) & 0x33333333) x = (x + (x >> 4)) & 0x0f0f0f0f ...
partial
11
12
[{"idx": 10, "reason": "wrong_answer", "expected": "YES\n-4\n1\n1\n17\n-7\n-3\n6\n-3\n-3\n5\n0\n0", "got": "YES\n-4\n1\n1\n11\n-7\n3\n0\n-3\n-3\n5\n0\n6"}]
codeforces
D
763
901_D. Weighting a Tree
You are given a connected undirected graph with n vertices and m edges. The vertices are enumerated from 1 to n. You are given n integers c1, c2, ..., cn, each of them is between - n and n, inclusive. It is also guaranteed that the parity of cv equals the parity of degree of vertex v. The degree of a vertex is the n...
cpp
#include <bits/stdc++.h> #pragma comment(linker, "/STACK:1000000000") using namespace std; const int maxn = (int)1e5 + 10; int ver = -1; int num = -1; long long c[maxn]; vector<pair<int, int> > ed[maxn]; long long res[maxn]; int h[maxn]; vector<pair<int, int> > e[maxn]; void dfs(int v, int d) { h[v] = d; for (int i...
partial
11
12
[{"idx": 10, "reason": "wrong_answer", "expected": "YES\n-4\n1\n1\n17\n-7\n-3\n6\n-3\n-3\n5\n0\n0", "got": "YES\n-4\n1\n1\n11\n-7\n3\n0\n-3\n-3\n5\n0\n6"}]
codeforces
D
763
901_D. Weighting a Tree
You are given a connected undirected graph with n vertices and m edges. The vertices are enumerated from 1 to n. You are given n integers c1, c2, ..., cn, each of them is between - n and n, inclusive. It is also guaranteed that the parity of cv equals the parity of degree of vertex v. The degree of a vertex is the n...
java
import java.io.OutputStream; import java.io.IOException; import java.io.InputStream; import java.io.OutputStream; import java.io.PrintWriter; import java.util.List; import java.util.stream.Stream; import java.io.BufferedWriter; import java.io.Writer; import java.io.OutputStreamWriter; import java.util.InputMismatchExce...
partial
9
12
[{"idx": 9, "reason": "wrong_answer", "expected": "YES\n 2\n 1\n -1\n ", "got": "YES\n1\n1\n0\n-2\n0\n1\n5"}, {"idx": 10, "reason": "wr...
codeforces
D
763
901_D. Weighting a Tree
You are given a connected undirected graph with n vertices and m edges. The vertices are enumerated from 1 to n. You are given n integers c1, c2, ..., cn, each of them is between - n and n, inclusive. It is also guaranteed that the parity of cv equals the parity of degree of vertex v. The degree of a vertex is the n...
java
//package round453; import java.io.ByteArrayInputStream; import java.io.IOException; import java.io.InputStream; import java.io.PrintWriter; import java.util.ArrayDeque; import java.util.Arrays; import java.util.HashSet; import java.util.InputMismatchException; import java.util.Queue; import java.util.Set; public clas...
all_fail
0
12
[{"idx": 0, "reason": "runtime_error", "rc": 1, "stderr": "Exception in thread \"main\" java.util.InputMismatchException\n\tat D.readByte(D.java:242)\n\tat D.ni(D.java:297)\n\tat D.solve(D.java:20)\n\tat D.run(D.java:230)\n\tat D.main(D.java:235)\n", "stdout_tail": ""}, {"idx": 1, "reason": "runtime_error", "rc": 1, "s...
codeforces
D
763
901_D. Weighting a Tree
You are given a connected undirected graph with n vertices and m edges. The vertices are enumerated from 1 to n. You are given n integers c1, c2, ..., cn, each of them is between - n and n, inclusive. It is also guaranteed that the parity of cv equals the parity of degree of vertex v. The degree of a vertex is the n...
java
import java.io.*; import java.util.*; public class D { int[] head; int[] next; int[] to; int[] cs; int[] parEdge; int[] col; long[] ans; int v1 = -1, v2 = -1; int eOdd = -1; long val0; void dfs(int v, int p) { long sumLeft = cs[v]; parEdge[v] = p; for (int e = head[v]; e >= 0; e = next[e]) { ...
partial
8
12
[{"idx": 6, "reason": "wrong_answer", "expected": "YES\n -7\n 10\n -16\n ", "got": "YES\n-10\n13\n-19\n0\n16\n0\n4\n8\n0\n-9\n0\n3\n1"}, {...
codeforces
D
776
p02797 Keyence Programming Contest 2020 - Subarray Sum
Given are three integers N, K, and S. Find a sequence A_1, A_2, ..., A_N of N integers between 1 and 10^9 (inclusive) that satisfies the condition below. We can prove that, under the conditions in Constraints, such a sequence always exists. * There are exactly K pairs (l, r) of integers such that 1 \leq l \leq r \leq...
python3
n, k, s = map(int, input().split()) if s == 10**9: ans = [10**9]*k+[1]*(n-k) else: ans = [s]*k+[s+1]*(n-k) print(*ans)
all_fail
0
2
[{"idx": 0, "reason": "wrong_answer", "expected": "50 50 50 30 70", "got": "100 100 100 101 101"}, {"idx": 1, "reason": "wrong_answer", "expected": "1 2 3 4", "got": "3 3 4 4"}]
atcoder
UNKNOWN
776
p02797 Keyence Programming Contest 2020 - Subarray Sum
Given are three integers N, K, and S. Find a sequence A_1, A_2, ..., A_N of N integers between 1 and 10^9 (inclusive) that satisfies the condition below. We can prove that, under the conditions in Constraints, such a sequence always exists. * There are exactly K pairs (l, r) of integers such that 1 \leq l \leq r \leq...
cpp
#include<bits/stdc++.h> using namespace std; int main(){ int n,k,s; cin >> n >> k >> s; for(int i=0;i<k;i++) cout << s << ' '; if(s!=1) s--; else s++; for(int i=k;i<n;i++) cout << s <<' '; }
all_fail
0
2
[{"idx": 0, "reason": "wrong_answer", "expected": "50 50 50 30 70", "got": "100 100 100 99 99"}, {"idx": 1, "reason": "wrong_answer", "expected": "1 2 3 4", "got": "3 3 2 2"}]
atcoder
UNKNOWN
776
p02797 Keyence Programming Contest 2020 - Subarray Sum
Given are three integers N, K, and S. Find a sequence A_1, A_2, ..., A_N of N integers between 1 and 10^9 (inclusive) that satisfies the condition below. We can prove that, under the conditions in Constraints, such a sequence always exists. * There are exactly K pairs (l, r) of integers such that 1 \leq l \leq r \leq...
cpp
#include <bits/stdc++.h> #define pb push_back #define ll long long using namespace std; int main() { ll n,k,s; cin>>n>>k>>s; for(ll i=1;i<=k;i++) cout<<s<<" "; for(ll i=k+1;i<=n;i++){ if(s==1e9) cout<<1<<" "; else cout<<s+1<<" "; } }
all_fail
0
2
[{"idx": 0, "reason": "wrong_answer", "expected": "50 50 50 30 70", "got": "100 100 100 101 101"}, {"idx": 1, "reason": "wrong_answer", "expected": "1 2 3 4", "got": "3 3 4 4"}]
atcoder
UNKNOWN
776
p02797 Keyence Programming Contest 2020 - Subarray Sum
Given are three integers N, K, and S. Find a sequence A_1, A_2, ..., A_N of N integers between 1 and 10^9 (inclusive) that satisfies the condition below. We can prove that, under the conditions in Constraints, such a sequence always exists. * There are exactly K pairs (l, r) of integers such that 1 \leq l \leq r \leq...
cpp
#include <bits/stdc++.h> using namespace std; int main() { int n, k, s; cin >> n >> k >> s; int inf = pow(10, 9); for(int i = 0; i < n; i++){ if(i < k) cout << s << " "; else{ if(s < inf) cout << inf << " "; else cout << 1 << " "; } } cout << endl; }
all_fail
0
2
[{"idx": 0, "reason": "wrong_answer", "expected": "50 50 50 30 70", "got": "100 100 100 1000000000 1000000000"}, {"idx": 1, "reason": "wrong_answer", "expected": "1 2 3 4", "got": "3 3 1000000000 1000000000"}]
atcoder
UNKNOWN
776
p02797 Keyence Programming Contest 2020 - Subarray Sum
Given are three integers N, K, and S. Find a sequence A_1, A_2, ..., A_N of N integers between 1 and 10^9 (inclusive) that satisfies the condition below. We can prove that, under the conditions in Constraints, such a sequence always exists. * There are exactly K pairs (l, r) of integers such that 1 \leq l \leq r \leq...
java
import java.io.IOException; import java.io.InputStream; import java.io.PrintWriter; import java.util.ArrayList; import java.util.Arrays; import java.util.Collections; import java.util.HashMap; import java.util.List; import java.util.Map; import java.util.NoSuchElementException; import java.util.function.BiFunction; imp...
all_fail
0
2
[{"idx": 0, "reason": "wrong_answer", "expected": "50 50 50 30 70", "got": "100 100 100 99 99"}, {"idx": 1, "reason": "wrong_answer", "expected": "1 2 3 4", "got": "3 3 2 2"}]
atcoder
UNKNOWN
776
p02797 Keyence Programming Contest 2020 - Subarray Sum
Given are three integers N, K, and S. Find a sequence A_1, A_2, ..., A_N of N integers between 1 and 10^9 (inclusive) that satisfies the condition below. We can prove that, under the conditions in Constraints, such a sequence always exists. * There are exactly K pairs (l, r) of integers such that 1 \leq l \leq r \leq...
python3
n,k,s = map(int,input().split()) o = [s + 1] * n if(s == 10**9):o = [1] * n for i in range(k):o[i] = s print(*o)
all_fail
0
2
[{"idx": 0, "reason": "wrong_answer", "expected": "50 50 50 30 70", "got": "100 100 100 101 101"}, {"idx": 1, "reason": "wrong_answer", "expected": "1 2 3 4", "got": "3 3 4 4"}]
atcoder
UNKNOWN