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
192
25_D. Roads not only in Berland
Berland Government decided to improve relations with neighboring countries. First of all, it was decided to build new roads so that from each city of Berland and neighboring countries it became possible to reach all the others. There are n cities in Berland and neighboring countries in total and exactly n - 1 two-way r...
python2
n = 0 pre = [] edge = [] def find(x): if pre[x] == -1: return x pre[x] = find(pre[x]) return pre[x] def union(a, b): rt_a = find(a) rt_b = find(b) if rt_a != rt_b: pre[rt_b] = rt_a else: edge.append((a, b)) n = input() pre = [-1 for i in range(n+1)] rt = [] for i in range(n...
partial
6
11
[{"idx": 2, "reason": "wrong_answer", "expected": "1\n3 4 1 2", "got": "1\n3 4 2 3"}, {"idx": 4, "reason": "wrong_answer", "expected": "3\n13 2 1 7 3 17 1 19 13 8 1 21", "got": "3\n13 2 6 7\n3 17 7 19\n13 8 19 21"}, {"idx": 7, "reason": "wrong_answer", "expected": "2\n48 44 1 6 6 26 1 12", "got": "2\n48 44 12 26\n6 26 ...
codeforces
D
194
306_C. White, Black and White Again
Polycarpus is sure that his life fits the description: "first there is a white stripe, then a black one, then a white one again". So, Polycarpus is sure that this rule is going to fulfill during the next n days. Polycarpus knows that he is in for w good events and b not-so-good events. At least one event is going to ta...
java
//package test6; 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 C { InputStream is; PrintWriter out; String INPUT = ""; int mod = 1000000009; int[][] fif = enumF...
all_fail
0
25
[{"idx": 0, "reason": "runtime_error", "rc": 1, "stderr": "Exception in thread \"main\" java.util.InputMismatchException\n\tat C.readByte(C.java:69)\n\tat C.ni(C.java:124)\n\tat C.solve(C.java:18)\n\tat C.run(C.java:57)\n\tat C.main(C.java:62)\n", "stdout_tail": ""}, {"idx": 1, "reason": "runtime_error", "rc": 1, "stde...
codeforces
C
195
331_D2. Escaping on Beaveractor
Don't put up with what you're sick of! The Smart Beaver decided to escape from the campus of Beaver Science Academy (BSA). BSA is a b × b square on a plane. Each point x, y (0 ≤ x, y ≤ b) belongs to BSA. To make the path quick and funny, the Beaver constructed a Beaveractor, an effective and comfortable types of transp...
cpp
#include <bits/stdc++.h> #pragma comment(linker, "/STACK:1000000000") using namespace std; const double pi = acos(-1.0); const int size = 1010; const int px[] = {1, 0, -1, 0}; const int py[] = {0, 1, 0, -1}; const int mdeg = 12; const int onelvl = 20; int ways[size][size]; int n, b; int ans[mdeg][size * size * 4]; inli...
compile_error
0
0
COMPILE_ERROR:/tmp/sbx_clrvq66l/tmpbrx6_m3x.cpp:10:10: error: reference to ‘size’ is ambiguous 10 | int ways[size][size]; | ^~~~ In file included from /usr/include/c++/11/string:54, from /usr/include/c++/11/bits/locale_classes.h:40, from /usr/include/c++/11/bits/ios_b...
[]
codeforces
D
197
378_C. Maze
Pavel loves grid mazes. A grid maze is an n × m rectangle maze where each cell is either empty, or is a wall. You can go from one cell to another only if both cells are empty and have a common side. Pavel drew a grid maze with all empty cells forming a connected area. That is, you can go from any empty cell to any oth...
cpp
#include <bits/stdc++.h> using namespace std; using ll = long long; using vi = vector<int>; using vl = vector<ll>; const int INF = 0x3f3f3f3f; template <class K, class V> ostream& operator<<(ostream& out, const pair<K, V>& v) { out << '(' << v.first << ',' << v.second << ')'; return out; } template <class C, class ...
partial
6
25
[{"idx": 1, "reason": "wrong_answer", "expected": "#...\n#.#.\nX#..\nXX.#\nX#X#", "got": "#...\n#X#.\nX#..\nX..#\nX#X#"}, {"idx": 2, "reason": "wrong_answer", "expected": "###..XXX##X#XX#XX##X\n####.XXXXXXXXXXX##XX\n###..XX#XX#X#XXXX#X#\n##....###XXXXXX#XXX#\n.####...#XXXXX#X##XX\n.###......#XXX#X#X#X\n...##X#...#XX#XX...
codeforces
C
197
378_C. Maze
Pavel loves grid mazes. A grid maze is an n × m rectangle maze where each cell is either empty, or is a wall. You can go from one cell to another only if both cells are empty and have a common side. Pavel drew a grid maze with all empty cells forming a connected area. That is, you can go from any empty cell to any oth...
java
import java.util.*; public class maze2 { static int goal; public static void main(String[] args) { Scanner scan = new Scanner(System.in); String[] first = scan.nextLine().split(" "); int height = Integer.parseInt(first[0]); int width = Integer.parseInt(first[1]); int k...
partial
1
25
[{"idx": 0, "reason": "wrong_answer", "expected": "#..#\n..#X\n#..X", "got": "#.X#\n..#X\n#..."}, {"idx": 1, "reason": "wrong_answer", "expected": "#...\n#.#.\nX#..\nXX.#\nX#X#", "got": "#XXX\n#X#X\n.#..\n...#\n.#.#"}, {"idx": 2, "reason": "wrong_answer", "expected": "###..XXX##X#XX#XX##X\n####.XXXXXXXXXXX##XX\n###..XX...
codeforces
C
197
378_C. Maze
Pavel loves grid mazes. A grid maze is an n × m rectangle maze where each cell is either empty, or is a wall. You can go from one cell to another only if both cells are empty and have a common side. Pavel drew a grid maze with all empty cells forming a connected area. That is, you can go from any empty cell to any oth...
java
//package Round_222; import java.io.BufferedReader; import java.io.File; import java.io.FileNotFoundException; import java.io.FileReader; import java.io.IOException; import java.io.InputStream; import java.io.InputStreamReader; import java.io.PrintWriter; import java.util.StringTokenizer; public class C { ...
partial
5
25
[{"idx": 0, "reason": "wrong_answer", "expected": "#..#\n..#X\n#..X", "got": "#.X#\nX.#.\n#..."}, {"idx": 1, "reason": "wrong_answer", "expected": "#...\n#.#.\nX#..\nXX.#\nX#X#", "got": "#...\n#X#.\nX#..\nXX.#\nX#.#"}, {"idx": 2, "reason": "wrong_answer", "expected": "###..XXX##X#XX#XX##X\n####.XXXXXXXXXXX##XX\n###..XX...
codeforces
C
197
378_C. Maze
Pavel loves grid mazes. A grid maze is an n × m rectangle maze where each cell is either empty, or is a wall. You can go from one cell to another only if both cells are empty and have a common side. Pavel drew a grid maze with all empty cells forming a connected area. That is, you can go from any empty cell to any oth...
java
import java.io.BufferedReader; import java.io.FileNotFoundException; import java.io.FileReader; import java.io.IOException; import java.io.InputStream; import java.io.InputStreamReader; import java.util.StringTokenizer; public class Main { static int n ,m,k; static char[][] a; static boolean[][] vis; static int[]...
partial
8
25
[{"idx": 0, "reason": "wrong_answer", "expected": "#..#\n..#X\n#..X", "got": "#.X#\n..#X\n#..."}, {"idx": 2, "reason": "wrong_answer", "expected": "###..XXX##X#XX#XX##X\n####.XXXXXXXXXXX##XX\n###..XX#XX#X#XXXX#X#\n##....###XXXXXX#XXX#\n.####...#XXXXX#X##XX\n.###......#XXX#X#X#X\n...##X#...#XX#XX#XXX\n.....#X...X#XX#XXX...
codeforces
C
197
378_C. Maze
Pavel loves grid mazes. A grid maze is an n × m rectangle maze where each cell is either empty, or is a wall. You can go from one cell to another only if both cells are empty and have a common side. Pavel drew a grid maze with all empty cells forming a connected area. That is, you can go from any empty cell to any oth...
cpp
#include <bits/stdc++.h> using namespace std; int ct1, n, m, k, ct; vector<string> a; bool visited[501][501]; void dfs(int i, int j) { if (i < 0 || j < 0 || i >= n || j >= m || ct1 == ct || a[i][j] == '#' || visited[i][j]) return; visited[i][j] = true; ct1++; dfs(i - 1, j); dfs(i + 1, j); dfs(i, j...
partial
4
25
[{"idx": 0, "reason": "wrong_answer", "expected": "#..#\n..#X\n#..X", "got": "#.X#\nX.#.\n#..."}, {"idx": 1, "reason": "wrong_answer", "expected": "#...\n#.#.\nX#..\nXX.#\nX#X#", "got": "#...\n#X#.\nX#..\nXX.#\nX#.#"}, {"idx": 2, "reason": "wrong_answer", "expected": "###..XXX##X#XX#XX##X\n####.XXXXXXXXXXX##XX\n###..XX...
codeforces
C
197
378_C. Maze
Pavel loves grid mazes. A grid maze is an n × m rectangle maze where each cell is either empty, or is a wall. You can go from one cell to another only if both cells are empty and have a common side. Pavel drew a grid maze with all empty cells forming a connected area. That is, you can go from any empty cell to any oth...
cpp
#include <bits/stdc++.h> char a[1003][1000], a2[1003][1000]; int h[1002][1000], n, m, k, s, i, j; void f(int i, int j) { a2[i][j] = '#'; { if (i + 1 >= 0 && j >= 0 && i + 1 < n && j < m && a2[i + 1][j] != '#' && a2[i + 1][j] != 'X') f(i + 1, j); }; { if (i >= 0 && j + 1 >= 0 && i < n && j ...
partial
9
25
[{"idx": 1, "reason": "wrong_answer", "expected": "#...\n#.#.\nX#..\nXX.#\nX#X#", "got": "#...\n#X#.\nX#..\nX..#\nX#X#"}, {"idx": 2, "reason": "wrong_answer", "expected": "###..XXX##X#XX#XX##X\n####.XXXXXXXXXXX##XX\n###..XX#XX#X#XXXX#X#\n##....###XXXXXX#XXX#\n.####...#XXXXX#X##XX\n.###......#XXX#X#X#X\n...##X#...#XX#XX...
codeforces
C
197
378_C. Maze
Pavel loves grid mazes. A grid maze is an n × m rectangle maze where each cell is either empty, or is a wall. You can go from one cell to another only if both cells are empty and have a common side. Pavel drew a grid maze with all empty cells forming a connected area. That is, you can go from any empty cell to any oth...
python3
import random, math, sys from copy import deepcopy as dc from bisect import bisect_left, bisect_right from collections import Counter input = sys.stdin.readline # Function to take input def input_test(): n, m, k = map(int, input().strip().split(" ")) grid = [] for i in range(n): grid.append(list(input()....
partial
6
25
[{"idx": 0, "reason": "wrong_answer", "expected": "#..#\n..#X\n#..X", "got": "#XX#\n..#.\n#..."}, {"idx": 1, "reason": "wrong_answer", "expected": "#...\n#.#.\nX#..\nXX.#\nX#X#", "got": "#X..\n#X#.\nX#..\nX..#\nX#.#"}, {"idx": 2, "reason": "wrong_answer", "expected": "###..XXX##X#XX#XX##X\n####.XXXXXXXXXXX##XX\n###..XX...
codeforces
C
197
378_C. Maze
Pavel loves grid mazes. A grid maze is an n × m rectangle maze where each cell is either empty, or is a wall. You can go from one cell to another only if both cells are empty and have a common side. Pavel drew a grid maze with all empty cells forming a connected area. That is, you can go from any empty cell to any oth...
python3
from sys import stdin def main(): n, m, points = map(int, stdin.readline().split()) mat = [] for _ in range(n): mat.append(list(stdin.readline())) check = [[False for _ in range(m)] for _ in range(n)] q = [] end = {} time = 0 for i in range(n): for j in range(m): ...
partial
12
25
[{"idx": 0, "reason": "wrong_answer", "expected": "#..#\n..#X\n#..X", "got": "#.X#\nX.#.\n#..."}, {"idx": 2, "reason": "wrong_answer", "expected": "###..XXX##X#XX#XX##X\n####.XXXXXXXXXXX##XX\n###..XX#XX#X#XXXX#X#\n##....###XXXXXX#XXX#\n.####...#XXXXX#X##XX\n.###......#XXX#X#X#X\n...##X#...#XX#XX#XXX\n.....#X...X#XX#XXX...
codeforces
C
197
378_C. Maze
Pavel loves grid mazes. A grid maze is an n × m rectangle maze where each cell is either empty, or is a wall. You can go from one cell to another only if both cells are empty and have a common side. Pavel drew a grid maze with all empty cells forming a connected area. That is, you can go from any empty cell to any oth...
python2
#!/usr/bin/env python def read(): r, c, k = map(int, raw_input().split()) ret = [] for i in range(r): ret.append(list(raw_input())) return ret, k def work((b, k)): Q = [] cntEmpty = sum([b[i].count('.') for i in range(len(b))]) toVisit = cntEmpty - k for i in range(len(...
partial
13
25
[{"idx": 2, "reason": "wrong_answer", "expected": "###..XXX##X#XX#XX##X\n####.XXXXXXXXXXX##XX\n###..XX#XX#X#XXXX#X#\n##....###XXXXXX#XXX#\n.####...#XXXXX#X##XX\n.###......#XXX#X#X#X\n...##X#...#XX#XX#XXX\n.....#X...X#XX#XXXX#\n.#....X##.X#XXXXXXXX\n.##...X#X.X", "got": "###.....##.#..#..##X\n####............##XX\n###.....
codeforces
C
197
378_C. Maze
Pavel loves grid mazes. A grid maze is an n × m rectangle maze where each cell is either empty, or is a wall. You can go from one cell to another only if both cells are empty and have a common side. Pavel drew a grid maze with all empty cells forming a connected area. That is, you can go from any empty cell to any oth...
python3
import math,string,itertools,fractions,heapq,collections,re,array,bisect,sys,random,time,copy,functools sys.setrecursionlimit(10**7) inf = 10**20 eps = 1.0 / 10**10 mod = 10**9+7 dd = [(-1,0),(0,1),(1,0),(0,-1)] ddn = [(-1,0),(-1,1),(0,1),(1,1),(1,0),(1,-1),(0,-1),(-1,-1)] def LI(): return [int(x) for x in sys.stdin....
partial
17
25
[{"idx": 2, "reason": "wrong_answer", "expected": "###..XXX##X#XX#XX##X\n####.XXXXXXXXXXX##XX\n###..XX#XX#X#XXXX#X#\n##....###XXXXXX#XXX#\n.####...#XXXXX#X##XX\n.###......#XXX#X#X#X\n...##X#...#XX#XX#XXX\n.....#X...X#XX#XXXX#\n.#....X##.X#XXXXXXXX\n.##...X#X.X", "got": "###.....##.#..#..##X\n####............##XX\n###.....
codeforces
C
197
378_C. Maze
Pavel loves grid mazes. A grid maze is an n × m rectangle maze where each cell is either empty, or is a wall. You can go from one cell to another only if both cells are empty and have a common side. Pavel drew a grid maze with all empty cells forming a connected area. That is, you can go from any empty cell to any oth...
python2
def read(): r, c, k = map(int, raw_input().split()) ret = [] for i in range(r): ret.append(list(raw_input())) return ret, k def work((b, k)): Q = [] cntEmpty = sum([b[i].count('.') for i in range(len(b))]) toVisit = cntEmpty - k for i in range(len(b)): for j in ra...
partial
13
25
[{"idx": 2, "reason": "wrong_answer", "expected": "###..XXX##X#XX#XX##X\n####.XXXXXXXXXXX##XX\n###..XX#XX#X#XXXX#X#\n##....###XXXXXX#XXX#\n.####...#XXXXX#X##XX\n.###......#XXX#X#X#X\n...##X#...#XX#XX#XXX\n.....#X...X#XX#XXXX#\n.#....X##.X#XXXXXXXX\n.##...X#X.X", "got": "###.....##.#..#..##X\n####............##XX\n###.....
codeforces
C
197
378_C. Maze
Pavel loves grid mazes. A grid maze is an n × m rectangle maze where each cell is either empty, or is a wall. You can go from one cell to another only if both cells are empty and have a common side. Pavel drew a grid maze with all empty cells forming a connected area. That is, you can go from any empty cell to any oth...
python2
from collections import deque splitted = [int(amit) for amit in raw_input().split(" ")] n = splitted[0] m = splitted[1] k = splitted[2] cut = 0 arr = list() freq = list() for i in range(n): cur = list(raw_input()) arr.append(cur) freq.append([0] * m) adjDict = dict() oneIn = set() freeCell = None frees = 0 for i...
partial
4
25
[{"idx": 0, "reason": "wrong_answer", "expected": "#..#\n..#X\n#..X", "got": "#.X#\nX.#.\n#..."}, {"idx": 1, "reason": "wrong_answer", "expected": "#...\n#.#.\nX#..\nXX.#\nX#X#", "got": "#XXX\n#X#X\n.#..\n...#\n.#.#"}, {"idx": 2, "reason": "wrong_answer", "expected": "###..XXX##X#XX#XX##X\n####.XXXXXXXXXXX##XX\n###..XX...
codeforces
C
199
449_D. Jzzhu and Numbers
Jzzhu have n non-negative integers a1, a2, ..., an. We will call a sequence of indexes i1, i2, ..., ik (1 ≤ i1 < i2 < ... < ik ≤ n) a group of size k. Jzzhu wonders, how many groups exists such that ai1 & ai2 & ... & aik = 0 (1 ≤ k ≤ n)? Help him and print this number modulo 1000000007 (109 + 7). Operation x & y deno...
python3
import sys input = lambda : sys.stdin.readline().rstrip() sys.setrecursionlimit(2*10**5+10) write = lambda x: sys.stdout.write(x+"\n") debug = lambda x: sys.stderr.write(x+"\n") writef = lambda x: print("{:.12f}".format(x)) # zeta mebius def zeta_super(val, n): # len(val)==2^n out = val[:] for i in rang...
partial
18
19
[{"idx": 5, "reason": "timeout"}]
codeforces
D
201
518_E. Arthur and Questions
After bracket sequences Arthur took up number theory. He has got a new favorite sequence of length n (a1, a2, ..., an), consisting of integers and integer k, not exceeding n. This sequence had the following property: if you write out the sums of all its segments consisting of k consecutive elements (a1 + a2 ... + ak, ...
java
import java.io.*; import java.util.*; public class CF { FastScanner in; PrintWriter out; final String resS = "Incorrect sequence"; void solve() { int n = in.nextInt(); int k = in.nextInt(); int[] a = new int[n]; for (int i = 0; i < n; i++) { String tmp = in.next(); if (tmp.equals("?")) { a[i] =...
partial
21
25
[{"idx": 3, "reason": "wrong_answer", "expected": "-10 0 -1 1 0 2 10", "got": "-10 0 0 1 1 2 10"}, {"idx": 13, "reason": "wrong_answer", "expected": "-10 0 -2 1 -1 2 0 3 1", "got": "-10 0 -1 1 0 2 1 3 2"}, {"idx": 15, "reason": "wrong_answer", "expected": "-11 -2 -10 -1 0 0 10 1 11", "got": "-11 -1 -10 0 0 1 10 2 11"},...
codeforces
E
201
518_E. Arthur and Questions
After bracket sequences Arthur took up number theory. He has got a new favorite sequence of length n (a1, a2, ..., an), consisting of integers and integer k, not exceeding n. This sequence had the following property: if you write out the sums of all its segments consisting of k consecutive elements (a1 + a2 ... + ak, ...
cpp
#include <bits/stdc++.h> using namespace std; void dbg_out() { cerr << "\b\b]\n"; } template <typename Head, typename... Tail> void dbg_out(Head H, Tail... T) { cerr << H << ", "; dbg_out(T...); } vector<string> split(string s, char delim) { vector<string> v; stringstream ss(s); while (ss.good()) { string...
partial
21
25
[{"idx": 3, "reason": "wrong_answer", "expected": "-10 0 -1 1 0 2 10", "got": "-10 0 0 1 1 2 10"}, {"idx": 13, "reason": "wrong_answer", "expected": "-10 0 -2 1 -1 2 0 3 1", "got": "-10 0 -1 1 0 2 1 3 2"}, {"idx": 15, "reason": "wrong_answer", "expected": "-11 -2 -10 -1 0 0 10 1 11", "got": "-11 -1 -10 0 0 1 10 2 11"},...
codeforces
E
201
518_E. Arthur and Questions
After bracket sequences Arthur took up number theory. He has got a new favorite sequence of length n (a1, a2, ..., an), consisting of integers and integer k, not exceeding n. This sequence had the following property: if you write out the sums of all its segments consisting of k consecutive elements (a1 + a2 ... + ak, ...
python3
import sys n, k = map(int, input().split()) a = input().split() INF = 10 ** 9 + 7 OK = True for i in range(n): if a[i] == "?": a[i] = INF else: a[i] = int(a[i]) for i in range(len(a)): if a[i] == INF: j = i + k while j < len(a) and a[j] == INF: j += k c...
partial
23
25
[{"idx": 3, "reason": "wrong_answer", "expected": "-10 0 -1 1 0 2 10", "got": "-10 0 0 1 1 2 10"}, {"idx": 15, "reason": "wrong_answer", "expected": "-11 -2 -10 -1 0 0 10 1 11", "got": "-11 -1 -10 0 0 1 10 2 11"}]
codeforces
E
201
518_E. Arthur and Questions
After bracket sequences Arthur took up number theory. He has got a new favorite sequence of length n (a1, a2, ..., an), consisting of integers and integer k, not exceeding n. This sequence had the following property: if you write out the sums of all its segments consisting of k consecutive elements (a1 + a2 ... + ak, ...
python2
import sys INF = 0x7fffffff def ReadIn(): n, k = [int(x) for x in raw_input().split()] a = raw_input().split() return a, k def Solve(a, k): #print a for s in xrange(k): b = [str(-INF)] + a[s : : k] + [str(+INF)] l = 0 r = 1 #print 'b = %s' % b while r < len...
partial
21
25
[{"idx": 3, "reason": "wrong_answer", "expected": "-10 0 -1 1 0 2 10", "got": "-10 0 0 1 1 2 10"}, {"idx": 13, "reason": "wrong_answer", "expected": "-10 0 -2 1 -1 2 0 3 1", "got": "-10 0 -1 1 0 2 1 3 2"}, {"idx": 15, "reason": "wrong_answer", "expected": "-11 -2 -10 -1 0 0 10 1 11", "got": "-11 -1 -10 0 0 1 10 2 11"},...
codeforces
E
201
518_E. Arthur and Questions
After bracket sequences Arthur took up number theory. He has got a new favorite sequence of length n (a1, a2, ..., an), consisting of integers and integer k, not exceeding n. This sequence had the following property: if you write out the sums of all its segments consisting of k consecutive elements (a1 + a2 ... + ak, ...
python2
n,k=map(int,raw_input().split()) lis=raw_input().split() flag=False for ii in range(k): if flag: break pro=[] for j in range(ii,n,k): if lis[j]=='?': pro.append('?') else: pro.append(int(lis[j])) l=len(pro) can=[] for i in range(l): if pro[...
partial
23
25
[{"idx": 13, "reason": "wrong_answer", "expected": "-10 0 -2 1 -1 2 0 3 1", "got": "-10 0 -1 1 0 2 1 3 2"}, {"idx": 20, "reason": "wrong_answer", "expected": "-11 -1 -10 0 -1 1 0", "got": "-11 -1 -10 0 0 1 1"}]
codeforces
E
202
544_E. Remembering Strings
You have multiset of n strings of the same length, consisting of lowercase English letters. We will say that those strings are easy to remember if for each string there is some position i and some letter c of the English alphabet, such that this string is the only string in the multiset that has letter c in position i....
python3
from sys import stdin n,m=map(int,stdin.readline().strip().split()) s=[] for i in range(n): s.append(list(map(ord,list(stdin.readline().strip())))) for j in range(m): s[-1][j]=s[-1][j]-97 ct=[tuple(map(int,stdin.readline().strip().split())) for i in range(n)] mc=[[0 for i in range(22)] for j in range(22...
partial
18
21
[{"idx": 5, "reason": "timeout"}, {"idx": 6, "reason": "timeout"}, {"idx": 9, "reason": "timeout"}]
codeforces
E
204
662_C. Binary Table
You are given a table consisting of n rows and m columns. Each cell of the table contains either 0 or 1. In one move, you are allowed to pick any row or any column and invert all values, that is, replace 0 by 1 and vice versa. What is the minimum number of cells with value 1 you can get after applying some number of o...
java
//package prac; 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 E663 { InputStream is; PrintWriter out; String INPUT = ""; void solve() { int n = ni(), m = ni...
all_fail
0
17
[{"idx": 0, "reason": "runtime_error", "rc": 1, "stderr": "Exception in thread \"main\" java.util.InputMismatchException\n\tat E663.readByte(E663.java:77)\n\tat E663.ni(E663.java:132)\n\tat E663.solve(E663.java:16)\n\tat E663.run(E663.java:65)\n\tat E663.main(E663.java:7", "stdout_tail": ""}, {"idx": 1, "reason": "runt...
codeforces
C
207
774_K. Stepan and Vowels
Stepan likes to repeat vowel letters when he writes words. For example, instead of the word "pobeda" he can write "pobeeeedaaaaa". Sergey does not like such behavior, so he wants to write a program to format the words written by Stepan. This program must combine all consecutive equal vowels to a single vowel. The vowe...
cpp
#include <bits/stdc++.h> int main(void) { int Count, Number; char E[5]; scanf("%d", &Number); gets(E); char String[Number + 1]; gets(String); for (Count = 0; Count < Number; Count++) { if (String[Count] != 'a' && String[Count] != 'e' && String[Count] != 'i' && String[Count] != 'o' && String[Co...
compile_error
0
0
COMPILE_ERROR:/tmp/sbx_qlklfwyp/tmpyfj6sgmh.cpp: In function ‘int main()’: /tmp/sbx_qlklfwyp/tmpyfj6sgmh.cpp:6:3: error: ‘gets’ was not declared in this scope; did you mean ‘getw’? 6 | gets(E); | ^~~~ | getw /tmp/sbx_qlklfwyp/tmpyfj6sgmh.cpp:5:8: warning: ignoring return value of ‘int scanf(const ...
[]
codeforces
K
211
893_A. Chess For Three
Alex, Bob and Carl will soon participate in a team chess tournament. Since they are all in the same team, they have decided to practise really hard before the tournament. But it's a bit difficult for them because chess is a game for two players, not three. So they play with each other according to following rules: ...
java
import java.util.Scanner; public class ArrayList { public static void main(String[] args) { Scanner sc=new Scanner(System.in); int n=sc.nextInt(); int w=3; for (int i=0;i<n;i++){ int a=sc.nextInt(); if (w==a){ Syst...
all_fail
0
25
[{"idx": 0, "reason": "wrong_answer", "expected": "NO", "got": "No"}, {"idx": 1, "reason": "wrong_answer", "expected": "YES", "got": "Yes"}, {"idx": 2, "reason": "wrong_answer", "expected": "YES", "got": "Yes"}, {"idx": 3, "reason": "wrong_answer", "expected": "NO", "got": "No"}, {"idx": 4, "reason": "wrong_answer", "e...
codeforces
A
227
p02876 AtCoder Grand Contest 040 - Balance Beam
We have N balance beams numbered 1 to N. The length of each beam is 1 meters. Snuke walks on Beam i at a speed of 1/A_i meters per second, and Ringo walks on Beam i at a speed of 1/B_i meters per second. Snuke and Ringo will play the following game: * First, Snuke connects the N beams in any order of his choice and m...
python3
import sys read = sys.stdin.buffer.read readline = sys.stdin.buffer.readline readlines = sys.stdin.buffer.readlines from heapq import heappush, heappushpop, heapify from fractions import gcd N = int(readline()) m = map(int,read().split()) AB = sorted(zip(m,m),key=lambda x:(x[1],x[0])) A,B = zip(*AB) dp2 = [0]*N # T_...
all_fail
0
4
[{"idx": 0, "reason": "runtime_error", "rc": 1, "stderr": "Traceback (most recent call last):\n File \"/tmp/sbx_fyyravhk/tmpk0m13lae.py\", line 7, in <module>\n from fractions import gcd\nImportError: cannot import name 'gcd' from 'fractions' (/usr/lib/python3", "stdout_tail": ""}, {"idx": 1, "reason": "runtime_err...
atcoder
UNKNOWN
228
p03010 diverta 2019 Programming Contest 2 - Diverta City
Diverta City is a new city consisting of N towns numbered 1, 2, ..., N. The mayor Ringo is planning to connect every pair of two different towns with a bidirectional road. The length of each road is undecided. A Hamiltonian path is a path that starts at one of the towns and visits each of the other towns exactly once...
cpp
#include<bits/stdc++.h> using namespace std; long long a1[13]={1,2,4,7,12,20,29,38,52,101},a2[13]={1,2,4,7,12,20,30,39,67,101},n,an[15][15],no=1; int main(){ cin>>n; for (int i=1;i<=n;i++)an[i][i]=0; for (int i=1;i<=n;i++){ for (int j=i+1;j<=n;j++)an[i][j]=an[j][i]=no*a1[j-i-1]; no*=a2[n-i]; } for (int i=1;i<=...
all_fail
0
2
[{"idx": 0, "reason": "wrong_answer", "expected": "0 111 157 193\n111 0 224 239\n157 224 0 258\n193 239 258 0", "got": "0 1 2 4\n1 0 7 14\n2 7 0 28\n4 14 28 0"}, {"idx": 1, "reason": "wrong_answer", "expected": "0 6 15\n6 0 21\n15 21 0", "got": "0 1 2\n1 0 4\n2 4 0"}]
atcoder
UNKNOWN
228
p03010 diverta 2019 Programming Contest 2 - Diverta City
Diverta City is a new city consisting of N towns numbered 1, 2, ..., N. The mayor Ringo is planning to connect every pair of two different towns with a bidirectional road. The length of each road is undecided. A Hamiltonian path is a path that starts at one of the towns and visits each of the other towns exactly once...
cpp
#include<iostream> #define fr(i,a,b) for(int i=a;i<=b;i++) int f[]={0,1,2,4,7,12,20,29,38,52,73},n; int main() { std::cin>>n; long d[11][11]={0},p=1; fr(i,2,n){fr(j,1,i-1)d[i][j]=d[j][i]=p*f[j];p+=d[i][i-1]+d[i][i-2]-d[i-1][i-2];} fr(i,1,n)fr(j,1,n)std::cout<<d[i][j]<<" \n"[j==n]; return 0; }
all_fail
0
2
[{"idx": 0, "reason": "wrong_answer", "expected": "0 111 157 193\n111 0 224 239\n157 224 0 258\n193 239 258 0", "got": "0 1 2 7\n1 0 4 14\n2 4 0 28\n7 14 28 0"}, {"idx": 1, "reason": "wrong_answer", "expected": "0 6 15\n6 0 21\n15 21 0", "got": "0 1 2\n1 0 4\n2 4 0"}]
atcoder
UNKNOWN
228
p03010 diverta 2019 Programming Contest 2 - Diverta City
Diverta City is a new city consisting of N towns numbered 1, 2, ..., N. The mayor Ringo is planning to connect every pair of two different towns with a bidirectional road. The length of each road is undecided. A Hamiltonian path is a path that starts at one of the towns and visits each of the other towns exactly once...
cpp
//This Code was made by Chinese_zjc_. #include <iostream> #include <fstream> #include <iomanip> #include <algorithm> #include <vector> #include <bitset> #include <cmath> #include <queue> #include <stack> #include <string> #include <cstring> #include <cstdio> #include <cstdlib> #include <map> #include <set> #include <ct...
all_fail
0
2
[{"idx": 0, "reason": "wrong_answer", "expected": "0 111 157 193\n111 0 224 239\n157 224 0 258\n193 239 258 0", "got": "0 1 2 7\n1 0 4 14\n2 4 0 28\n7 14 28 0"}, {"idx": 1, "reason": "wrong_answer", "expected": "0 6 15\n6 0 21\n15 21 0", "got": "0 1 2\n1 0 4\n2 4 0"}]
atcoder
UNKNOWN
228
p03010 diverta 2019 Programming Contest 2 - Diverta City
Diverta City is a new city consisting of N towns numbered 1, 2, ..., N. The mayor Ringo is planning to connect every pair of two different towns with a bidirectional road. The length of each road is undecided. A Hamiltonian path is a path that starts at one of the towns and visits each of the other towns exactly once...
python3
from itertools import combinations, permutations N = int(input()) # 整数列の生成 # s = [1] # while len(s) < 10 : # i = s[-1] + 1 # while True : # path = s.copy() + [i] # flag = True # for comb in combinations(s + [i], 2) : # if not sum(comb) in path : # path....
all_fail
0
2
[{"idx": 0, "reason": "wrong_answer", "expected": "0 111 157 193\n111 0 224 239\n157 224 0 258\n193 239 258 0", "got": "0 1 2 7\n1 0 4 14\n2 4 0 28\n7 14 28 0"}, {"idx": 1, "reason": "wrong_answer", "expected": "0 6 15\n6 0 21\n15 21 0", "got": "0 1 2\n1 0 4\n2 4 0"}]
atcoder
UNKNOWN
228
p03010 diverta 2019 Programming Contest 2 - Diverta City
Diverta City is a new city consisting of N towns numbered 1, 2, ..., N. The mayor Ringo is planning to connect every pair of two different towns with a bidirectional road. The length of each road is undecided. A Hamiltonian path is a path that starts at one of the towns and visits each of the other towns exactly once...
python3
import sys input = sys.stdin.readline import itertools N = int(input()) A = [1,2,4] for _ in range(12): sum_2 = set(x+y for x,y in itertools.combinations(A,2)) avoid = set(x-y for x,y in itertools.product(sum_2,A)) x = min(set(range(1,1000)) - avoid - sum_2 - set(A)) A.append(x) L = [[0] * (N-1-i) f...
all_fail
0
2
[{"idx": 0, "reason": "wrong_answer", "expected": "0 111 157 193\n111 0 224 239\n157 224 0 258\n193 239 258 0", "got": "0 1 2 4\n1 0 6 12\n2 6 0 18\n4 12 18 0"}, {"idx": 1, "reason": "wrong_answer", "expected": "0 6 15\n6 0 21\n15 21 0", "got": "0 1 2\n1 0 3\n2 3 0"}]
atcoder
UNKNOWN
228
p03010 diverta 2019 Programming Contest 2 - Diverta City
Diverta City is a new city consisting of N towns numbered 1, 2, ..., N. The mayor Ringo is planning to connect every pair of two different towns with a bidirectional road. The length of each road is undecided. A Hamiltonian path is a path that starts at one of the towns and visits each of the other towns exactly once...
java
import java.io.ByteArrayInputStream; import java.io.IOException; import java.io.InputStream; import java.io.PrintWriter; import java.util.Arrays; import java.util.HashSet; import java.util.InputMismatchException; import java.util.Set; public class Main { static InputStream is; static PrintWriter out; static String ...
all_fail
0
2
[{"idx": 0, "reason": "wrong_answer", "expected": "0 111 157 193\n111 0 224 239\n157 224 0 258\n193 239 258 0", "got": "0 1 2 5\n1 0 3 10\n2 3 0 20\n5 10 20 0"}, {"idx": 1, "reason": "wrong_answer", "expected": "0 6 15\n6 0 21\n15 21 0", "got": "0 1 2\n1 0 3\n2 3 0"}]
atcoder
UNKNOWN
228
p03010 diverta 2019 Programming Contest 2 - Diverta City
Diverta City is a new city consisting of N towns numbered 1, 2, ..., N. The mayor Ringo is planning to connect every pair of two different towns with a bidirectional road. The length of each road is undecided. A Hamiltonian path is a path that starts at one of the towns and visits each of the other towns exactly once...
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 Main { static InputStream is; static PrintWriter out; static String INPUT = ""; static void solve() { int n = ...
all_fail
0
2
[{"idx": 0, "reason": "wrong_answer", "expected": "0 111 157 193\n111 0 224 239\n157 224 0 258\n193 239 258 0", "got": "0 1 2 4\n1 0 3 8\n2 3 0 16\n4 8 16 0"}, {"idx": 1, "reason": "wrong_answer", "expected": "0 6 15\n6 0 21\n15 21 0", "got": "0 1 2\n1 0 3\n2 3 0"}]
atcoder
UNKNOWN
228
p03010 diverta 2019 Programming Contest 2 - Diverta City
Diverta City is a new city consisting of N towns numbered 1, 2, ..., N. The mayor Ringo is planning to connect every pair of two different towns with a bidirectional road. The length of each road is undecided. A Hamiltonian path is a path that starts at one of the towns and visits each of the other towns exactly once...
python3
N = int(input()) s = [] t = [] i = 1 while len(s) < N : if i in t or any(i + s_ in t for s_ in s) : i += 1 continue t.append(i) for s_ in s : t.append(i+s_) s.append(i) i += 1 w = [[0] * 10 for _ in range(10)] w[0][1] = w[1][0] = 1 M = 1 for n in range(3, N + 1) ...
all_fail
0
2
[{"idx": 0, "reason": "wrong_answer", "expected": "0 111 157 193\n111 0 224 239\n157 224 0 258\n193 239 258 0", "got": "0 1 2 7\n1 0 4 14\n2 4 0 28\n7 14 28 0"}, {"idx": 1, "reason": "wrong_answer", "expected": "0 6 15\n6 0 21\n15 21 0", "got": "0 1 2\n1 0 4\n2 4 0"}]
atcoder
UNKNOWN
228
p03010 diverta 2019 Programming Contest 2 - Diverta City
Diverta City is a new city consisting of N towns numbered 1, 2, ..., N. The mayor Ringo is planning to connect every pair of two different towns with a bidirectional road. The length of each road is undecided. A Hamiltonian path is a path that starts at one of the towns and visits each of the other towns exactly once...
java
import java.io.ByteArrayInputStream; import java.io.IOException; import java.io.InputStream; import java.io.PrintWriter; import java.util.Arrays; import java.util.HashSet; import java.util.InputMismatchException; import java.util.Set; public class Main { static InputStream is; static PrintWriter out; static String ...
all_fail
0
2
[{"idx": 0, "reason": "wrong_answer", "expected": "0 111 157 193\n111 0 224 239\n157 224 0 258\n193 239 258 0", "got": "0 1 2 4\n1 0 3 8\n2 3 0 16\n4 8 16 0"}, {"idx": 1, "reason": "wrong_answer", "expected": "0 6 15\n6 0 21\n15 21 0", "got": "0 1 2\n1 0 3\n2 3 0"}]
atcoder
UNKNOWN
254
1096_E. The Top Scorer
Hasan loves playing games and has recently discovered a game called TopScore. In this soccer-like game there are p players doing penalty shoot-outs. Winner is the one who scores the most. In case of ties, one of the top-scorers will be declared as the winner randomly with equal probability. They have just finished the...
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
20
23
[{"idx": 5, "reason": "timeout"}, {"idx": 12, "reason": "timeout"}, {"idx": 21, "reason": "timeout"}]
codeforces
E
257
1165_A. Remainder
You are given a huge decimal number consisting of n digits. It is guaranteed that this number has no leading zeros. Each digit of this number is either 0 or 1. You may perform several (possibly zero) operations with this number. During each operation you are allowed to change any digit of your number; you may change 0...
java
import javafx.scene.layout.Priority; import java.io.*; import java.lang.reflect.Array; import java.net.Inet4Address; import java.util.*; import java.lang.*; import java.util.HashMap; import java.util.PriorityQueue; public class templ implements Runnable { static class pair implements Comparable { int f;...
compile_error
0
0
COMPILE_ERROR:/tmp/sbx_l3luswxo/templ.java:1: error: package javafx.scene.layout does not exist import javafx.scene.layout.Priority; ^ 1 error
[]
codeforces
A
260
1244_C. The Football Season
The football season has just ended in Berland. According to the rules of Berland football, each match is played between two teams. The result of each match is either a draw, or a victory of one of the playing teams. If a team wins the match, it gets w points, and the opposing team gets 0 points. If the game results in ...
python2
def exgcd(a,b): if(a==0): x=0 y=1 return [0,1,b] x1,y1,d = exgcd(b%a,a) x = y1-(b/a)*x1 y = x1 l = [x,y,d] return l # 627936103814 4254617095171609 45205 1927 s = raw_input() l = s.split() n = long(l[0]) p = long(l[1]) w = long(l[2]) d = long(l[3]) gc = exgcd(w,d) x = gc[...
partial
15
25
[{"idx": 0, "reason": "wrong_answer", "expected": "20 0 10", "got": "15 15 0"}, {"idx": 5, "reason": "wrong_answer", "expected": "439408390432 21735 127609973012", "got": "359469952788 207548411939 20452"}, {"idx": 8, "reason": "wrong_answer", "expected": "22 2 9", "got": "14 17 2"}, {"idx": 10, "reason": "wrong_answer...
codeforces
C
261
1264_A. Beautiful Regional Contest
So the Beautiful Regional Contest (BeRC) has come to an end! n students took part in the contest. The final standings are already known: the participant in the i-th place solved p_i problems. Since the participants are primarily sorted by the number of solved problems, then p_1 ≥ p_2 ≥ ... ≥ p_n. Help the jury distrib...
python3
import math def count(l, x): r = 0 for i in l: if i > x: continue if x == i: r += 1 else: break return r def count2(l, a, b): r = 0 for i in l: if i >= b: continue elif i < b and i >= a: r += 1 else: break return r def fast_del(l): x = l[-1] delind = 1 for i in range(2, len(l...
all_fail
0
2
[{"idx": 0, "reason": "wrong_answer", "expected": "1 2 3\n0 0 0\n0 0 0\n1 2 7\n2 6 6", "got": "1 3 2\n0 0 0\n0 0 0\n1 7 2\n2 6 6"}, {"idx": 1, "reason": "wrong_answer", "expected": "1 2 3\n0 0 0\n0 0 0\n1 2 7\n2 6 6", "got": "1 3 2\n0 0 0\n0 0 0\n1 7 2\n2 6 6"}]
codeforces
A
262
1285_C. Fadi and LCM
Today, Osama gave Fadi an integer X, and Fadi was wondering about the minimum possible value of max(a, b) such that LCM(a, b) equals X. Both a and b should be positive integers. LCM(a, b) is the smallest positive integer that is divisible by both a and b. For example, LCM(6, 8) = 24, LCM(4, 12) = 12, LCM(2, 3) = 6. O...
cpp
#include <bits/stdc++.h> using namespace std; vector<long long> factors; void trial(long long n) { int count; long long ini = n; for (long long d = 2; d * d <= n; d++) { if (n % d == 0) { ini = n; while (n % d == 0) { n /= d; } long long s = ini / n; factors.push_back(s);...
partial
7
25
[{"idx": 1, "reason": "wrong_answer", "expected": "1 4", "got": "4 1"}, {"idx": 2, "reason": "wrong_answer", "expected": "2 3", "got": "3 2"}, {"idx": 3, "reason": "wrong_answer", "expected": "1 2", "got": "2 1"}, {"idx": 4, "reason": "wrong_answer", "expected": "185921 1103041", "got": "1103041 185921"}, {"idx": 6, "r...
codeforces
C
262
1285_C. Fadi and LCM
Today, Osama gave Fadi an integer X, and Fadi was wondering about the minimum possible value of max(a, b) such that LCM(a, b) equals X. Both a and b should be positive integers. LCM(a, b) is the smallest positive integer that is divisible by both a and b. For example, LCM(6, 8) = 24, LCM(4, 12) = 12, LCM(2, 3) = 6. O...
java
import java.io.*; import java.util.StringTokenizer; public class C { FastScanner scanner; PrintWriter writer; void solve() throws IOException { scanner = new FastScanner(System.in); writer = new PrintWriter(System.out); long x = scanner.nextLong(); long min = x; ...
partial
1
25
[{"idx": 1, "reason": "wrong_answer", "expected": "1 4", "got": "4 1"}, {"idx": 2, "reason": "wrong_answer", "expected": "2 3", "got": "3 2"}, {"idx": 3, "reason": "wrong_answer", "expected": "1 2", "got": "2 1"}, {"idx": 4, "reason": "wrong_answer", "expected": "185921 1103041", "got": "1103041 185921"}, {"idx": 5, "r...
codeforces
C
262
1285_C. Fadi and LCM
Today, Osama gave Fadi an integer X, and Fadi was wondering about the minimum possible value of max(a, b) such that LCM(a, b) equals X. Both a and b should be positive integers. LCM(a, b) is the smallest positive integer that is divisible by both a and b. For example, LCM(6, 8) = 24, LCM(4, 12) = 12, LCM(2, 3) = 6. O...
python2
n=input() from functools import reduce from bisect import bisect_left import fractions l=list(reduce(list.__add__,([i, n//i] for i in range(1, int(n**0.5) + 1) if n % i == 0))) l.sort() if len(l)==2: print 1,n else: a=bisect_left(l,int(n**0.5)+1)-1 l1=[n] for i in range(a,0,-1): if max(l[i],n/l[...
partial
3
25
[{"idx": 1, "reason": "wrong_answer", "expected": "1 4", "got": "4 1"}, {"idx": 2, "reason": "wrong_answer", "expected": "2 3", "got": "3 2"}, {"idx": 4, "reason": "wrong_answer", "expected": "185921 1103041", "got": "1103041 185921"}, {"idx": 5, "reason": "wrong_answer", "expected": "145967 5981551", "got": "5981551 1...
codeforces
C
262
1285_C. Fadi and LCM
Today, Osama gave Fadi an integer X, and Fadi was wondering about the minimum possible value of max(a, b) such that LCM(a, b) equals X. Both a and b should be positive integers. LCM(a, b) is the smallest positive integer that is divisible by both a and b. For example, LCM(6, 8) = 24, LCM(4, 12) = 12, LCM(2, 3) = 6. O...
python2
# Author : raj1307 - Raj Singh # Date : 10.01.2020 from __future__ import division, print_function import os,sys from io import BytesIO, IOBase if sys.version_info[0] < 3: from __builtin__ import xrange as range from future_builtins import ascii, filter, hex, map, oct, zip def ii(): return int(input()) ...
partial
22
25
[{"idx": 8, "reason": "timeout"}, {"idx": 12, "reason": "timeout"}, {"idx": 18, "reason": "timeout"}]
codeforces
C
263
1328_F. Make k Equal
You are given the array a consisting of n elements and the integer k ≤ n. You want to obtain at least k equal elements in the array a. In one move, you can make one of the following two operations: * Take one of the minimum elements of the array and increase its value by one (more formally, if the minimum value of ...
cpp
#include <bits/stdc++.h> #pragma warning(disable : 4996) using namespace std; const unsigned long long nmax = 200002; unsigned long long n, k, a[nmax], s[nmax], t[nmax], c[nmax], r = UINT64_MAX, A, B; int main() { scanf("%llu%llu", &n, &k); for (unsigned ...
partial
18
25
[{"idx": 0, "reason": "wrong_answer", "expected": "4", "got": "3"}, {"idx": 1, "reason": "wrong_answer", "expected": "2", "got": "4"}, {"idx": 3, "reason": "wrong_answer", "expected": "43", "got": "165"}, {"idx": 9, "reason": "wrong_answer", "expected": "12", "got": "674"}, {"idx": 10, "reason": "wrong_answer", "expect...
codeforces
F
263
1328_F. Make k Equal
You are given the array a consisting of n elements and the integer k ≤ n. You want to obtain at least k equal elements in the array a. In one move, you can make one of the following two operations: * Take one of the minimum elements of the array and increase its value by one (more formally, if the minimum value of ...
python3
n, k = map(int, input().split()) a = sorted(list(map(int, input().split()))) cnt = dict() sum = dict() res = n * 20 for x in a: y = x cur = 0 while True: if y == 0: break if y not in cnt: cnt[y] = 0 sum[y] = 0 if cnt[y] < k: cnt[y] +...
partial
24
25
[{"idx": 19, "reason": "wrong_answer", "expected": "5", "got": "12"}]
codeforces
F
263
1328_F. Make k Equal
You are given the array a consisting of n elements and the integer k ≤ n. You want to obtain at least k equal elements in the array a. In one move, you can make one of the following two operations: * Take one of the minimum elements of the array and increase its value by one (more formally, if the minimum value of ...
python3
""" NTC here """ from sys import setcheckinterval,stdin setcheckinterval(1000) #print("Case #{}: {} {}".format(i, n + m, n * m)) iin=lambda :int(stdin.readline()) lin=lambda :list(map(int,stdin.readline().split())) from collections import defaultdict n,k=lin() a=lin() a.sort() sol=[[0,0] for i in range(2*10**5+1)] fo...
all_fail
0
25
[{"idx": 0, "reason": "runtime_error", "rc": 1, "stderr": "Traceback (most recent call last):\n File \"/tmp/sbx_fcrjwjk9/tmp0gxxgu03.py\", line 4, in <module>\n from sys import setcheckinterval,stdin\nImportError: cannot import name 'setcheckinterval' from 'sy", "stdout_tail": ""}, {"idx": 1, "reason": "runtime_err...
codeforces
F
263
1328_F. Make k Equal
You are given the array a consisting of n elements and the integer k ≤ n. You want to obtain at least k equal elements in the array a. In one move, you can make one of the following two operations: * Take one of the minimum elements of the array and increase its value by one (more formally, if the minimum value of ...
cpp
#include <bits/stdc++.h> using namespace std; template <typename T> T gcd(T a, T b) { return !b ? a : gcd(b, a % b); } template <typename T> T lcm(T a, T b) { return a * (b / gcd(a, b)); } template <typename T> T sqr(T a) { return a * a; } template <typename T> T cube(T a) { return a * a * a; } template <typena...
partial
22
25
[{"idx": 5, "reason": "runtime_error", "rc": -11, "stderr": "", "stdout_tail": ""}, {"idx": 7, "reason": "runtime_error", "rc": -11, "stderr": "", "stdout_tail": ""}, {"idx": 19, "reason": "runtime_error", "rc": -11, "stderr": "", "stdout_tail": ""}]
codeforces
F
263
1328_F. Make k Equal
You are given the array a consisting of n elements and the integer k ≤ n. You want to obtain at least k equal elements in the array a. In one move, you can make one of the following two operations: * Take one of the minimum elements of the array and increase its value by one (more formally, if the minimum value of ...
java
/* * @author romit17 */ import java.io.IOException; import java.io.InputStream; import java.io.PrintWriter; import java.util.Arrays; import java.util.HashMap; import java.util.InputMismatchException; import java.util.Random; public class D1213 { void solve() throws IOException { PrintWriter out = ...
partial
24
25
[{"idx": 19, "reason": "wrong_answer", "expected": "5", "got": "12"}]
codeforces
F
263
1328_F. Make k Equal
You are given the array a consisting of n elements and the integer k ≤ n. You want to obtain at least k equal elements in the array a. In one move, you can make one of the following two operations: * Take one of the minimum elements of the array and increase its value by one (more formally, if the minimum value of ...
python2
n,k = map(int,raw_input().split()) arr = map(int,raw_input().split()) d1 ={} d2 = {} arr.sort() for i in range(0,2*10**5+1): d1[i] = 0 d2[i] = 0 for i in arr: cnt = 0 if(d2[i]<k): d2[i] = d2[i] + 1 while(i>0): i = i/2 cnt = cnt + 1 if(d2[i]<k): d1[i] = d1...
partial
22
25
[{"idx": 5, "reason": "runtime_error", "rc": 1, "stderr": "Traceback (most recent call last):\n File \"/tmp/sbx_0jfzltwc/tmp3k_7rw2h.py\", line 12, in <module>\n if(d2[i]<k):\nKeyError: 1000000000\n", "stdout_tail": ""}, {"idx": 7, "reason": "runtime_error", "rc": 1, "stderr": "Traceback (most recent call last):\n ...
codeforces
F
263
1328_F. Make k Equal
You are given the array a consisting of n elements and the integer k ≤ n. You want to obtain at least k equal elements in the array a. In one move, you can make one of the following two operations: * Take one of the minimum elements of the array and increase its value by one (more formally, if the minimum value of ...
python3
n,k=map(int,input().split()) a=list(map(int,input().split())) a.sort() d1={};d2={} ans=10**9 for i in range(n): num=a[i];c=0 while num>0: d1[num]=c if num not in d1 else d1[num]+c d2[num]=1 if num not in d2 else d2[num]+1 if d2[num]==k: ans=min(ans,d1[num]) c+=1 ...
partial
24
25
[{"idx": 19, "reason": "wrong_answer", "expected": "5", "got": "12"}]
codeforces
F
263
1328_F. Make k Equal
You are given the array a consisting of n elements and the integer k ≤ n. You want to obtain at least k equal elements in the array a. In one move, you can make one of the following two operations: * Take one of the minimum elements of the array and increase its value by one (more formally, if the minimum value of ...
cpp
#include <bits/stdc++.h> using namespace std; int main() { long long int n, k; cin >> n >> k; vector<long long int> v(n); for (int i = 0; i < n; i++) cin >> v[i]; map<long long int, long long int> bag; for (long long int i = 0; i < n; i++) bag[v[i]]++; vector<pair<long long int, long long int> > vpll; v...
partial
18
25
[{"idx": 0, "reason": "wrong_answer", "expected": "4", "got": "3"}, {"idx": 1, "reason": "wrong_answer", "expected": "2", "got": "4"}, {"idx": 3, "reason": "wrong_answer", "expected": "43", "got": "165"}, {"idx": 9, "reason": "wrong_answer", "expected": "12", "got": "674"}, {"idx": 10, "reason": "wrong_answer", "expect...
codeforces
F
263
1328_F. Make k Equal
You are given the array a consisting of n elements and the integer k ≤ n. You want to obtain at least k equal elements in the array a. In one move, you can make one of the following two operations: * Take one of the minimum elements of the array and increase its value by one (more formally, if the minimum value of ...
java
// No sorceries shall previal. // import java.util.Scanner; import java.io.PrintWriter; import java.util.*; import java.util.Arrays; public class InVoker2 { public static void sort(int arr[], int start, int end) { if(start>=end) return; int mid=(start+end)/2; sort(arr,star...
partial
22
25
[{"idx": 5, "reason": "runtime_error", "rc": 1, "stderr": "Exception in thread \"main\" java.lang.ArrayIndexOutOfBoundsException: Index 1000000000 out of bounds for length 200001\n\tat InVoker2.main(InVoker2.java:68)\n", "stdout_tail": ""}, {"idx": 7, "reason": "runtime_error", "rc": 1, "stderr": "Exception in thread \...
codeforces
F
263
1328_F. Make k Equal
You are given the array a consisting of n elements and the integer k ≤ n. You want to obtain at least k equal elements in the array a. In one move, you can make one of the following two operations: * Take one of the minimum elements of the array and increase its value by one (more formally, if the minimum value of ...
java
import java.io.*; import java.util.ArrayList; import java.util.Collections; import java.util.HashMap; import java.util.StringTokenizer; public class CF1213C { static final int MAXN = (int) (2e5 + 1); static boolean hasKEqualNumbers(int[] a, int N, int K) { HashMap<Integer, Integer> occ = new HashMap...
partial
24
25
[{"idx": 19, "reason": "runtime_error", "rc": 1, "stderr": "Exception in thread \"main\" java.lang.ArrayIndexOutOfBoundsException: Index 893967334 out of bounds for length 200001\n\tat CF1213C.powerOfTwoMap(CF1213C.java:31)\n\tat CF1213C.main(CF1213C.java:53)\n", "stdout_tail": ""}]
codeforces
F
263
1328_F. Make k Equal
You are given the array a consisting of n elements and the integer k ≤ n. You want to obtain at least k equal elements in the array a. In one move, you can make one of the following two operations: * Take one of the minimum elements of the array and increase its value by one (more formally, if the minimum value of ...
python2
import decimal,math from collections import * from fractions import gcd from bisect import bisect_right,bisect_left import sys decimal.getcontext().prec = 15 def primeFactors(n): arr=[] while n % 2 == 0: arr.append(2) n = n / 2 for i in xrange(3,int(math.sqrt(n))+1,2): while n % i== 0: arr.append(i) ...
partial
24
25
[{"idx": 19, "reason": "wrong_answer", "expected": "5", "got": "12"}]
codeforces
F
263
1328_F. Make k Equal
You are given the array a consisting of n elements and the integer k ≤ n. You want to obtain at least k equal elements in the array a. In one move, you can make one of the following two operations: * Take one of the minimum elements of the array and increase its value by one (more formally, if the minimum value of ...
python2
from collections import Counter,defaultdict import heapq from sys import stdin raw_input = stdin.readline n,k=map(int,raw_input().split()) l=map(int,raw_input().split()) d1,d2=Counter(),Counter() d=defaultdict(list) mx=0 for i in l: x=i d1[x]+=1 heapq.heappush(d[x],0) if d1[x]>k: pp=-heapq.heapp...
partial
22
25
[{"idx": 5, "reason": "timeout"}, {"idx": 7, "reason": "timeout"}, {"idx": 19, "reason": "timeout"}]
codeforces
F
264
1348_F. Phoenix and Memory
Phoenix is trying to take a photo of his n friends with labels 1, 2, ..., n who are lined up in a row in a special order. But before he can take the photo, his friends get distracted by a duck and mess up their order. Now, Phoenix must restore the order but he doesn't remember completely! He only remembers that the i-...
cpp
#include <bits/stdc++.h> #pragma GCC optimize(2) using namespace std; long long n, m, t, k; int pos[200005], tmp[200005]; pair<pair<int, int>, int> a[200005]; class dsu { public: int fa[200005]; void init(int n) { for (int i = 0; i <= n; i++) { fa[i] = i; } } int find(int u) { while (u != fa[...
partial
23
25
[{"idx": 19, "reason": "wrong_answer", "expected": "NO\n2 1 3\n3 1 2", "got": "NO\n3 1 2\n3 2 1"}, {"idx": 22, "reason": "wrong_answer", "expected": "NO\n5 8 2 4 7 1 6 3\n5 8 1 4 7 2 6 3", "got": "NO\n6 8 2 4 7 1 5 3\n6 8 1 4 7 2 5 3"}]
codeforces
F
264
1348_F. Phoenix and Memory
Phoenix is trying to take a photo of his n friends with labels 1, 2, ..., n who are lined up in a row in a special order. But before he can take the photo, his friends get distracted by a duck and mess up their order. Now, Phoenix must restore the order but he doesn't remember completely! He only remembers that the i-...
cpp
#include <bits/stdc++.h> std::pair<std::pair<int, int>, int> a[262144], pq[262144]; int ans[262144]; std::pair<int, int> bit[262144]; void update(int k, std::pair<int, int> v) { ++k; while (k) bit[k] = std::max(bit[k], v), k -= k & -k; } std::pair<int, int> qry(int k) { std::pair<int, int> res(-1, -1); ++k; w...
partial
22
25
[{"idx": 11, "reason": "wrong_answer", "expected": "NO\n2 3 1 4\n1 3 2 4", "got": "NO\n3 2 1 4\n3 1 2 4"}, {"idx": 19, "reason": "wrong_answer", "expected": "NO\n2 1 3\n3 1 2", "got": "NO\n3 1 2\n3 2 1"}, {"idx": 22, "reason": "wrong_answer", "expected": "NO\n5 8 2 4 7 1 6 3\n5 8 1 4 7 2 6 3", "got": "NO\n6 8 2 4 7 1 5...
codeforces
F
264
1348_F. Phoenix and Memory
Phoenix is trying to take a photo of his n friends with labels 1, 2, ..., n who are lined up in a row in a special order. But before he can take the photo, his friends get distracted by a duck and mess up their order. Now, Phoenix must restore the order but he doesn't remember completely! He only remembers that the i-...
java
import java.io.BufferedReader; import java.io.File; import java.io.FileReader; import java.io.InputStream; import java.io.InputStreamReader; import java.io.OutputStream; import java.io.PrintWriter; import java.util.Arrays; import java.util.Comparator; import java.util.StringTokenizer; import java.util.TreeSet; public...
partial
7
25
[{"idx": 0, "reason": "wrong_answer", "expected": "NO\n1 3 4 2\n1 2 4 3", "got": "NO\n1 2 4 3\n1 3 4 2"}, {"idx": 2, "reason": "wrong_answer", "expected": "NO\n3 1 4 2\n3 2 4 1", "got": "NO\n4 2 3 1\n4 1 3 2"}, {"idx": 5, "reason": "wrong_answer", "expected": "NO\n2 3 4 1\n1 3 4 2", "got": "NO\n3 1 4 2\n1 3 4 2"}, {"id...
codeforces
F
264
1348_F. Phoenix and Memory
Phoenix is trying to take a photo of his n friends with labels 1, 2, ..., n who are lined up in a row in a special order. But before he can take the photo, his friends get distracted by a duck and mess up their order. Now, Phoenix must restore the order but he doesn't remember completely! He only remembers that the i-...
java
/** * @author egaeus * @mail sebegaeusprogram@gmail.com * @veredict * @url https://codeforces.com/problemset/problem/1348/F * @category adhoc * @date 01/05/2020 **/ import java.io.BufferedReader; import java.io.InputStreamReader; import java.lang.reflect.Array; import java.util.*; import java.util.stream.Coll...
partial
23
25
[{"idx": 19, "reason": "wrong_answer", "expected": "NO\n2 1 3\n3 1 2", "got": "NO\n3 1 2\n3 2 1"}, {"idx": 22, "reason": "wrong_answer", "expected": "NO\n5 8 2 4 7 1 6 3\n5 8 1 4 7 2 6 3", "got": "NO\n6 8 2 4 7 1 5 3\n6 8 1 4 7 2 5 3"}]
codeforces
F
264
1348_F. Phoenix and Memory
Phoenix is trying to take a photo of his n friends with labels 1, 2, ..., n who are lined up in a row in a special order. But before he can take the photo, his friends get distracted by a duck and mess up their order. Now, Phoenix must restore the order but he doesn't remember completely! He only remembers that the i-...
java
import java.io.*; import java.util.*; import static java.lang.Math.*; // it's problem 1872 from timus // and its clone https://codeforces.com/gym/100187/problem/C public class SpaciousOffice implements Runnable { final boolean ONLINE_JUDGE = System.getProperty("ONLINE_JUDGE") != null; BufferedReader in; PrintWri...
all_fail
0
25
[{"idx": 0, "reason": "runtime_error", "rc": 255, "stderr": "java.io.FileNotFoundException: input.txt (No such file or directory)\n\tat java.base/java.io.FileInputStream.open0(Native Method)\n\tat java.base/java.io.FileInputStream.open(FileInputStream.java:216)\n\tat", "stdout_tail": ""}, {"idx": 1, "reason": "runtime_...
codeforces
F
265
1391_C. Cyclic Permutations
A permutation of length n is an array consisting of n distinct integers from 1 to n in arbitrary order. For example, [2,3,1,5,4] is a permutation, but [1,2,2] is not a permutation (2 appears twice in the array) and [1,3,4] is also not a permutation (n=3 but there is 4 in the array). Consider a permutation p of length ...
cpp
#include <bits/stdc++.h> using namespace std; void __print(int x) { cout << x; } void __print(long x) { cout << x; } void __print(long long x) { cout << x; } void __print(unsigned x) { cout << x; } void __print(unsigned long x) { cout << x; } void __print(unsigned long long x) { cout << x; } void __print(float x) { cou...
partial
7
12
[{"idx": 1, "reason": "runtime_error", "rc": -11, "stderr": "", "stdout_tail": ""}, {"idx": 3, "reason": "runtime_error", "rc": -11, "stderr": "", "stdout_tail": ""}, {"idx": 7, "reason": "runtime_error", "rc": -11, "stderr": "", "stdout_tail": ""}, {"idx": 9, "reason": "runtime_error", "rc": -11, "stderr": "", "stdout...
codeforces
C
266
1413_F. Roads and Ramen
In the Land of Fire there are n villages and n-1 bidirectional road, and there is a path between any pair of villages by roads. There are only two types of roads: stone ones and sand ones. Since the Land of Fire is constantly renovating, every morning workers choose a single road and flip its type (so it becomes a ston...
java
//package round679; import java.io.*; import java.util.ArrayDeque; import java.util.Arrays; import java.util.InputMismatchException; import java.util.Queue; public class D5 { InputStream is; FastWriter out; String INPUT = ""; void solve() { int n = ni(); int[] from = new int[n - 1]; int[] to = new int[n ...
all_fail
0
5
[{"idx": 0, "reason": "runtime_error", "rc": 1, "stderr": "Exception in thread \"main\" java.lang.NegativeArraySizeException: -1\n\tat D5.solve(D5.java:17)\n\tat D5.run(D5.java:294)\n\tat D5.main(D5.java:299)\n", "stdout_tail": ""}, {"idx": 1, "reason": "runtime_error", "rc": 1, "stderr": "Exception in thread \"main\" ...
codeforces
F
266
1413_F. Roads and Ramen
In the Land of Fire there are n villages and n-1 bidirectional road, and there is a path between any pair of villages by roads. There are only two types of roads: stone ones and sand ones. Since the Land of Fire is constantly renovating, every morning workers choose a single road and flip its type (so it becomes a ston...
java
//package round679; 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 D4 { InputStream is; PrintWriter out; String INPUT = ""; void solve() { // 直径の端点を出す // ...
all_fail
0
5
[{"idx": 0, "reason": "runtime_error", "rc": 1, "stderr": "Exception in thread \"main\" java.lang.NegativeArraySizeException: -1\n\tat D4.solve(D4.java:21)\n\tat D4.run(D4.java:298)\n\tat D4.main(D4.java:303)\n", "stdout_tail": ""}, {"idx": 1, "reason": "runtime_error", "rc": 1, "stderr": "Exception in thread \"main\" ...
codeforces
F
268
152_E. Garden
Vasya has a very beautiful country garden that can be represented as an n × m rectangular field divided into n·m squares. One beautiful day Vasya remembered that he needs to pave roads between k important squares that contain buildings. To pave a road, he can cover some squares of his garden with concrete. For each ga...
cpp
#include <bits/stdc++.h> using namespace std; const int mm[4][2] = {0, 1, 0, -1, 1, 0, -1, 0}; int a[205], n, m, k, data[7]; int dp[1 << 7][205], from[1 << 7][205][3], g[205][205], h[205][205]; bool mark[205]; bool check(int &x, int y) { if (x == 0 || x > y) { x = y; return true; } return false; } void df...
compile_error
0
0
COMPILE_ERROR:/tmp/sbx_i5jf35cx/tmp76yvdigd.cpp: In function ‘int main()’: /tmp/sbx_i5jf35cx/tmp76yvdigd.cpp:41:5: error: reference to ‘data’ is ambiguous 41 | data[i] = x * m + y; | ^~~~ In file included from /usr/include/c++/11/string:54, from /usr/include/c++/11/bits/locale_classes....
[]
codeforces
E
268
152_E. Garden
Vasya has a very beautiful country garden that can be represented as an n × m rectangular field divided into n·m squares. One beautiful day Vasya remembered that he needs to pave roads between k important squares that contain buildings. To pave a road, he can cover some squares of his garden with concrete. For each ga...
java
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.util.Arrays; import java.util.Queue; import java.util.concurrent.ArrayBlockingQueue; public class ProblemE { public static int INF = Integer.MAX_VALUE / 10; static int[] dx = {0, 1, 0, -1}; st...
partial
10
11
[{"idx": 1, "reason": "wrong_answer", "expected": "26\nX..XX\nXXXX.\nX.X..\nX.XX.", "got": "26\nX..XX\nX.XX.\nX.X..\nXXXX."}]
codeforces
E
269
161_B. Discounts
One day Polycarpus stopped by a supermarket on his way home. It turns out that the supermarket is having a special offer for stools. The offer is as follows: if a customer's shopping cart contains at least one stool, the customer gets a 50% discount on the cheapest item in the cart (that is, it becomes two times cheape...
java
import static java.lang.Math.*; import static java.util.Arrays.*; import java.io.*; import java.util.*; public class B { Scanner sc = new Scanner(System.in); void run() { int n = sc.nextInt(), k = sc.nextInt(); int[] cs = new int[n], ts = new int[n]; for (int i = 0; i < n; i++) { cs[i] = sc.nextInt() * 2...
partial
5
16
[{"idx": 0, "reason": "wrong_answer", "expected": "5.5\n1 3\n2 1 2", "got": "5.5\n2 1 2\n1 3"}, {"idx": 2, "reason": "wrong_answer", "expected": "32.5\n1 10\n1 9\n1 5\n1 8\n1 7\n1 11\n1 6\n1 2\n1 1\n1 4\n1 3", "got": "32.5\n1 5\n1 7\n1 8\n1 9\n1 10\n1 1\n1 2\n1 3\n1 4\n1 6\n1 11"}, {"idx": 3, "reason": "wrong_answer", ...
codeforces
B
269
161_B. Discounts
One day Polycarpus stopped by a supermarket on his way home. It turns out that the supermarket is having a special offer for stools. The offer is as follows: if a customer's shopping cart contains at least one stool, the customer gets a 50% discount on the cheapest item in the cart (that is, it becomes two times cheape...
python2
from math import * n,k = map(int,raw_input().split()) it1,it2 = [],[] for i in range(0,n): p,t = map(int,raw_input().split()) if t==1: it1 += [[p,i+1]] else: it2 += [[p,i+1]] it1.sort(); it1.reverse() it2.sort(); it2.reverse() tot = 0 for i in range(0,min(k-1,len(it1))): tot += it1[i][0] m = 10**9 for ...
partial
5
16
[{"idx": 0, "reason": "wrong_answer", "expected": "5.5\n1 3\n2 1 2", "got": "5.5\n1 3\n2 2 1"}, {"idx": 1, "reason": "wrong_answer", "expected": "8.0\n1 1\n1 2\n2 3 4", "got": "8.0\n1 1\n1 4\n2 3 2"}, {"idx": 3, "reason": "wrong_answer", "expected": "5362337336.5\n1 19\n1 21\n1 3\n1 20\n1 1\n1 11\n15 15 14 13 10 7 4 2 ...
codeforces
B
269
161_B. Discounts
One day Polycarpus stopped by a supermarket on his way home. It turns out that the supermarket is having a special offer for stools. The offer is as follows: if a customer's shopping cart contains at least one stool, the customer gets a 50% discount on the cheapest item in the cart (that is, it becomes two times cheape...
java
import javax.swing.*; import java.awt.*; import java.io.*; import java.util.*; import static java.lang.Math.max; import static java.lang.Math.min; import static java.lang.Math.round; public class Code implements Runnable { public static void main(String[] args) throws IOException { new Thread(new Code())...
partial
7
16
[{"idx": 2, "reason": "wrong_answer", "expected": "32.5\n1 10\n1 9\n1 5\n1 8\n1 7\n1 11\n1 6\n1 2\n1 1\n1 4\n1 3", "got": "32.5\n1 7\n1 8\n1 5\n1 9\n1 10\n1 3\n1 4\n1 1\n1 2\n1 6\n1 11"}, {"idx": 3, "reason": "wrong_answer", "expected": "5362337336.5\n1 19\n1 21\n1 3\n1 20\n1 1\n1 11\n15 15 14 13 10 7 4 2 6 8 12 16 5 1...
codeforces
B
269
161_B. Discounts
One day Polycarpus stopped by a supermarket on his way home. It turns out that the supermarket is having a special offer for stools. The offer is as follows: if a customer's shopping cart contains at least one stool, the customer gets a 50% discount on the cheapest item in the cart (that is, it becomes two times cheape...
python3
n, k = list(map(int, input().split())) p = [[], []] for i in range(1, n + 1): c, t = map(int, input().split()) p[t > 1].append((c, i)) if k > len(p[0]): l = k - len(p[0]) - 1 print(sum(c for c, i in p[0]) / 2 + sum(c for c, i in p[1])) print('\n'.join('1 ' + str(i) for c, i in p[0])) pr...
partial
8
16
[{"idx": 2, "reason": "wrong_answer", "expected": "32.5\n1 10\n1 9\n1 5\n1 8\n1 7\n1 11\n1 6\n1 2\n1 1\n1 4\n1 3", "got": "32.5\n1 5\n1 7\n1 8\n1 9\n1 10\n1 1\n1 2\n1 3\n1 4\n1 6\n1 11"}, {"idx": 3, "reason": "wrong_answer", "expected": "5362337336.5\n1 19\n1 21\n1 3\n1 20\n1 1\n1 11\n15 15 14 13 10 7 4 2 6 8 12 16 5 1...
codeforces
B
269
161_B. Discounts
One day Polycarpus stopped by a supermarket on his way home. It turns out that the supermarket is having a special offer for stools. The offer is as follows: if a customer's shopping cart contains at least one stool, the customer gets a 50% discount on the cheapest item in the cart (that is, it becomes two times cheape...
python2
l=lambda: map(int, raw_input().split()) n,k=l() v=[] i=1 for a,b in [ l() for _ in [0]*n]: v += [(3-b,a,i)] i += 1 v.sort(reverse=True) s=0 for (a,b,c) in v[:k-1]: if a == 2: s += b*1./2 else: s += b t=v[k-1][0]==2 C=[] for (a,b,c) in v[k-1:]: C+=[b] C.sort() s += sum(C) if t: ...
partial
10
16
[{"idx": 1, "reason": "wrong_answer", "expected": "8.0\n1 1\n1 2\n2 3 4", "got": "8.0\n1 1\n1 4\n2 3 2"}, {"idx": 3, "reason": "wrong_answer", "expected": "5362337336.5\n1 19\n1 21\n1 3\n1 20\n1 1\n1 11\n15 15 14 13 10 7 4 2 6 8 12 16 5 18 17 9", "got": "5362337336.5\n1 19\n1 21\n1 20\n1 3\n1 1\n1 11\n15 15 14 13 10 7 ...
codeforces
B
269
161_B. Discounts
One day Polycarpus stopped by a supermarket on his way home. It turns out that the supermarket is having a special offer for stools. The offer is as follows: if a customer's shopping cart contains at least one stool, the customer gets a 50% discount on the cheapest item in the cart (that is, it becomes two times cheape...
java
import java.util.List; import java.io.IOException; import java.io.InputStreamReader; import java.util.Arrays; import java.util.ArrayList; import java.util.Vector; import java.io.BufferedReader; import java.io.OutputStream; import java.io.PrintWriter; import java.io.Writer; import java.util.StringTokenizer; import java....
partial
10
16
[{"idx": 2, "reason": "wrong_answer", "expected": "32.5\n1 10\n1 9\n1 5\n1 8\n1 7\n1 11\n1 6\n1 2\n1 1\n1 4\n1 3", "got": "32.5\n1 10\n1 9\n1 5\n1 8\n1 7\n1 1\n1 2\n1 3\n1 4\n1 6\n1 11"}, {"idx": 3, "reason": "wrong_answer", "expected": "5362337336.5\n1 19\n1 21\n1 3\n1 20\n1 1\n1 11\n15 15 14 13 10 7 4 2 6 8 12 16 5 1...
codeforces
B
269
161_B. Discounts
One day Polycarpus stopped by a supermarket on his way home. It turns out that the supermarket is having a special offer for stools. The offer is as follows: if a customer's shopping cart contains at least one stool, the customer gets a 50% discount on the cheapest item in the cart (that is, it becomes two times cheape...
cpp
#include <bits/stdc++.h> using namespace std; int ans[1010][1010]; int al[1010]; struct node { int id; int v; } den[1010], qian[1010]; int dl = 0; int ql = 0; bool cmp(node a, node b) { return a.v > b.v; } int main() { int n; scanf("%d", &n); ; int m; scanf("%d", &m); ; double cost = 0; for (int i =...
partial
7
16
[{"idx": 2, "reason": "wrong_answer", "expected": "32.5\n1 10\n1 9\n1 5\n1 8\n1 7\n1 11\n1 6\n1 2\n1 1\n1 4\n1 3", "got": "32.5\n1 5\n1 9\n1 10\n1 7\n1 8\n1 1\n1 2\n1 3\n1 4\n1 6\n1 11"}, {"idx": 3, "reason": "wrong_answer", "expected": "5362337336.5\n1 19\n1 21\n1 3\n1 20\n1 1\n1 11\n15 15 14 13 10 7 4 2 6 8 12 16 5 1...
codeforces
B
269
161_B. Discounts
One day Polycarpus stopped by a supermarket on his way home. It turns out that the supermarket is having a special offer for stools. The offer is as follows: if a customer's shopping cart contains at least one stool, the customer gets a 50% discount on the cheapest item in the cart (that is, it becomes two times cheape...
cpp
#include <bits/stdc++.h> using namespace std; int main() { int k, n; scanf("%d%d", &n, &k); vector<int> a(n), b(n), distributed(n), p(n); vector<vector<int> > cart(k); for (int i = 0; i < n; ++i) { scanf("%d%d", &a[i], &b[i]); distributed[i] = 0; p[i] = i; } for (int i = 0; i < n; ++i) { f...
partial
4
16
[{"idx": 1, "reason": "wrong_answer", "expected": "8.0\n1 1\n1 2\n2 3 4", "got": "8.0\n1 1\n1 4\n2 3 2"}, {"idx": 2, "reason": "wrong_answer", "expected": "32.5\n1 10\n1 9\n1 5\n1 8\n1 7\n1 11\n1 6\n1 2\n1 1\n1 4\n1 3", "got": "32.5\n1 9\n1 10\n1 5\n1 7\n1 8\n1 1\n1 2\n1 6\n1 11\n1 4\n1 3"}, {"idx": 3, "reason": "wrong...
codeforces
B
269
161_B. Discounts
One day Polycarpus stopped by a supermarket on his way home. It turns out that the supermarket is having a special offer for stools. The offer is as follows: if a customer's shopping cart contains at least one stool, the customer gets a 50% discount on the cheapest item in the cart (that is, it becomes two times cheape...
cpp
#include <bits/stdc++.h> using namespace std; struct sort_pred { bool operator()(const std::pair<int, int> &left, const std::pair<int, int> &right) { return left.first > right.first; } }; int main() { int n, k; cin >> n >> k; int num = n / k; int cart = 1; vector<pair<int, int> > one...
partial
7
16
[{"idx": 2, "reason": "wrong_answer", "expected": "32.5\n1 10\n1 9\n1 5\n1 8\n1 7\n1 11\n1 6\n1 2\n1 1\n1 4\n1 3", "got": "32.5\n1 5\n1 9\n1 10\n1 7\n1 8\n1 1\n1 2\n1 3\n1 4\n1 6\n1 11"}, {"idx": 3, "reason": "wrong_answer", "expected": "5362337336.5\n1 19\n1 21\n1 3\n1 20\n1 1\n1 11\n15 15 14 13 10 7 4 2 6 8 12 16 5 1...
codeforces
B
269
161_B. Discounts
One day Polycarpus stopped by a supermarket on his way home. It turns out that the supermarket is having a special offer for stools. The offer is as follows: if a customer's shopping cart contains at least one stool, the customer gets a 50% discount on the cheapest item in the cart (that is, it becomes two times cheape...
python2
n,k=map(int,raw_input().split()) a=map(list,[()]*2) for i in xrange(n): c,d=map(int,raw_input().split()) a[d%2].append((c,i+1)) for i in a: i.sort(reverse=True) ss=map(list,[()]*k) z=0 skid=set([]) for i in a[1]: ss[z].append(i) skid.add(z) if z!=k-1: z+=1 for i in a[0]: ss[z].append...
partial
10
16
[{"idx": 1, "reason": "wrong_answer", "expected": "8.0\n1 1\n1 2\n2 3 4", "got": "8.0\n1 1\n1 4\n2 3 2"}, {"idx": 3, "reason": "wrong_answer", "expected": "5362337336.5\n1 19\n1 21\n1 3\n1 20\n1 1\n1 11\n15 15 14 13 10 7 4 2 6 8 12 16 5 18 17 9", "got": "5362337336.5\n1 19\n1 21\n1 20\n1 3\n1 1\n1 11\n15 15 14 13 10 7 ...
codeforces
B
269
161_B. Discounts
One day Polycarpus stopped by a supermarket on his way home. It turns out that the supermarket is having a special offer for stools. The offer is as follows: if a customer's shopping cart contains at least one stool, the customer gets a 50% discount on the cheapest item in the cart (that is, it becomes two times cheape...
python3
n, k = list(map(int, input().split())) p = [[], []] for i in range(1, n + 1): c, t = map(int, input().split()) p[t > 1].append((c, i)) if k > len(p[0]): l = k - len(p[0]) - 1 print(sum(c for c, i in p[0]) / 2 + sum(c for c, i in p[1])) print('\n'.join('1 ' + str(i) for c, i in p[0])) print('\n'....
partial
8
16
[{"idx": 2, "reason": "wrong_answer", "expected": "32.5\n1 10\n1 9\n1 5\n1 8\n1 7\n1 11\n1 6\n1 2\n1 1\n1 4\n1 3", "got": "32.5\n1 5\n1 7\n1 8\n1 9\n1 10\n1 1\n1 2\n1 3\n1 4\n1 6\n1 11"}, {"idx": 3, "reason": "wrong_answer", "expected": "5362337336.5\n1 19\n1 21\n1 3\n1 20\n1 1\n1 11\n15 15 14 13 10 7 4 2 6 8 12 16 5 1...
codeforces
B
269
161_B. Discounts
One day Polycarpus stopped by a supermarket on his way home. It turns out that the supermarket is having a special offer for stools. The offer is as follows: if a customer's shopping cart contains at least one stool, the customer gets a 50% discount on the cheapest item in the cart (that is, it becomes two times cheape...
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.wri...
partial
11
16
[{"idx": 2, "reason": "wrong_answer", "expected": "32.5\n1 10\n1 9\n1 5\n1 8\n1 7\n1 11\n1 6\n1 2\n1 1\n1 4\n1 3", "got": "32.5\n1 10\n1 9\n1 5\n1 8\n1 7\n1 1\n1 2\n1 3\n1 4\n1 6\n1 11"}, {"idx": 3, "reason": "wrong_answer", "expected": "5362337336.5\n1 19\n1 21\n1 3\n1 20\n1 1\n1 11\n15 15 14 13 10 7 4 2 6 8 12 16 5 1...
codeforces
B
271
203_E. Transportation
Valera came to Japan and bought many robots for his research. He's already at the airport, the plane will fly very soon and Valera urgently needs to bring all robots to the luggage compartment. The robots are self-propelled (they can potentially move on their own), some of them even have compartments to carry other ro...
java
//package round128; import java.io.ByteArrayInputStream; import java.io.IOException; import java.io.InputStream; import java.io.PrintWriter; import java.util.Arrays; import java.util.Comparator; public class E3 { InputStream is; PrintWriter out; String INPUT = ""; void solve() { int n = ni(), d = ni(); long...
all_fail
0
13
[{"idx": 0, "reason": "runtime_error", "rc": 1, "stderr": "Exception in thread \"main\" java.lang.NegativeArraySizeException: -49\n\tat E3.solve(E3.java:18)\n\tat E3.run(E3.java:113)\n\tat E3.main(E3.java:120)\n", "stdout_tail": ""}, {"idx": 1, "reason": "runtime_error", "rc": 1, "stderr": "Exception in thread \"main\"...
codeforces
E
272
252_B. Unsorting Array
Little Petya likes arrays of integers a lot. Recently his mother has presented him one such array consisting of n elements. Petya is now wondering whether he can swap any two distinct integers in the array so that the array got unsorted. Please note that Petya can not swap equal integers even if they are in distinct po...
java
import java.io.OutputStream; import java.io.IOException; import java.io.InputStream; import java.io.PrintWriter; import java.util.StringTokenizer; import java.io.IOException; import java.io.BufferedReader; import java.io.InputStreamReader; import java.io.InputStream; /** * Built using CHelper plug-in * Actual soluti...
partial
18
25
[{"idx": 7, "reason": "wrong_answer", "expected": "4 5", "got": "2 5"}, {"idx": 15, "reason": "wrong_answer", "expected": "2 3", "got": "1 3"}, {"idx": 16, "reason": "wrong_answer", "expected": "2 3", "got": "1 3"}, {"idx": 17, "reason": "wrong_answer", "expected": "2 3", "got": "1 3"}, {"idx": 21, "reason": "wrong_ans...
codeforces
B
272
252_B. Unsorting Array
Little Petya likes arrays of integers a lot. Recently his mother has presented him one such array consisting of n elements. Petya is now wondering whether he can swap any two distinct integers in the array so that the array got unsorted. Please note that Petya can not swap equal integers even if they are in distinct po...
cpp
#include <bits/stdc++.h> using namespace std; long long int modpow(long long int a, long long int n, long long int temp) { long long int res = 1, y = a; while (n > 0) { if (n & 1) res = (res * y) % temp; y = (y * y) % temp; n /= 2; } return res % temp; } vector<int> arr; int track[1000006], cnt[3]; ...
partial
6
25
[{"idx": 3, "reason": "wrong_answer", "expected": "1 2", "got": "2 1"}, {"idx": 6, "reason": "wrong_answer", "expected": "2 3", "got": "3 2"}, {"idx": 7, "reason": "wrong_answer", "expected": "4 5", "got": "5 4"}, {"idx": 9, "reason": "wrong_answer", "expected": "1 2", "got": "2 1"}, {"idx": 10, "reason": "wrong_answer...
codeforces
B
272
252_B. Unsorting Array
Little Petya likes arrays of integers a lot. Recently his mother has presented him one such array consisting of n elements. Petya is now wondering whether he can swap any two distinct integers in the array so that the array got unsorted. Please note that Petya can not swap equal integers even if they are in distinct po...
java
import java.io.*; import java.util.*; import java.math.*; public class p252a { public static void main(String[] args) { Scanner sc = new Scanner(System.in); int n = sc.nextInt(); int[] arr = new int[n]; for (int i = 0; i < n; ++i) { arr[i] = sc.nextInt(); } ...
partial
21
25
[{"idx": 15, "reason": "wrong_answer", "expected": "2 3", "got": "1 3"}, {"idx": 16, "reason": "wrong_answer", "expected": "2 3", "got": "1 3"}, {"idx": 17, "reason": "wrong_answer", "expected": "2 3", "got": "1 3"}, {"idx": 24, "reason": "wrong_answer", "expected": "2 3", "got": "1 3"}]
codeforces
B
272
252_B. Unsorting Array
Little Petya likes arrays of integers a lot. Recently his mother has presented him one such array consisting of n elements. Petya is now wondering whether he can swap any two distinct integers in the array so that the array got unsorted. Please note that Petya can not swap equal integers even if they are in distinct po...
java
import java.awt.Point; import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.util.ArrayList; import java.util.Arrays; import java.util.Collections; import java.util.Comparator; import java.util.List; import java.util.Scanner; import java.util.StringTokenizer; public c...
partial
12
25
[{"idx": 3, "reason": "wrong_answer", "expected": "1 2", "got": "4 3"}, {"idx": 6, "reason": "wrong_answer", "expected": "2 3", "got": "3 4"}, {"idx": 7, "reason": "wrong_answer", "expected": "4 5", "got": "5 4"}, {"idx": 9, "reason": "wrong_answer", "expected": "1 2", "got": "4 5"}, {"idx": 12, "reason": "wrong_answer...
codeforces
B
272
252_B. Unsorting Array
Little Petya likes arrays of integers a lot. Recently his mother has presented him one such array consisting of n elements. Petya is now wondering whether he can swap any two distinct integers in the array so that the array got unsorted. Please note that Petya can not swap equal integers even if they are in distinct po...
python3
n=int(input()) a=[int(i) for i in input().split()] b=len(set(a)) c=sorted(a,reverse=True) if n==1 or n==2 or b==1: print("-1") elif n==3: if b==2: if a[0]==a[2]: print("-1") elif a[0]==a[1]: print("2 3") else: print("1 2") elif a[1]!=max(a[0],a[1],...
partial
14
25
[{"idx": 3, "reason": "wrong_answer", "expected": "1 2", "got": "4 3"}, {"idx": 7, "reason": "wrong_answer", "expected": "4 5", "got": "5 2"}, {"idx": 9, "reason": "wrong_answer", "expected": "1 2", "got": "1 3"}, {"idx": 11, "reason": "wrong_answer", "expected": "1 2", "got": "1 3"}, {"idx": 15, "reason": "wrong_answe...
codeforces
B
272
252_B. Unsorting Array
Little Petya likes arrays of integers a lot. Recently his mother has presented him one such array consisting of n elements. Petya is now wondering whether he can swap any two distinct integers in the array so that the array got unsorted. Please note that Petya can not swap equal integers even if they are in distinct po...
python2
n = input() array = [int(x) for x in raw_input().split()] if n < 3: print -1 exit() s = set(array) if len(s) == 1: print -1 elif len(s) == 2: if len(array) <= 2: print -1 elif len(array) == 3: if array[0] == array[1]: print 2, 3 elif array[1] == array[2]: ...
partial
22
25
[{"idx": 7, "reason": "wrong_answer", "expected": "4 5", "got": "2 5"}, {"idx": 21, "reason": "wrong_answer", "expected": "3 4", "got": "2 4"}, {"idx": 23, "reason": "wrong_answer", "expected": "3 4", "got": "2 4"}]
codeforces
B
272
252_B. Unsorting Array
Little Petya likes arrays of integers a lot. Recently his mother has presented him one such array consisting of n elements. Petya is now wondering whether he can swap any two distinct integers in the array so that the array got unsorted. Please note that Petya can not swap equal integers even if they are in distinct po...
python2
from collections import defaultdict n = int(raw_input()) array = map(int, raw_input().split()) elements = defaultdict(int) asc = sorted(array) des = sorted(array, reverse=True) asc_count = 0 des_count = 0 for i in range(len(array)): elements[array[i]] = i if array[i] != asc[i]: asc_count += 1 if ar...
partial
11
25
[{"idx": 7, "reason": "wrong_answer", "expected": "4 5", "got": "2 5"}, {"idx": 9, "reason": "wrong_answer", "expected": "1 2", "got": "1 5"}, {"idx": 10, "reason": "wrong_answer", "expected": "1 2", "got": "2 1"}, {"idx": 13, "reason": "wrong_answer", "expected": "1 2", "got": "2 1"}, {"idx": 15, "reason": "wrong_answ...
codeforces
B
272
252_B. Unsorting Array
Little Petya likes arrays of integers a lot. Recently his mother has presented him one such array consisting of n elements. Petya is now wondering whether he can swap any two distinct integers in the array so that the array got unsorted. Please note that Petya can not swap equal integers even if they are in distinct po...
python3
import random import sys n=int(sys.stdin.readline()) L=list(map(int,sys.stdin.readline().split())) X=sorted(L) XX=sorted(L,reverse=True) K={} for i in range(n): item=L[i] if(item in K): K[item].append(i) else: K[item]=[i] if(len(X)<=2 or X[0]==X[-1] or (len(X)==3 and (L==[X[0],X[-1],X[0]] ...
partial
11
25
[{"idx": 3, "reason": "wrong_answer", "expected": "1 2", "got": "1 4"}, {"idx": 9, "reason": "wrong_answer", "expected": "1 2", "got": "1 4"}, {"idx": 10, "reason": "wrong_answer", "expected": "1 2", "got": "1 3"}, {"idx": 11, "reason": "wrong_answer", "expected": "1 2", "got": "4 1"}, {"idx": 12, "reason": "wrong_answ...
codeforces
B
272
252_B. Unsorting Array
Little Petya likes arrays of integers a lot. Recently his mother has presented him one such array consisting of n elements. Petya is now wondering whether he can swap any two distinct integers in the array so that the array got unsorted. Please note that Petya can not swap equal integers even if they are in distinct po...
python2
n = input() num = map( int, raw_input().split()) if n<3 or n==3 and num[0]==num[2] or min(num) == max(num): print -1 else: if num[0]==num[1]: for i, m in enumerate(num): if m != num[0]: print 2,i+1 break else: if num[1]==num[2]: print 1,2 elif num[1] <= num[0] and num[0] <=...
partial
21
25
[{"idx": 7, "reason": "wrong_answer", "expected": "4 5", "got": "2 5"}, {"idx": 19, "reason": "wrong_answer", "expected": "1 2", "got": "2 3"}, {"idx": 21, "reason": "wrong_answer", "expected": "3 4", "got": "2 4"}, {"idx": 23, "reason": "wrong_answer", "expected": "3 4", "got": "2 4"}]
codeforces
B
272
252_B. Unsorting Array
Little Petya likes arrays of integers a lot. Recently his mother has presented him one such array consisting of n elements. Petya is now wondering whether he can swap any two distinct integers in the array so that the array got unsorted. Please note that Petya can not swap equal integers even if they are in distinct po...
python3
import sys n = int(input()) a = [int(s) for s in input().split()] for i in range(0,2): for j in range(i+1,n): if a[i] != a[j]: r = a[j] a[j] = a[i] a[i] = r lol = True lol1 = True for h in range(1,n): if a[h-1] > a[h]: ...
partial
18
25
[{"idx": 7, "reason": "wrong_answer", "expected": "4 5", "got": "2 5"}, {"idx": 15, "reason": "wrong_answer", "expected": "2 3", "got": "1 3"}, {"idx": 16, "reason": "wrong_answer", "expected": "2 3", "got": "1 3"}, {"idx": 17, "reason": "wrong_answer", "expected": "2 3", "got": "1 3"}, {"idx": 21, "reason": "wrong_ans...
codeforces
B
273
277_C. Game
Two players play the following game. Initially, the players have a knife and a rectangular sheet of paper, divided into equal square grid cells of unit size. The players make moves in turn, the player who can't make a move loses. In one move, a player can take the knife and cut the paper along any segment of the grid l...
cpp
#include <bits/stdc++.h> #pragma comment(linker, "/STACK:32000000") using namespace std; const int MAX = 200000; const int INF = 100000000; const int MOD = 1000000007; const double EPS = 1E-7; const int IT = 10024; map<int, vector<pair<int, int> > > r; map<int, vector<pair<int, int> > > c; map<int, int> R; map<int, int...
partial
24
25
[{"idx": 22, "reason": "wrong_answer", "expected": "FIRST\n1 0 1 11", "got": "FIRST\n4 0 4 3"}]
codeforces
C
273
277_C. Game
Two players play the following game. Initially, the players have a knife and a rectangular sheet of paper, divided into equal square grid cells of unit size. The players make moves in turn, the player who can't make a move loses. In one move, a player can take the knife and cut the paper along any segment of the grid l...
cpp
#include <bits/stdc++.h> using namespace std; int n, m, k; int nn, mm; typedef struct { int x, s, e; } ele; int cmp(ele a, ele b) { return a.x < b.x || (a.x == b.x && a.s < b.s); } vector<ele> a[2]; template <class T> int dcdc(T s, T e, int x) { ele l = *s; s++; for (; s != e; s++) { if (l.e >= s->s) { ...
partial
24
25
[{"idx": 22, "reason": "wrong_answer", "expected": "FIRST\n1 0 1 11", "got": "FIRST\n4 0 4 3"}]
codeforces
C
273
277_C. Game
Two players play the following game. Initially, the players have a knife and a rectangular sheet of paper, divided into equal square grid cells of unit size. The players make moves in turn, the player who can't make a move loses. In one move, a player can take the knife and cut the paper along any segment of the grid l...
cpp
#include <bits/stdc++.h> using namespace std; template <class T> T sqr(T x) { return x * x; } const int INF = 1000 * 1000 * 1000; const long long INF64 = sqr(static_cast<long long>(INF)); const double PI = acos(-1.0); const int K = 200500; long long n, m; long long mex; int k, a, b, c; pair<long long, pair<long long,...
partial
21
25
[{"idx": 8, "reason": "wrong_answer", "expected": "FIRST\n2 0 2 3", "got": "FIRST\n0 3 3 3"}, {"idx": 16, "reason": "wrong_answer", "expected": "FIRST\n2 0 2 5", "got": "FIRST\n0 2 5 2"}, {"idx": 22, "reason": "wrong_answer", "expected": "FIRST\n1 0 1 11", "got": "FIRST\n0 1 10 1"}, {"idx": 23, "reason": "wrong_answer"...
codeforces
C
273
277_C. Game
Two players play the following game. Initially, the players have a knife and a rectangular sheet of paper, divided into equal square grid cells of unit size. The players make moves in turn, the player who can't make a move loses. In one move, a player can take the knife and cut the paper along any segment of the grid l...
java
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.io.PrintWriter; import java.util.Arrays; import java.util.Comparator; import java.util.StringTokenizer; public class E { BufferedReader reader; StringTokenizer tokenizer; PrintWriter out; public...
partial
21
25
[{"idx": 8, "reason": "wrong_answer", "expected": "FIRST\n2 0 2 3", "got": "FIRST\n0 3 3 3"}, {"idx": 16, "reason": "wrong_answer", "expected": "FIRST\n2 0 2 5", "got": "FIRST\n0 2 5 2"}, {"idx": 22, "reason": "wrong_answer", "expected": "FIRST\n1 0 1 11", "got": "FIRST\n0 1 10 1"}, {"idx": 23, "reason": "wrong_answer"...
codeforces
C
273
277_C. Game
Two players play the following game. Initially, the players have a knife and a rectangular sheet of paper, divided into equal square grid cells of unit size. The players make moves in turn, the player who can't make a move loses. In one move, a player can take the knife and cut the paper along any segment of the grid l...
java
import java.io.BufferedReader; import java.io.FileNotFoundException; import java.io.FileReader; import java.io.IOException; import java.io.InputStreamReader; import java.util.ArrayList; import java.util.Collections; import java.util.TreeMap; import java.util.HashSet; import java.util.List; import java.util.Map; impor...
partial
19
25
[{"idx": 4, "reason": "wrong_answer", "expected": "FIRST\n0 3 3 3", "got": "FIRST\n0 3 4 3"}, {"idx": 8, "reason": "wrong_answer", "expected": "FIRST\n2 0 2 3", "got": "FIRST\n0 3 3 3"}, {"idx": 16, "reason": "wrong_answer", "expected": "FIRST\n2 0 2 5", "got": "FIRST\n0 2 5 2"}, {"idx": 20, "reason": "wrong_answer", "...
codeforces
C
273
277_C. Game
Two players play the following game. Initially, the players have a knife and a rectangular sheet of paper, divided into equal square grid cells of unit size. The players make moves in turn, the player who can't make a move loses. In one move, a player can take the knife and cut the paper along any segment of the grid l...
python2
from sys import stdin from collections import defaultdict def emp(l, a): cnt = pos = x = 0 for y in a: if y[1]: cnt -= 1 else: if not cnt: x += y[0] - pos cnt += 1 pos = y[0] x += l - pos return x def check(x, b): return x ^...
partial
24
25
[{"idx": 22, "reason": "wrong_answer", "expected": "FIRST\n1 0 1 11", "got": "FIRST\n4 0 4 3"}]
codeforces
C
273
277_C. Game
Two players play the following game. Initially, the players have a knife and a rectangular sheet of paper, divided into equal square grid cells of unit size. The players make moves in turn, the player who can't make a move loses. In one move, a player can take the knife and cut the paper along any segment of the grid l...
python2
import sys def totalCut( cuts ) : cuts = sorted( cuts ) if not cuts : return 0 res = 0 rightmost = cuts[ 0 ][ 1 ] for cut in cuts : if cut[ 0 ] > rightmost : res += cut[ 0 ] - rightmost rightmost = max( rightmost , cut[ 1 ] ) return rightmost - cuts[ 0 ][ 0 ...
partial
22
25
[{"idx": 8, "reason": "wrong_answer", "expected": "FIRST\n2 0 2 3", "got": "FIRST\n0 3 3 3"}, {"idx": 16, "reason": "wrong_answer", "expected": "FIRST\n2 0 2 5", "got": "FIRST\n0 2 5 2"}, {"idx": 22, "reason": "wrong_answer", "expected": "FIRST\n1 0 1 11", "got": "FIRST\n0 1 10 1"}]
codeforces
C
274
29_E. Quarrel
Friends Alex and Bob live in Bertown. In this town there are n crossroads, some of them are connected by bidirectional roads of equal length. Bob lives in a house at the crossroads number 1, Alex — in a house at the crossroads number n. One day Alex and Bob had a big quarrel, and they refused to see each other. It occ...
cpp
#include <bits/stdc++.h> using namespace std; const long long N = 3e3 + 100, OO = 1e12 + 7, M = 1e9 + 7, P = 6151, sq = 500, lg = 23; vector<long long> v[N]; pair<long long, long long> pr[N][N]; bool is[N][N]; int32_t main() { ios::sync_with_stdio(false), cin.tie(0), cout.tie(0); long long n, m; c...
partial
3
7
[{"idx": 2, "reason": "wrong_answer", "expected": "6\n1 2 3 4 3 2 7\n7 6 7 2 1 5 1", "got": "6\n1 5 1 2 7 6 7\n7 2 3 4 3 2 1"}, {"idx": 3, "reason": "wrong_answer", "expected": "3\n1 2 9 10\n10 3 2 1", "got": "3\n1 2 3 10\n10 9 2 1"}, {"idx": 4, "reason": "wrong_answer", "expected": "3\n1 3 2 5\n5 2 4 1", "got": "3\n1 ...
codeforces
E
274
29_E. Quarrel
Friends Alex and Bob live in Bertown. In this town there are n crossroads, some of them are connected by bidirectional roads of equal length. Bob lives in a house at the crossroads number 1, Alex — in a house at the crossroads number n. One day Alex and Bob had a big quarrel, and they refused to see each other. It occ...
java
import java.util.*; public class Main { public static void main(String[] args) { Scanner sc = new Scanner(System.in); int n = sc.nextInt(); int m = sc.nextInt(); //Initialize data structure for graph //Since all the roads have equal length, it is unweighted. ArrayList<ArrayList<Integer>> roads = new...
partial
6
7
[{"idx": 2, "reason": "wrong_answer", "expected": "6\n1 2 3 4 3 2 7\n7 6 7 2 1 5 1", "got": "6\n1 5 1 2 7 6 7\n7 2 3 4 3 2 1"}]
codeforces
E
278
392_D. Three Arrays
There are three arrays a, b and c. Each of them consists of n integers. SmallY wants to find three integers u, v, w (0 ≤ u, v, w ≤ n) such that the following condition holds: each number that appears in the union of a, b and c, appears either in the first u elements of a, or in the first v elements of b, or in the firs...
cpp
#include <bits/stdc++.h> using namespace std; struct Tnode { int x, y, z; } doing[1000050]; struct Type { int pos, val, size; Type *father, *son[2]; Type() {} Type(Type *f, int p, int v, int s) { pos = p; val = v; size = s; father = f; son[0] = son[1] = 0; } } memory[1000050], *root; str...
compile_error
0
0
COMPILE_ERROR:/tmp/sbx_5gqbmypn/tmp05jiw95_.cpp: In function ‘int Half(int)’: /tmp/sbx_5gqbmypn/tmp05jiw95_.cpp:30:9: error: reference to ‘data’ is ambiguous 30 | if (data[mid] <= ask) { | ^~~~ In file included from /usr/include/c++/11/string:54, from /usr/include/c++/11/bits/local...
[]
codeforces
D
281
464_D. World of Darkraft - 2
Roma found a new character in the game "World of Darkraft - 2". In this game the character fights monsters, finds the more and more advanced stuff that lets him fight stronger monsters. The character can equip himself with k distinct types of items. Power of each item depends on its level (positive integer number). In...
cpp
#include <bits/stdc++.h> using namespace std; void enable_comma() {} string tostring(char c) { string s = ""; s += c; return s; } string tostring(string s) { return "\"" + s + "\""; } string tostring(const char *c) { return tostring((string)c); } string tostring(long long x) { if (x < 0) return "-" + tostring(-...
partial
22
25
[{"idx": 5, "reason": "timeout"}, {"idx": 11, "reason": "timeout"}, {"idx": 23, "reason": "timeout"}]
codeforces
D
281
464_D. World of Darkraft - 2
Roma found a new character in the game "World of Darkraft - 2". In this game the character fights monsters, finds the more and more advanced stuff that lets him fight stronger monsters. The character can equip himself with k distinct types of items. Power of each item depends on its level (positive integer number). In...
java
import java.io.*; import java.util.*; import static java.lang.Math.*; import java.math.BigInteger; import static java.math.BigInteger.*; import static java.util.Arrays.*; import javax.xml.ws.Holder; //<editor-fold defaultstate="collapsed" desc="Main"> public class Task{ // https://netbeans.org/kb/73/java/editor-code...
compile_error
0
0
COMPILE_ERROR:/tmp/sbx_okm9ri93/Task.java:7: error: package javax.xml.ws does not exist import javax.xml.ws.Holder; ^ 1 error
[]
codeforces
D