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 |
|---|---|---|---|---|---|---|---|---|---|---|---|
611 | 840_B. Leha and another game about graph | Leha plays a computer game, where is on each level is given a connected graph with n vertices and m edges. Graph can contain multiple edges, but can not contain self loops. Each vertex has an integer di, which can be equal to 0, 1 or - 1. To pass the level, he needs to find a «good» subset of edges of the graph or say... | java | import java.io.*;
import java.util.*;
import java.math.*;
import java.lang.*;
import static java.lang.Math.*;
public class Main implements Runnable
{
static class InputReader
{
private InputStream stream;
private byte[] buf = new byte[1024];
private int curChar;
private int numChars;
private SpaceCharFi... | partial | 5 | 6 | [{"idx": 4, "reason": "wrong_answer", "expected": "2\n1\n2", "got": "2\n2\n1"}] | codeforces | B | |
611 | 840_B. Leha and another game about graph | Leha plays a computer game, where is on each level is given a connected graph with n vertices and m edges. Graph can contain multiple edges, but can not contain self loops. Each vertex has an integer di, which can be equal to 0, 1 or - 1. To pass the level, he needs to find a «good» subset of edges of the graph or say... | cpp | #include <bits/stdc++.h>
using namespace std;
vector<pair<int, int>> g[300007];
int d[300007];
bool used[300007];
vector<int> ans;
void dfs(int u) {
used[u] = true;
for (auto p : g[u]) {
auto v = p.first;
if (!used[v]) {
dfs(v);
if (d[v] == 1) {
ans.push_back(p.second);
d[u] ^= 1... | partial | 5 | 6 | [{"idx": 4, "reason": "wrong_answer", "expected": "2\n1\n2", "got": "2\n2\n1"}] | codeforces | B | |
611 | 840_B. Leha and another game about graph | Leha plays a computer game, where is on each level is given a connected graph with n vertices and m edges. Graph can contain multiple edges, but can not contain self loops. Each vertex has an integer di, which can be equal to 0, 1 or - 1. To pass the level, he needs to find a «good» subset of edges of the graph or say... | java | import java.io.*;
import java.util.*;
public class Codeforces841D {
public static void main(String[] args) throws IOException {
BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
PrintWriter pw = new PrintWriter(System.out);
String[] sp = br.readLine().split(" ");
int n = Integer.parse... | partial | 4 | 6 | [{"idx": 0, "reason": "wrong_answer", "expected": "1\n2", "got": "2\n3\n1"}, {"idx": 4, "reason": "wrong_answer", "expected": "2\n1\n2", "got": "2\n2\n1"}] | codeforces | B | |
611 | 840_B. Leha and another game about graph | Leha plays a computer game, where is on each level is given a connected graph with n vertices and m edges. Graph can contain multiple edges, but can not contain self loops. Each vertex has an integer di, which can be equal to 0, 1 or - 1. To pass the level, he needs to find a «good» subset of edges of the graph or say... | python2 | from collections import deque
def subtree_specs(graph, d, node, visited, edges_dict, res_edges):
num_ones = 0
for nb in graph[node]:
if not visited[nb]:
visited[nb] = True
res = subtree_specs(graph, d, nb, visited, edges_dict, res_edges)
if res % 2 == 1:
... | partial | 4 | 6 | [{"idx": 0, "reason": "wrong_answer", "expected": "1\n2", "got": "2\n1\n3"}, {"idx": 4, "reason": "wrong_answer", "expected": "2\n1\n2", "got": "2\n2\n1"}] | codeforces | B | |
611 | 840_B. Leha and another game about graph | Leha plays a computer game, where is on each level is given a connected graph with n vertices and m edges. Graph can contain multiple edges, but can not contain self loops. Each vertex has an integer di, which can be equal to 0, 1 or - 1. To pass the level, he needs to find a «good» subset of edges of the graph or say... | python3 | import os,io
input=io.BytesIO(os.read(0,os.fstat(0).st_size)).readline
import sys
import heapq
INF=10**9
def Dijkstra(graph, start,m):
dist=[INF]*len(graph)
parent=[INF]*len(graph)
queue=[(0, start)]
while queue:
path_len, v=heapq.heappop(queue)
if dist[v]==INF:
dist[v]=path_len
for w in gra... | all_fail | 0 | 6 | [{"idx": 0, "reason": "runtime_error", "rc": 1, "stderr": "Traceback (most recent call last):\n File \"/tmp/sbx_xwdwh9v6/tmpo6mioqi4.py\", line 20, in <module>\n n,m=map(int,input().split())\n ^^^\nValueError: not enough values to unpack (expected 2, got 0)\n", "stdout_tail": ""}, {"idx": 1, "reason": "runtime_e... | codeforces | B | |
611 | 840_B. Leha and another game about graph | Leha plays a computer game, where is on each level is given a connected graph with n vertices and m edges. Graph can contain multiple edges, but can not contain self loops. Each vertex has an integer di, which can be equal to 0, 1 or - 1. To pass the level, he needs to find a «good» subset of edges of the graph or say... | python3 | # https://codeforces.com/problemset/problem/840/B
# TLE
import sys
input=sys.stdin.readline
n, m = map(int, input().split())
d = list(map(int, input().split()))
g={}
def push(g, u, v, i):
if u not in g:
g[u]=[]
if v not in g:
g[v]=[]
g[u].append([v, i+1])
g[v].append([u, i+1])
... | partial | 4 | 6 | [{"idx": 0, "reason": "wrong_answer", "expected": "1\n2", "got": "2\n3\n1"}, {"idx": 4, "reason": "wrong_answer", "expected": "2\n1\n2", "got": "2\n2\n1"}] | codeforces | B | |
612 | 860_C. Tests Renumeration | The All-Berland National Olympiad in Informatics has just ended! Now Vladimir wants to upload the contest from the Olympiad as a gym to a popular Codehorses website.
Unfortunately, the archive with Olympiad's data is a mess. For example, the files with tests are named arbitrary without any logic.
Vladimir wants to re... | cpp | #include <bits/stdc++.h>
using namespace std;
template <class htpe, class cmp>
using heap = priority_queue<htpe, vector<htpe>, cmp>;
template <class htpe>
using min_heap = heap<htpe, greater<htpe> >;
template <class htpe>
using max_heap = heap<htpe, less<htpe> >;
const int INF = 1791791791;
const long long INFLL = 1791... | partial | 15 | 25 | [{"idx": 1, "reason": "wrong_answer", "expected": "3\nmove 1 3\nmove 2 1\nmove 3 2", "got": "3\nmove 1 yxhjwj\nmove 2 1\nmove yxhjwj 2"}, {"idx": 5, "reason": "wrong_answer", "expected": "4\nmove 4 2\nmove 1 4\nmove 410jiy 1\nmove xc98l2 3", "got": "4\nmove 4 3\nmove 1 4\nmove 410jiy 1\nmove xc98l2 2"}, {"idx": 7, "rea... | codeforces | C | |
612 | 860_C. Tests Renumeration | The All-Berland National Olympiad in Informatics has just ended! Now Vladimir wants to upload the contest from the Olympiad as a gym to a popular Codehorses website.
Unfortunately, the archive with Olympiad's data is a mess. For example, the files with tests are named arbitrary without any logic.
Vladimir wants to re... | cpp | #include <bits/stdc++.h>
using namespace std;
const int MOD = 1000000007;
void yes() {
cout << "Yes"
<< "\n";
}
void no() {
cout << "No"
<< "\n";
}
struct Sync_stdio {
Sync_stdio() {
cin.tie(NULL);
ios_base::sync_with_stdio(false);
}
} _sync_stdio;
struct FAIL {
FAIL() {
cout << "CHA... | partial | 6 | 25 | [{"idx": 0, "reason": "wrong_answer", "expected": "4\nmove 3 1\nmove 01 3\nmove 2extra 4\nmove 99 5", "got": "4\nmove 3 1\nmove 99 3\nmove 2extra 4\nmove 01 5"}, {"idx": 1, "reason": "wrong_answer", "expected": "3\nmove 1 3\nmove 2 1\nmove 3 2", "got": "3\nmove 1 a\nmove 2 1\nmove a 2"}, {"idx": 2, "reason": "wrong_ans... | codeforces | C | |
612 | 860_C. Tests Renumeration | The All-Berland National Olympiad in Informatics has just ended! Now Vladimir wants to upload the contest from the Olympiad as a gym to a popular Codehorses website.
Unfortunately, the archive with Olympiad's data is a mess. For example, the files with tests are named arbitrary without any logic.
Vladimir wants to re... | cpp | #include <bits/stdc++.h>
using namespace std;
int n;
int chk[100005];
int idx[100005];
pair<string, int> arr[100005];
int calc(string str) {
bool flag = false;
for (int i = 0; i < str.size(); i++)
if (!(str[i] >= '0' && str[i] <= '9')) flag = true;
if (flag) return -1;
int ret = stoi(str);
if (to_string(r... | partial | 17 | 25 | [{"idx": 0, "reason": "wrong_answer", "expected": "4\nmove 3 1\nmove 01 3\nmove 2extra 4\nmove 99 5", "got": "4\nmove 01 4\nmove 3 1\nmove 2extra 5\nmove 99 3"}, {"idx": 2, "reason": "wrong_answer", "expected": "5\nmove 1 3\nmove 11 1\nmove 111 4\nmove 1111 2\nmove 11111 5", "got": "5\nmove 1 3\nmove 11 2\nmove 111 4\n... | codeforces | C | |
612 | 860_C. Tests Renumeration | The All-Berland National Olympiad in Informatics has just ended! Now Vladimir wants to upload the contest from the Olympiad as a gym to a popular Codehorses website.
Unfortunately, the archive with Olympiad's data is a mess. For example, the files with tests are named arbitrary without any logic.
Vladimir wants to re... | python2 | from sys import stdin
from random import randint
def main():
n = int(stdin.readline())
e = set()
r = set()
for line in stdin:
s, l = line.split()
if l == '1':
e.add(s)
else:
r.add(s)
en = len(e)
es = set(map(str, xrange(1, en + 1)))
rs = set(ma... | partial | 5 | 25 | [{"idx": 0, "reason": "wrong_answer", "expected": "4\nmove 3 1\nmove 01 3\nmove 2extra 4\nmove 99 5", "got": "4\nmove 3 1\nmove 99 3\nmove 2extra 5\nmove 01 4"}, {"idx": 1, "reason": "wrong_answer", "expected": "3\nmove 1 3\nmove 2 1\nmove 3 2", "got": "3\nmove 2 a\nmove 1 2\nmove a 1"}, {"idx": 2, "reason": "wrong_ans... | codeforces | C | |
612 | 860_C. Tests Renumeration | The All-Berland National Olympiad in Informatics has just ended! Now Vladimir wants to upload the contest from the Olympiad as a gym to a popular Codehorses website.
Unfortunately, the archive with Olympiad's data is a mess. For example, the files with tests are named arbitrary without any logic.
Vladimir wants to re... | 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
def LI(): return [int(x) for x in sys.stdin.readline().split()]
def LI_(): return [int(x)-1 for x in sys.stdin.readline().split()]
def LF()... | partial | 6 | 25 | [{"idx": 1, "reason": "wrong_answer", "expected": "3\nmove 1 3\nmove 2 1\nmove 3 2", "got": "3\nmove 2 iehn00\nmove 1 2\nmove iehn00 1"}, {"idx": 2, "reason": "wrong_answer", "expected": "5\nmove 1 3\nmove 11 1\nmove 111 4\nmove 1111 2\nmove 11111 5", "got": "5\nmove 1111 2\nmove 1 4\nmove 11 1\nmove 11111 5\nmove 111 ... | codeforces | C | |
612 | 860_C. Tests Renumeration | The All-Berland National Olympiad in Informatics has just ended! Now Vladimir wants to upload the contest from the Olympiad as a gym to a popular Codehorses website.
Unfortunately, the archive with Olympiad's data is a mess. For example, the files with tests are named arbitrary without any logic.
Vladimir wants to re... | java | import java.io.BufferedReader;
import java.io.BufferedWriter;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.OutputStreamWriter;
import java.io.PrintWriter;
import java.util.ArrayDeque;
import java.util.ArrayList;
import java.util.StringTokenizer;
import java.util.TreeSet;
public class Di... | partial | 10 | 25 | [{"idx": 0, "reason": "wrong_answer", "expected": "4\nmove 3 1\nmove 01 3\nmove 2extra 4\nmove 99 5", "got": "4\nmove 3 1\nmove 01 4\nmove 2extra 5\nmove 99 3"}, {"idx": 1, "reason": "wrong_answer", "expected": "3\nmove 1 3\nmove 2 1\nmove 3 2", "got": "3\nmove 1 0\nmove 2 1\nmove 0 2"}, {"idx": 2, "reason": "wrong_ans... | codeforces | C | |
612 | 860_C. Tests Renumeration | The All-Berland National Olympiad in Informatics has just ended! Now Vladimir wants to upload the contest from the Olympiad as a gym to a popular Codehorses website.
Unfortunately, the archive with Olympiad's data is a mess. For example, the files with tests are named arbitrary without any logic.
Vladimir wants to re... | python3 | import random
def genTemp():
sl = ""
firstTime = True
while firstTime or sl in pre or sl in post:
sl = ""
firstTime = False
for i in range(6):
sl += chr(random.randint(ord("a"), ord("z")))
return sl
n = int(input())
e = 0
pre = set()
post = set()
for i in range(n):... | partial | 6 | 25 | [{"idx": 0, "reason": "wrong_answer", "expected": "4\nmove 3 1\nmove 01 3\nmove 2extra 4\nmove 99 5", "got": "4\nmove 3 1\nmove 2extra 4\nmove 99 5\nmove 01 3"}, {"idx": 1, "reason": "wrong_answer", "expected": "3\nmove 1 3\nmove 2 1\nmove 3 2", "got": "3\nmove 2 smdwpb\nmove 1 2\nmove smdwpb 1"}, {"idx": 2, "reason": ... | codeforces | C | |
612 | 860_C. Tests Renumeration | The All-Berland National Olympiad in Informatics has just ended! Now Vladimir wants to upload the contest from the Olympiad as a gym to a popular Codehorses website.
Unfortunately, the archive with Olympiad's data is a mess. For example, the files with tests are named arbitrary without any logic.
Vladimir wants to re... | java | import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.util.StringTokenizer;
import java.util.*;
public class Q434C {
BufferedReader reader;
StringTokenizer tokenizer;
PrintWriter out;
public void solve() throws IOException {... | partial | 10 | 25 | [{"idx": 0, "reason": "wrong_answer", "expected": "4\nmove 3 1\nmove 01 3\nmove 2extra 4\nmove 99 5", "got": "4\nmove 3 1\nmove 99 3\nmove 2extra 4\nmove 01 5"}, {"idx": 1, "reason": "wrong_answer", "expected": "3\nmove 1 3\nmove 2 1\nmove 3 2", "got": "3\nmove 2 3\nmove 1 2\nmove 3 1"}, {"idx": 2, "reason": "wrong_ans... | codeforces | C | |
612 | 860_C. Tests Renumeration | The All-Berland National Olympiad in Informatics has just ended! Now Vladimir wants to upload the contest from the Olympiad as a gym to a popular Codehorses website.
Unfortunately, the archive with Olympiad's data is a mess. For example, the files with tests are named arbitrary without any logic.
Vladimir wants to re... | java | import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.util.Arrays;
import java.util.Deque;
import java.util.ArrayList;
import java.io.OutputStreamWriter;
import java.io.OutputStream;
import java.io.PrintStream;
import java.util.Collection;
import java.io.IOException;
import ja... | partial | 8 | 25 | [{"idx": 0, "reason": "wrong_answer", "expected": "4\nmove 3 1\nmove 01 3\nmove 2extra 4\nmove 99 5", "got": "4\nmove 3 1\nmove 01 4\nmove 2extra 5\nmove 99 3"}, {"idx": 1, "reason": "wrong_answer", "expected": "3\nmove 1 3\nmove 2 1\nmove 3 2", "got": "3\nmove 1 dalt\nmove 2 1\nmove dalt 2"}, {"idx": 2, "reason": "wro... | codeforces | C | |
612 | 860_C. Tests Renumeration | The All-Berland National Olympiad in Informatics has just ended! Now Vladimir wants to upload the contest from the Olympiad as a gym to a popular Codehorses website.
Unfortunately, the archive with Olympiad's data is a mess. For example, the files with tests are named arbitrary without any logic.
Vladimir wants to re... | python3 | def print_all():
print(top)
print(free_top)
print(busy_top)
print(bottom)
print(free_bottom)
print(busy_bottom)
n = int(input())
top = set()
bottom = set()
for i in range(n):
name, type = input().split()
if type == '1':
top.add(name)
else:
bottom.add(name)
top_order... | partial | 8 | 25 | [{"idx": 0, "reason": "wrong_answer", "expected": "4\nmove 3 1\nmove 01 3\nmove 2extra 4\nmove 99 5", "got": "4\nmove 3 1\nmove 99 3\nmove 2extra 5\nmove 01 4"}, {"idx": 1, "reason": "wrong_answer", "expected": "3\nmove 1 3\nmove 2 1\nmove 3 2", "got": "3\nmove 1 rft330\nmove 2 1\nmove rft330 2"}, {"idx": 2, "reason": ... | codeforces | C | |
612 | 860_C. Tests Renumeration | The All-Berland National Olympiad in Informatics has just ended! Now Vladimir wants to upload the contest from the Olympiad as a gym to a popular Codehorses website.
Unfortunately, the archive with Olympiad's data is a mess. For example, the files with tests are named arbitrary without any logic.
Vladimir wants to re... | python2 | from sys import*
from random import*
def main():
n = int(stdin.readline())
e = set()
r = set()
for line in stdin:
s, l = line.split()
if l == '1':
e.add(s)
else:
r.add(s)
en = len(e)
es = set(map(str, xrange(1, en + 1)))
rs = set(map(str, xrang... | partial | 5 | 25 | [{"idx": 0, "reason": "wrong_answer", "expected": "4\nmove 3 1\nmove 01 3\nmove 2extra 4\nmove 99 5", "got": "4\nmove 3 1\nmove 99 3\nmove 2extra 5\nmove 01 4"}, {"idx": 1, "reason": "wrong_answer", "expected": "3\nmove 1 3\nmove 2 1\nmove 3 2", "got": "3\nmove 2 a\nmove 1 2\nmove a 1"}, {"idx": 2, "reason": "wrong_ans... | codeforces | C | |
614 | 90_B. African Crossword | An African crossword is a rectangular table n × m in size. Each cell of the table contains exactly one letter. This table (it is also referred to as grid) contains some encrypted word that needs to be decoded.
To solve the crossword you should cross out all repeated letters in rows and columns. In other words, a lette... | java | import java.io.*;
import java.util.*;
import javafx.util.Pair;
public class Main
{
public static void main(String[] args) throws IOException
{
BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
StringTokenizer st = new StringTokenizer(br.readLine());
int n = Integer.pa... | compile_error | 0 | 0 | COMPILE_ERROR:/tmp/sbx_gy_anbt3/Main.java:3: error: package javafx.util does not exist
import javafx.util.Pair;
^
1 error
| [] | codeforces | B |
615 | 958_F3. Lightsabers (hard) | There used to be unrest in the Galactic Senate. Several thousand solar systems had declared their intentions to leave the Republic. But fear not! Master Heidi was able to successfully select the Jedi Knights that have restored peace in the galaxy. However, she knows that evil never sleeps and a time may come when she w... | java | //package hel2018;
import java.io.ByteArrayInputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.Arrays;
import java.util.InputMismatchException;
import java.util.PriorityQueue;
public class F3 {
InputStream is;
PrintWriter out;
String INPUT = "";
void ... | all_fail | 0 | 25 | [{"idx": 0, "reason": "runtime_error", "rc": 1, "stderr": "Exception in thread \"main\" java.util.InputMismatchException\n\tat F3.readByte(F3.java:341)\n\tat F3.ni(F3.java:396)\n\tat F3.solve(F3.java:17)\n\tat F3.run(F3.java:329)\n\tat F3.main(F3.java:334)\n", "stdout_tail": ""}, {"idx": 1, "reason": "runtime_error", "... | codeforces | F | |
627 | p02578 AtCoder Beginner Contest 176 - Step | N persons are standing in a row. The height of the i-th person from the front is A_i.
We want to have each person stand on a stool of some heights - at least zero - so that the following condition is satisfied for every person:
Condition: Nobody in front of the person is taller than the person. Here, the height of a ... | python2 | import os
import sys
from atexit import register
from io import BytesIO
sys.stdin = BytesIO(os.read(0, os.fstat(0).st_size))
sys.stdout = BytesIO()
register(lambda: os.write(1, sys.stdout.getvalue()))
input = lambda: sys.stdin.readline().rstrip('\r\n')
raw_input = lambda: sys.stdin.readline().rstrip('\r\n')
n = int(in... | all_fail | 0 | 2 | [{"idx": 0, "reason": "runtime_error", "rc": 1, "stderr": "Traceback (most recent call last):\n File \"/tmp/sbx_l73wtm3c/tmp7fpd1ncq.py\", line 11, in <module>\n n = int(input())\nValueError: invalid literal for int() with base 10: ''\n", "stdout_tail": ""}, {"idx": 1, "reason": "runtime_error", "rc": 1, "stderr": ... | atcoder | UNKNOWN | |
634 | p03574 AtCoder Beginner Contest 075 - Minesweeper | You are given an H × W grid.
The squares in the grid are described by H strings, S_1,...,S_H.
The j-th character in the string S_i corresponds to the square at the i-th row from the top and j-th column from the left (1 \leq i \leq H,1 \leq j \leq W).
`.` stands for an empty square, and `#` stands for a square containin... | python3 | h,w = map(int,input().split())
grid = ["."*(w+2)]+["."+input()+"." for _ in range(h)]+["."*(w+2)]
for y in range(1,h+1):
for x in range(1,w+1):
if grid[y][x]=="#":
print("#",end="")
else:
print(sum(grid[i][j]=="#" for i in range(y-1,y+2) for j in range(x-1,x+2)),end="")
print("") | partial | 1 | 3 | [{"idx": 1, "reason": "runtime_error", "rc": 1, "stderr": "Traceback (most recent call last):\n File \"/tmp/sbx_9gpqbssg/tmpidmzczrh.py\", line 2, in <module>\n grid = [\".\"*(w+2)]+[\".\"+input()+\".\" for _ in range(h)]+[\".\"*(w+2)]\n ^^^", "stdout_tail": ""}, {"idx": 2, "reason": "run... | atcoder | UNKNOWN | |
634 | p03574 AtCoder Beginner Contest 075 - Minesweeper | You are given an H × W grid.
The squares in the grid are described by H strings, S_1,...,S_H.
The j-th character in the string S_i corresponds to the square at the i-th row from the top and j-th column from the left (1 \leq i \leq H,1 \leq j \leq W).
`.` stands for an empty square, and `#` stands for a square containin... | java | import java.util.*;
public class Main{
public static void main(String[] args){
Scanner sc = new Scanner(System.in);
int X = Integer.parseInt(sc.next());
int Y = Integer.parseInt(sc.next());
char S[][] = new char[50][50];
for(int x = 0; x < X; x++){
String s =... | partial | 1 | 3 | [{"idx": 1, "reason": "runtime_error", "rc": 1, "stderr": "Exception in thread \"main\" java.util.NoSuchElementException\n\tat java.base/java.util.Scanner.throwFor(Scanner.java:937)\n\tat java.base/java.util.Scanner.next(Scanner.java:1478)\n\tat Main.main(Main.java:1", "stdout_tail": ""}, {"idx": 2, "reason": "runtime_... | atcoder | UNKNOWN | |
634 | p03574 AtCoder Beginner Contest 075 - Minesweeper | You are given an H × W grid.
The squares in the grid are described by H strings, S_1,...,S_H.
The j-th character in the string S_i corresponds to the square at the i-th row from the top and j-th column from the left (1 \leq i \leq H,1 \leq j \leq W).
`.` stands for an empty square, and `#` stands for a square containin... | java | import java.util.*;
public class Main {
public static void main(String[] args){
Scanner sc = new Scanner(System.in);
int h = sc.nextInt();
int w = sc.nextInt();
char[][] board = new char[h][w];
for(int i =0; i < h; i++) {
String s = sc.next();
for(int k ... | partial | 1 | 3 | [{"idx": 1, "reason": "runtime_error", "rc": 1, "stderr": "Exception in thread \"main\" java.util.NoSuchElementException\n\tat java.base/java.util.Scanner.throwFor(Scanner.java:937)\n\tat java.base/java.util.Scanner.next(Scanner.java:1478)\n\tat Main.main(Main.java:9", "stdout_tail": ""}, {"idx": 2, "reason": "runtime_... | atcoder | UNKNOWN | |
634 | p03574 AtCoder Beginner Contest 075 - Minesweeper | You are given an H × W grid.
The squares in the grid are described by H strings, S_1,...,S_H.
The j-th character in the string S_i corresponds to the square at the i-th row from the top and j-th column from the left (1 \leq i \leq H,1 \leq j \leq W).
`.` stands for an empty square, and `#` stands for a square containin... | cpp | #include <iostream>
#include <string>
using namespace std;
int h, w;
string s[50];
int main() {
int i, j, di, dj;
cin >> h >> w;
for (i = 0; i < h; i++) cin >> s[i];
for (i = 0; i < h; i++) {
for (j = 0; j < w; j++) {
if (s[i][j] == '#') { cout << '#'; continue; }
int cnt = 0;
for (di = -1; di ... | partial | 1 | 3 | [{"idx": 1, "reason": "wrong_answer", "expected": "", "got": "00000\n00000\n00000"}, {"idx": 2, "reason": "wrong_answer", "expected": "3\n8#7##\n5#\n4#65#2\n5##21\n4#310", "got": "112221\n2#3##1\n3#4332\n3#42#1\n3##211\n2#3100"}] | atcoder | UNKNOWN | |
634 | p03574 AtCoder Beginner Contest 075 - Minesweeper | You are given an H × W grid.
The squares in the grid are described by H strings, S_1,...,S_H.
The j-th character in the string S_i corresponds to the square at the i-th row from the top and j-th column from the left (1 \leq i \leq H,1 \leq j \leq W).
`.` stands for an empty square, and `#` stands for a square containin... | java | import java.util.Scanner;
public class Main {
public static void main(String[] args) {
Scanner scan = new Scanner(System.in);
int h = scan.nextInt();
int w = scan.nextInt();
String[][] s = new String[h][w];
int i = 0;
int j = 0;
for(i = 0; i < h; i++) {
String str = scan.next();
for(j = 0; j < w;... | partial | 1 | 3 | [{"idx": 1, "reason": "runtime_error", "rc": 1, "stderr": "Exception in thread \"main\" java.util.NoSuchElementException\n\tat java.base/java.util.Scanner.throwFor(Scanner.java:937)\n\tat java.base/java.util.Scanner.next(Scanner.java:1478)\n\tat Main.main(Main.java:1", "stdout_tail": ""}, {"idx": 2, "reason": "runtime_... | atcoder | UNKNOWN | |
634 | p03574 AtCoder Beginner Contest 075 - Minesweeper | You are given an H × W grid.
The squares in the grid are described by H strings, S_1,...,S_H.
The j-th character in the string S_i corresponds to the square at the i-th row from the top and j-th column from the left (1 \leq i \leq H,1 \leq j \leq W).
`.` stands for an empty square, and `#` stands for a square containin... | cpp | #include<iostream>
using namespace std;
int x,y;
char ch;
bool bj[5001][5001];
int main()
{
cin>>x>>y;
for(int i=1;i<=x;i++)
for(int j=1;j<=y;j++)
{
cin>>ch;
bj[i][j]=(ch=='#');
}
for(int i=1;i<=x;i++)
{
for(int j=1;j<=y;j++)
{
if(bj[i][j]==0) cout<<bj[i-1][j]+bj[i+1][j]+bj[i][j-1]+bj[i][j+1]+bj[... | partial | 1 | 3 | [{"idx": 1, "reason": "wrong_answer", "expected": "", "got": "00000\n00000\n00000"}, {"idx": 2, "reason": "wrong_answer", "expected": "3\n8#7##\n5#\n4#65#2\n5##21\n4#310", "got": "12#3##\n2#4#53\n#34##1\n12#321\n011100\n000000"}] | atcoder | UNKNOWN | |
634 | p03574 AtCoder Beginner Contest 075 - Minesweeper | You are given an H × W grid.
The squares in the grid are described by H strings, S_1,...,S_H.
The j-th character in the string S_i corresponds to the square at the i-th row from the top and j-th column from the left (1 \leq i \leq H,1 \leq j \leq W).
`.` stands for an empty square, and `#` stands for a square containin... | python3 | import itertools
H,W = map(int, input().strip().split(' '))
S = [list('.'*(W+2))]
S += [list('.'+input().strip()+'.') for _ in range(H)]
S.append(list('.'*(W+2)))
for x,y in itertools.product(range(1,W+1), range(1,H+1)):
if S[y][x] == '#': continue
S[y][x] = sum([S[y+dy][x+dx] == '#' for dx,dy in itertools.produc... | partial | 1 | 3 | [{"idx": 1, "reason": "runtime_error", "rc": 1, "stderr": "Traceback (most recent call last):\n File \"/tmp/sbx_60qel4df/tmpq6686tqj.py\", line 5, in <module>\n S += [list('.'+input().strip()+'.') for _ in range(H)]\n ^^^^^^^\nEOFError: EOF wh", "stdout_tail": ""}, {"idx": 2, "reason": "runtime_er... | atcoder | UNKNOWN | |
634 | p03574 AtCoder Beginner Contest 075 - Minesweeper | You are given an H × W grid.
The squares in the grid are described by H strings, S_1,...,S_H.
The j-th character in the string S_i corresponds to the square at the i-th row from the top and j-th column from the left (1 \leq i \leq H,1 \leq j \leq W).
`.` stands for an empty square, and `#` stands for a square containin... | python3 | H, W = [int(i) for i in input().split()]
S = ['.' * (W + 2)]
for i in range(H):
S.append('.' + input() + '.')
S.append('.' * (W + 2))
mine = [[0 for _ in range(W)] for _ in range(H)]
for j in range(H):
for i in range(W):
if S[j + 1][i + 1] == '#':
mine[j][i] = '#'
else:
mine[j][i] = sum([s[i:i ... | partial | 1 | 3 | [{"idx": 1, "reason": "runtime_error", "rc": 1, "stderr": "Traceback (most recent call last):\n File \"/tmp/sbx_nudd7_ip/tmp8saef22p.py\", line 4, in <module>\n S.append('.' + input() + '.')\n ^^^^^^^\nEOFError: EOF when reading a line\n", "stdout_tail": ""}, {"idx": 2, "reason": "runtime_error", ... | atcoder | UNKNOWN | |
634 | p03574 AtCoder Beginner Contest 075 - Minesweeper | You are given an H × W grid.
The squares in the grid are described by H strings, S_1,...,S_H.
The j-th character in the string S_i corresponds to the square at the i-th row from the top and j-th column from the left (1 \leq i \leq H,1 \leq j \leq W).
`.` stands for an empty square, and `#` stands for a square containin... | python2 | import sys
H, W = map(int, raw_input().split())
S = [raw_input() for i in range(H)]
C = [[0] * W for i in range(H)]
for i in range(H):
for j in range(W):
for di in range(-1, 2):
if i + di < 0 or H <= i + di:
continue
for dj in range(-1, 2):
if j + dj <... | partial | 1 | 3 | [{"idx": 1, "reason": "runtime_error", "rc": 1, "stderr": "Traceback (most recent call last):\n File \"/tmp/sbx_u9e4aeek/tmp06qke51k.py\", line 3, in <module>\n S = [raw_input() for i in range(H)]\nEOFError: EOF when reading a line\n", "stdout_tail": ""}, {"idx": 2, "reason": "runtime_error", "rc": 1, "stderr": "Tr... | atcoder | UNKNOWN | |
634 | p03574 AtCoder Beginner Contest 075 - Minesweeper | You are given an H × W grid.
The squares in the grid are described by H strings, S_1,...,S_H.
The j-th character in the string S_i corresponds to the square at the i-th row from the top and j-th column from the left (1 \leq i \leq H,1 \leq j \leq W).
`.` stands for an empty square, and `#` stands for a square containin... | cpp | #include<cstdio>
#include<iostream>
using namespace std;
const int step[8][2]={-1,-1,-1,0,-1,1,0,-1,0,1,1,-1,1,0,1,1};
char a[55][55];
int s[55][55];
int n,m;
int main()
{
scanf("%d%d",&n,&m);
for(int i=1;i<=n;i++)
for(int j=1;j<=m;j++)
cin>>a[i][j];
for(int i=1;i<=n;i++)
for(int j=1;j<=m;j++)
if(a[i... | partial | 1 | 3 | [{"idx": 1, "reason": "wrong_answer", "expected": "", "got": "00000\n00000\n00000"}, {"idx": 2, "reason": "wrong_answer", "expected": "3\n8#7##\n5#\n4#65#2\n5##21\n4#310", "got": "12#3##\n2#4#53\n#34##1\n12#321\n000000\n000000"}] | atcoder | UNKNOWN | |
634 | p03574 AtCoder Beginner Contest 075 - Minesweeper | You are given an H × W grid.
The squares in the grid are described by H strings, S_1,...,S_H.
The j-th character in the string S_i corresponds to the square at the i-th row from the top and j-th column from the left (1 \leq i \leq H,1 \leq j \leq W).
`.` stands for an empty square, and `#` stands for a square containin... | python2 | H,W = map(int, raw_input().split())
S = [raw_input() for y in range(H)]
A = [list(s) for s in S]
for y in range(H):
for x in range(W):
if S[y][x]!='#':
c = 0
for dx in range(-1,2):
for dy in range(-1,2):
if (dx,dy)!=(0,0) and 0<=x+dx<W and 0<=y+dy<H and S[y+dy][x+dx]=='#':
... | partial | 1 | 3 | [{"idx": 1, "reason": "runtime_error", "rc": 1, "stderr": "Traceback (most recent call last):\n File \"/tmp/sbx_rb1zob8r/tmpuusj6_mh.py\", line 2, in <module>\n S = [raw_input() for y in range(H)]\nEOFError: EOF when reading a line\n", "stdout_tail": ""}, {"idx": 2, "reason": "runtime_error", "rc": 1, "stderr": "Tr... | atcoder | UNKNOWN | |
634 | p03574 AtCoder Beginner Contest 075 - Minesweeper | You are given an H × W grid.
The squares in the grid are described by H strings, S_1,...,S_H.
The j-th character in the string S_i corresponds to the square at the i-th row from the top and j-th column from the left (1 \leq i \leq H,1 \leq j \leq W).
`.` stands for an empty square, and `#` stands for a square containin... | python2 | import sys
def main():
H, W = map(int, raw_input().split(" "))
matrix = []
for _ in range(H):
matrix.append(list(raw_input()))
for i in range(H):
for j in range(W):
if matrix[i][j] == "#":
continue
num_bombs = 0
if i - 1 >= 0 and j -... | partial | 1 | 3 | [{"idx": 1, "reason": "runtime_error", "rc": 1, "stderr": "Traceback (most recent call last):\n File \"/tmp/sbx_fxru3c83/tmpshl9zpc7.py\", line 40, in <module>\n main()\n File \"/tmp/sbx_fxru3c83/tmpshl9zpc7.py\", line 7, in main\n matrix.append(list(raw_inpu", "stdout_tail": ""}, {"idx": 2, "reason": "runtime_... | atcoder | UNKNOWN | |
639 | p00451 Common Sub-String | problem
Given two strings, find the longest of the strings contained in both strings and write a program that answers that length.
Here, the string s included in the string t means that s appears consecutively in t. An empty string, that is, a string of length 0, is included in any string. For example, the string ABR... | cpp | #include<iostream>
#include<algorithm>
#include<string>
#include<vector>
#define int long long
#define mod 1000000007
using namespace std;
string s, t;
int dp[4005][4005], ans;
signed main() {
while (cin >> s >> t) {
for (int i = 0; i <= 4000; i++)for (int j = 0; j <= 4000; j++)dp[i][j] = 0;
ans = 0;
for (int i ... | partial | 1 | 2 | [{"idx": 0, "reason": "wrong_answer", "expected": "None", "got": ""}] | aizu | UNKNOWN | |
639 | p00451 Common Sub-String | problem
Given two strings, find the longest of the strings contained in both strings and write a program that answers that length.
Here, the string s included in the string t means that s appears consecutively in t. An empty string, that is, a string of length 0, is included in any string. For example, the string ABR... | cpp | #include<bits/stdc++.h>
using namespace std;
int main(){
string a,b;
int c,d;
int dp[2][5000],ans;
while(cin>>a>>b){
c=a.size(),d=b.size();
ans=0;
memset(dp,0,sizeof(dp));
for(int i=1;i<=c;i++){
for(int j=1;j<=d;j++){
int ni=i%2,ri=1-i%2;
//niは今のaの文字数が奇数か偶数か dpテーブルの使い回しのため
//riはniじゃない方←... | partial | 1 | 2 | [{"idx": 0, "reason": "wrong_answer", "expected": "None", "got": ""}] | aizu | UNKNOWN | |
639 | p00451 Common Sub-String | problem
Given two strings, find the longest of the strings contained in both strings and write a program that answers that length.
Here, the string s included in the string t means that s appears consecutively in t. An empty string, that is, a string of length 0, is included in any string. For example, the string ABR... | java | import java.util.Arrays;
import java.util.Comparator;
import java.util.Scanner;
public class Main {
/**
* @param args
*/
public static void main(String[] args) {
Scanner sc=new Scanner(System.in);
for(;sc.hasNext();){
String s = sc.next();
String t = sc.next();
SuffixArray sa = new SuffixArray(s);
... | partial | 1 | 2 | [{"idx": 0, "reason": "runtime_error", "rc": 1, "stderr": "Exception in thread \"main\" java.util.NoSuchElementException\n\tat java.base/java.util.Scanner.throwFor(Scanner.java:937)\n\tat java.base/java.util.Scanner.next(Scanner.java:1478)\n\tat Main.main(Main.java:1", "stdout_tail": ""}] | aizu | UNKNOWN | |
639 | p00451 Common Sub-String | problem
Given two strings, find the longest of the strings contained in both strings and write a program that answers that length.
Here, the string s included in the string t means that s appears consecutively in t. An empty string, that is, a string of length 0, is included in any string. For example, the string ABR... | python3 | def rolling_hash(S, base, MOD):
l = len(S)
h = [0]*(l + 1)
for i in range(l):
h[i+1] = (h[i] * base + ord(S[i])) % MOD
return h
C = open(0).read().split()
MOD = 358976445361682909
base = 31
for t in range(len(C)//2):
S = C[2*t]; T = C[2*t+1]
rhs = rolling_hash(S, base, MOD)
rht = r... | partial | 1 | 2 | [{"idx": 0, "reason": "wrong_answer", "expected": "None", "got": ""}] | aizu | UNKNOWN | |
639 | p00451 Common Sub-String | problem
Given two strings, find the longest of the strings contained in both strings and write a program that answers that length.
Here, the string s included in the string t means that s appears consecutively in t. An empty string, that is, a string of length 0, is included in any string. For example, the string ABR... | cpp | #include <bits/stdc++.h>
using namespace std;
int dp[4001][4001];
char s[4001],t[4001];
int main(){
while(scanf("%s%s",s,t) == 2){
int ans = 0;
int slen = strlen(s);
int tlen = strlen(t);
for(int i = 0; i < slen; i++){
if(s[i] == t[0]){
dp[0][i] = 1;
ans = 1;
}
else{
dp[0][i] = 0;
}
... | partial | 1 | 2 | [{"idx": 0, "reason": "wrong_answer", "expected": "None", "got": ""}] | aizu | UNKNOWN | |
639 | p00451 Common Sub-String | problem
Given two strings, find the longest of the strings contained in both strings and write a program that answers that length.
Here, the string s included in the string t means that s appears consecutively in t. An empty string, that is, a string of length 0, is included in any string. For example, the string ABR... | java | import java.util.Arrays;
import java.util.Scanner;
public class Main {
Scanner sc = new Scanner(System.in);
void run() {
while (sc.hasNext()) {
String s = sc.next();
String t = sc.next();
if (s.length() > t.length()) {
String tmp = s;
s = t;
t = tmp;
}
t += "_" + t;
int max = 0;
f... | partial | 1 | 2 | [{"idx": 0, "reason": "runtime_error", "rc": 1, "stderr": "Exception in thread \"main\" java.util.NoSuchElementException\n\tat java.base/java.util.Scanner.throwFor(Scanner.java:937)\n\tat java.base/java.util.Scanner.next(Scanner.java:1478)\n\tat Main.run(Main.java:10", "stdout_tail": ""}] | aizu | UNKNOWN | |
639 | p00451 Common Sub-String | problem
Given two strings, find the longest of the strings contained in both strings and write a program that answers that length.
Here, the string s included in the string t means that s appears consecutively in t. An empty string, that is, a string of length 0, is included in any string. For example, the string ABR... | java | import java.util.*;
import java.io.*;
import java.lang.*;
class Main{
public static void main(String args[])throws IOException{
BufferedReader in = new BufferedReader(new InputStreamReader(System.in));
String A,B;
while((A = in.readLine()) != null){
B = in.readLine();
String MA,MI;
if(A.length(... | partial | 1 | 2 | [{"idx": 0, "reason": "runtime_error", "rc": 1, "stderr": "Exception in thread \"main\" java.lang.NullPointerException: Cannot invoke \"String.length()\" because \"<local3>\" is null\n\tat Main.main(Main.java:14)\n", "stdout_tail": ""}] | aizu | UNKNOWN | |
639 | p00451 Common Sub-String | problem
Given two strings, find the longest of the strings contained in both strings and write a program that answers that length.
Here, the string s included in the string t means that s appears consecutively in t. An empty string, that is, a string of length 0, is included in any string. For example, the string ABR... | python2 | while 1:
try:
s1 = raw_input()
s2 = raw_input()
if len(s1) < len(s2): s1,s2 = s2,s1
l = sum(min(s1.count(i), s2.count(i)) for i in set(list(s1)) & set(list(s2)))
if l == 0: print 0; continue
ans = 0
for i in range(len(s2)):
if len(s2) - i <= ans: b... | partial | 1 | 2 | [{"idx": 0, "reason": "wrong_answer", "expected": "None", "got": ""}] | aizu | UNKNOWN | |
639 | p00451 Common Sub-String | problem
Given two strings, find the longest of the strings contained in both strings and write a program that answers that length.
Here, the string s included in the string t means that s appears consecutively in t. An empty string, that is, a string of length 0, is included in any string. For example, the string ABR... | python2 | while 1:
try:
s,t = raw_input(),raw_input()
if len(s) < len(t): s,t = t,s
ans = 0
for sp in range(len(t)):
if len(t) - sp <= ans:
break
for L in range(ans+1,len(t)-sp+1):
if t[sp:sp+L] in s:
ans = L
else:
break
print ans
except:
break | partial | 1 | 2 | [{"idx": 0, "reason": "wrong_answer", "expected": "None", "got": ""}] | aizu | UNKNOWN | |
639 | p00451 Common Sub-String | problem
Given two strings, find the longest of the strings contained in both strings and write a program that answers that length.
Here, the string s included in the string t means that s appears consecutively in t. An empty string, that is, a string of length 0, is included in any string. For example, the string ABR... | python2 | # coding:utf-8
from __future__ import division, print_function
try:
input = raw_input
range = xrange
except NameError:
pass
p, q = 10 ** 9 + 7, 0xffffffff
pow_p = [1]
for i in range(4010):
pow_p.append(pow_p[-1] * p & q)
def exists(a, b, k):
n, m = len(a), len(b)
s = [a[k + i] - a[i] * pow_p... | partial | 1 | 2 | [{"idx": 0, "reason": "wrong_answer", "expected": "None", "got": ""}] | aizu | UNKNOWN | |
639 | p00451 Common Sub-String | problem
Given two strings, find the longest of the strings contained in both strings and write a program that answers that length.
Here, the string s included in the string t means that s appears consecutively in t. An empty string, that is, a string of length 0, is included in any string. For example, the string ABR... | python3 | while 1:
try:s=input()
except:break
t=input()
if len(s)<len(t):s,t=t,s
a=sum(min(s.count(i),t.count(i)) for i in set(s)&set(t))
b=0
for x in range(len(t)):
if len(t)-x<=b:break
for y in range(b+1,min(a+1,len(t)-x+1)):
if t[x:x+y] in s:b=y
else:break
... | partial | 1 | 2 | [{"idx": 0, "reason": "runtime_error", "rc": 1, "stderr": "Traceback (most recent call last):\n File \"/tmp/sbx_vet6f5k_/tmptd2anl9z.py\", line 4, in <module>\n t=input()\n ^^^^^^^\nEOFError: EOF when reading a line\n", "stdout_tail": ""}] | aizu | UNKNOWN | |
639 | p00451 Common Sub-String | problem
Given two strings, find the longest of the strings contained in both strings and write a program that answers that length.
Here, the string s included in the string t means that s appears consecutively in t. An empty string, that is, a string of length 0, is included in any string. For example, the string ABR... | python3 | while True:
try:
s1 = input()
except EOFError:
break
s2 = input()
BASE = 27
MOD = 1000000007
def rolling_hash(s):
h_lst = [0]
for c in s:
h_lst.append((h_lst[-1] * BASE + ord(c)) % MOD)
return h_lst
h_lst1 = rolling_hash(s1)
h_lst2 ... | partial | 1 | 2 | [{"idx": 0, "reason": "runtime_error", "rc": 1, "stderr": "Traceback (most recent call last):\n File \"/tmp/sbx_swtie0l7/tmprjlvqktq.py\", line 6, in <module>\n s2 = input()\n ^^^^^^^\nEOFError: EOF when reading a line\n", "stdout_tail": ""}] | aizu | UNKNOWN | |
642 | p01051 Squid Ink | Problem
In recent years, turf wars have frequently occurred among squids. It is a recent squid fighting style that multiple squids form a team and fight with their own squid ink as a weapon.
There is still a turf war, and the battlefield is represented by an R × C grid. The squid Gesota, who is participating in the t... | cpp | #include <iostream>
#include <algorithm>
#define MAX_R 10000
#define MAX_C 30
#define INF 100000
using namespace std;
typedef pair<int, int> coordinate;
char field[MAX_R][MAX_C + 1];
bool used[MAX_R][MAX_C + 1];
int d[MAX_R][MAX_C + 1];
int dx[4] = { 1, 0, -1, 0 }, dy[4] = { 0, 1, 0, -1 };
int R, C;
coordinate start, g... | partial | 4 | 5 | [{"idx": 4, "reason": "wrong_answer", "expected": "10", "got": "8"}] | aizu | UNKNOWN | |
642 | p01051 Squid Ink | Problem
In recent years, turf wars have frequently occurred among squids. It is a recent squid fighting style that multiple squids form a team and fight with their own squid ink as a weapon.
There is still a turf war, and the battlefield is represented by an R × C grid. The squid Gesota, who is participating in the t... | cpp | #define _USE_MATH_DEFINES
#include <algorithm>
#include <cstdio>
#include <functional>
#include <iostream>
#include <cfloat>
#include <climits>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <map>
#include <queue>
#include <random>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#i... | partial | 4 | 5 | [{"idx": 4, "reason": "wrong_answer", "expected": "10", "got": "5"}] | aizu | UNKNOWN | |
642 | p01051 Squid Ink | Problem
In recent years, turf wars have frequently occurred among squids. It is a recent squid fighting style that multiple squids form a team and fight with their own squid ink as a weapon.
There is still a turf war, and the battlefield is represented by an R × C grid. The squid Gesota, who is participating in the t... | cpp | #include<bits/stdc++.h>
using namespace std;
#define INF (1 << 29)
int dx[] = {1, -1, 0, 0}, dy[] = {0, 0, 1, -1};
int H, W, d[1000], st, en;
char A[50][50];
struct edge
{
int to, cost;
};
typedef pair<int, int> P;
vector<edge> G[1000];
int main()
{
fill(d, d + 1000, INF);
cin >> H >> W;
for(int y = 0; y < H; ... | partial | 4 | 5 | [{"idx": 4, "reason": "wrong_answer", "expected": "10", "got": "8"}] | aizu | UNKNOWN | |
643 | p01650 Stack Maze | Problem Statement
There is a maze which can be described as a W \times H grid. The upper-left cell is denoted as (1, 1), and the lower-right cell is (W, H). You are now at the cell (1, 1) and have to go to the cell (W, H). However, you can only move to the right adjacent cell or to the lower adjacent cell. The followi... | cpp | #include "bits/stdc++.h"
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
const int INF = 1e9;
const ll LINF = 1e18;
template<class S,class T> ostream& operator << (ostream& out,const pair<S,T>& o){ out << "(" << o.first << "," << o.second << ")"; return out; }
template<c... | partial | 1 | 2 | [{"idx": 1, "reason": "timeout"}] | aizu | UNKNOWN | |
643 | p01650 Stack Maze | Problem Statement
There is a maze which can be described as a W \times H grid. The upper-left cell is denoted as (1, 1), and the lower-right cell is (W, H). You are now at the cell (1, 1) and have to go to the cell (W, H). However, you can only move to the right adjacent cell or to the lower adjacent cell. The followi... | cpp | #include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<ll, ll> P;
#define fi first
#define se second
#define repl(i,a,b) for(ll i=(ll)(a);i<(ll)(b);i++)
#define rep(i,n) repl(i,0,n)
#define all(x) (x).begin(),(x).end()
#define dbg(x) cout<<#x"="<<x<<endl
#defi... | partial | 1 | 2 | [{"idx": 1, "reason": "wrong_answer", "expected": "2\n0\n-1\n25\n25\n1\n25\n4", "got": "2\n0\n0\n25\n25\n1\n25\n4"}] | aizu | UNKNOWN | |
643 | p01650 Stack Maze | Problem Statement
There is a maze which can be described as a W \times H grid. The upper-left cell is denoted as (1, 1), and the lower-right cell is (W, H). You are now at the cell (1, 1) and have to go to the cell (W, H). However, you can only move to the right adjacent cell or to the lower adjacent cell. The followi... | cpp | #include <iostream>
#include <cstdio>
#include <vector>
#include <algorithm>
#include <complex>
#include <cstring>
#include <cstdlib>
#include <string>
#include <cmath>
#include <cassert>
#include <queue>
#include <set>
#include <map>
#include <valarray>
#include <bitset>
#include <stack>
#include <iomanip>
#include <f... | partial | 1 | 2 | [{"idx": 1, "reason": "timeout"}] | aizu | UNKNOWN | |
643 | p01650 Stack Maze | Problem Statement
There is a maze which can be described as a W \times H grid. The upper-left cell is denoted as (1, 1), and the lower-right cell is (W, H). You are now at the cell (1, 1) and have to go to the cell (W, H). However, you can only move to the right adjacent cell or to the lower adjacent cell. The followi... | java | import java.io.ByteArrayInputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Scanner;
public class Main {
static InputStream is;
static PrintWriter out;
static String INPUT = "";
public static void ma... | partial | 1 | 2 | [{"idx": 1, "reason": "runtime_error", "rc": 1, "stderr": "Exception in thread \"main\" java.lang.ArrayIndexOutOfBoundsException: Index 2 out of bounds for length 2\n\tat Main.solver(Main.java:212)\n\tat Main.main(Main.java:19)\n", "stdout_tail": ""}] | aizu | UNKNOWN | |
643 | p01650 Stack Maze | Problem Statement
There is a maze which can be described as a W \times H grid. The upper-left cell is denoted as (1, 1), and the lower-right cell is (W, H). You are now at the cell (1, 1) and have to go to the cell (W, H). However, you can only move to the right adjacent cell or to the lower adjacent cell. The followi... | java | import java.util.ArrayList;
import java.util.Scanner;
public class Main{
public static void main(String[] args) {
new Main().solver();
}
int UNUSED = 1 << 60;
boolean[][][][] reachble;
@SuppressWarnings("unchecked")
void solver() {
Scanner sc = new Scanner(System.in);
while (true) {
H = sc.nextInt();
... | partial | 1 | 2 | [{"idx": 1, "reason": "runtime_error", "rc": 1, "stderr": "Exception in thread \"main\" java.lang.ArrayIndexOutOfBoundsException: Index 2 out of bounds for length 2\n\tat Main.solver(Main.java:60)\n\tat Main.main(Main.java:6)\n", "stdout_tail": "2\n0\n"}] | aizu | UNKNOWN | |
643 | p01650 Stack Maze | Problem Statement
There is a maze which can be described as a W \times H grid. The upper-left cell is denoted as (1, 1), and the lower-right cell is (W, H). You are now at the cell (1, 1) and have to go to the cell (W, H). However, you can only move to the right adjacent cell or to the lower adjacent cell. The followi... | python3 | import sys
readline = sys.stdin.readline
write = sys.stdout.write
from string import ascii_lowercase, ascii_uppercase
from collections import deque
dd = ((1, 0), (0, 1))
def solve():
H, W = map(int, readline().split())
if H == W == 0:
return False
C = [readline().strip() for i in range(H)]
INF... | partial | 1 | 2 | [{"idx": 1, "reason": "runtime_error", "rc": 1, "stderr": "Traceback (most recent call last):\n File \"/tmp/sbx_mod8wlmq/tmp5ufii1r2.py\", line 85, in <module>\n while solve():\n ^^^^^^^\n File \"/tmp/sbx_mod8wlmq/tmp5ufii1r2.py\", line 32, in solve\n ", "stdout_tail": "2\n0\n"}] | aizu | UNKNOWN | |
643 | p01650 Stack Maze | Problem Statement
There is a maze which can be described as a W \times H grid. The upper-left cell is denoted as (1, 1), and the lower-right cell is (W, H). You are now at the cell (1, 1) and have to go to the cell (W, H). However, you can only move to the right adjacent cell or to the lower adjacent cell. The followi... | java | import java.util.Scanner;
public class Main {
static Scanner sc = new Scanner(System.in);
static int H, W;
static char[][] f;
static int[][][] hole = new int[26][50][51];
static boolean[][][][] reach;
static int[][][][] dp;
public static void main(String[] args) {
while (true) {
H = sc.nextInt();
W = s... | partial | 1 | 2 | [{"idx": 1, "reason": "runtime_error", "rc": 1, "stderr": "Exception in thread \"main\" java.lang.ArrayIndexOutOfBoundsException: Index 2 out of bounds for length 2\n\tat Main.main(Main.java:22)\n", "stdout_tail": "2\n0\n"}] | aizu | UNKNOWN | |
645 | p02216 Array Game | Problem statement
There is a positive integer sequence $ a_1, a_2, \ ldots, a_N $ of length $ N $.
Consider the following game, which uses this sequence and is played by $ 2 $ players on the play and the play.
* Alternately select one of the following operations for the first move and the second move.
* Select a pos... | python3 | #
# ⋀_⋀
# (・ω・)
# ./ U ∽ U\
# │* 合 *│
# │* 格 *│
# │* 祈 *│
# │* 願 *│
# │* *│
#  ̄
#
import sys
sys.setrecursionlimit(10**6)
input=sys.stdin.readline
from math import floor,sqrt,factorial,hypot,log #log2ないyp
from heapq import heappop, heappush, heappushpop
from collections import Counter,default... | all_fail | 0 | 1 | [{"idx": 0, "reason": "runtime_error", "rc": 1, "stderr": "Traceback (most recent call last):\n File \"/tmp/sbx_uebh5sn2/tmpqzjudqn_.py\", line 21, in <module>\n from fractions import gcd\nImportError: cannot import name 'gcd' from 'fractions' (/usr/lib/python", "stdout_tail": ""}] | aizu | UNKNOWN | |
656 | 1139_E. Maximize Mex | There are n students and m clubs in a college. The clubs are numbered from 1 to m. Each student has a potential p_i and is a member of the club with index c_i. Initially, each student is a member of exactly one club. A technical fest starts in the college, and it will run for the next d days. There is a coding competit... | java | //package round548;
import java.io.ByteArrayInputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.BitSet;
import java.util.InputMismatchException;
import java.util.List;
public class E {
InputStream is;
P... | all_fail | 0 | 19 | [{"idx": 0, "reason": "runtime_error", "rc": 1, "stderr": "Exception in thread \"main\" java.util.InputMismatchException\n\tat E.readByte(E.java:112)\n\tat E.ni(E.java:167)\n\tat E.solve(E.java:19)\n\tat E.run(E.java:100)\n\tat E.main(E.java:105)\n", "stdout_tail": ""}, {"idx": 1, "reason": "runtime_error", "rc": 1, "s... | codeforces | E | |
658 | 117_B. Very Interesting Game | In a very ancient country the following game was popular. Two people play the game. Initially first player writes a string s1, consisting of exactly nine digits and representing a number that does not exceed a. After that second player looks at s1 and writes a string s2, consisting of exactly nine digits and representi... | cpp | #include <bits/stdc++.h>
using namespace std;
int const MAX = 1000 * 1000 * 1000;
int main() {
long long a, b, m, i;
cin >> a >> b >> m;
if (m <= b + 1 || MAX % m == 0) {
cout << 2;
return 0;
}
for (i = 1; i <= min(m - 1, a); ++i) {
int k = MAX * i % m;
if (0 < k && k < m - b) {
printf("... | partial | 14 | 25 | [{"idx": 0, "reason": "wrong_answer", "expected": "1 000000001", "got": "1\n%09I64d"}, {"idx": 3, "reason": "wrong_answer", "expected": "1 000576695", "got": "1\n%09I64d"}, {"idx": 5, "reason": "wrong_answer", "expected": "1 000000101", "got": "1\n%09I64d"}, {"idx": 9, "reason": "wrong_answer", "expected": "1 000000002... | codeforces | B | |
659 | 1215_B. The Number of Products | You are given a sequence a_1, a_2, ..., a_n consisting of n non-zero integers (i.e. a_i ≠ 0).
You have to calculate two following values:
1. the number of pairs of indices (l, r) (l ≤ r) such that a_l ⋅ a_{l + 1} ... a_{r - 1} ⋅ a_r is negative;
2. the number of pairs of indices (l, r) (l ≤ r) such that a_l ⋅ a... | cpp | #include <bits/stdc++.h>
int main() {
int n;
char ar[200000];
scanf("%d", &n);
for (int i = 0; i < n; i++) {
long long int a;
scanf("%I64d", &a);
ar[i] = a > 0 ? 1 : -1;
}
long long pluses = 0;
long long minuses = 0;
long long prevP = -1;
long long prevM = -1;
for (int i = 0; i < n; i++)... | partial | 6 | 23 | [{"idx": 0, "reason": "wrong_answer", "expected": "28 27", "got": " 0 55"}, {"idx": 1, "reason": "wrong_answer", "expected": "9 6", "got": " ... | codeforces | B | |
661 | 1256_E. Yet Another Division Into Teams | There are n students at your university. The programming skill of the i-th student is a_i. As a coach, you want to divide them into teams to prepare them for the upcoming ICPC finals. Just imagine how good this university is if it has 2 ⋅ 10^5 students ready for the finals!
Each team should consist of at least three s... | cpp | #include <bits/stdc++.h>
using namespace std;
void solve() {
int n;
cin >> n;
vector<pair<int, int>> v(n);
for (int i = 0; i < n; ++i) {
cin >> v[i].first;
v[i].second = i;
}
vector<long long> dp(n + 1);
vector<int> p(n + 1, -1);
sort(v.begin(), v.end());
fill(dp.begin(), dp.end(), 2e15);
dp... | partial | 4 | 5 | [{"idx": 3, "reason": "wrong_answer", "expected": "0 3\n3 3 3 3 2 2 2 1 1 1", "got": "0 2\n2 2 2 2 2 1 1 1 1 1"}] | codeforces | E | |
661 | 1256_E. Yet Another Division Into Teams | There are n students at your university. The programming skill of the i-th student is a_i. As a coach, you want to divide them into teams to prepare them for the upcoming ICPC finals. Just imagine how good this university is if it has 2 ⋅ 10^5 students ready for the finals!
Each team should consist of at least three s... | python3 |
def main():
n=int(input())
a=readIntArr()
a2=[[x,i+1] for i,x in enumerate(a)] # [value, index]
a2.sort(key=lambda x:x[0]) # sort by value asc
dp=[inf for _ in range(n)] # dp[i] is the min diversity achievable at i
#dp[i]=min(ai-aj+dp[j-1])=min(a[i]+(dp[j-1]-a[j]))=a[i]+dp2[i-2]
... | partial | 4 | 5 | [{"idx": 3, "reason": "wrong_answer", "expected": "0 3\n3 3 3 3 2 2 2 1 1 1", "got": "0 2\n2 2 2 1 1 1 1 1 1 1"}] | codeforces | E | |
661 | 1256_E. Yet Another Division Into Teams | There are n students at your university. The programming skill of the i-th student is a_i. As a coach, you want to divide them into teams to prepare them for the upcoming ICPC finals. Just imagine how good this university is if it has 2 ⋅ 10^5 students ready for the finals!
Each team should consist of at least three s... | cpp | #include <bits/stdc++.h>
using namespace std;
inline int read() {
int x = 0, f = 1;
char c = getchar();
while (c != '-' && (c < '0' || c > '9')) c = getchar();
if (c == '-') f = -1, c = getchar();
while (c >= '0' && c <= '9') x = x * 10 + c - '0', c = getchar();
return f * x;
}
const int maxn = 2e5 + 10;
co... | partial | 1 | 5 | [{"idx": 1, "reason": "wrong_answer", "expected": "7 2\n2 2 1 1 2 1", "got": "7 2\n1 1 2 2 1 2"}, {"idx": 2, "reason": "wrong_answer", "expected": "7486 3\n3 3 3 2 2 2 2 1 1 1", "got": "7486 3\n1 1 1 2 2 2 2 3 3 3"}, {"idx": 3, "reason": "wrong_answer", "expected": "0 3\n3 3 3 3 2 2 2 1 1 1", "got": "0 1\n1 1 1 1 1 1 1... | codeforces | E | |
661 | 1256_E. Yet Another Division Into Teams | There are n students at your university. The programming skill of the i-th student is a_i. As a coach, you want to divide them into teams to prepare them for the upcoming ICPC finals. Just imagine how good this university is if it has 2 ⋅ 10^5 students ready for the finals!
Each team should consist of at least three s... | python3 | import sys
# inf = open('input.txt', 'r')
# reader = (line.rstrip() for line in inf)
reader = (line.rstrip() for line in sys.stdin)
input = reader.__next__
class SegmTree():
'''
- modify single element
- get min on interval
'''
def __init__(self, size):
N = 1
while N < size:
... | partial | 1 | 5 | [{"idx": 1, "reason": "wrong_answer", "expected": "7 2\n2 2 1 1 2 1", "got": "7 2\n1 1 2 2 1 2"}, {"idx": 2, "reason": "wrong_answer", "expected": "7486 3\n3 3 3 2 2 2 2 1 1 1", "got": "7486 3\n1 1 1 2 2 2 2 3 3 3"}, {"idx": 3, "reason": "wrong_answer", "expected": "0 3\n3 3 3 3 2 2 2 1 1 1", "got": "0 2\n2 2 2 2 2 2 2... | codeforces | E | |
661 | 1256_E. Yet Another Division Into Teams | There are n students at your university. The programming skill of the i-th student is a_i. As a coach, you want to divide them into teams to prepare them for the upcoming ICPC finals. Just imagine how good this university is if it has 2 ⋅ 10^5 students ready for the finals!
Each team should consist of at least three s... | cpp | #include <bits/stdc++.h>
using namespace std;
template <class T>
struct rge {
T b, e;
};
template <class T>
rge<T> range(T i, T j) {
return rge<T>{i, j};
};
template <class A, class B>
ostream &operator<<(ostream &os, pair<A, B> p) {
return os << "(" << p.first << ", " << p.second << ")";
}
template <class T>
ost... | partial | 3 | 5 | [{"idx": 3, "reason": "wrong_answer", "expected": "0 3\n3 3 3 3 2 2 2 1 1 1", "got": "0 1\n1 1 1 1 1 1 1 1 1 1"}, {"idx": 4, "reason": "wrong_answer", "expected": "2 2\n2 2 2 1 1 1", "got": "2 1\n1 1 1 1 1 1"}] | codeforces | E | |
661 | 1256_E. Yet Another Division Into Teams | There are n students at your university. The programming skill of the i-th student is a_i. As a coach, you want to divide them into teams to prepare them for the upcoming ICPC finals. Just imagine how good this university is if it has 2 ⋅ 10^5 students ready for the finals!
Each team should consist of at least three s... | java | import java.io.*;
import java.util.*;
import java.text.*;
import java.lang.*;
public class solution{
static ArrayList[] a=new ArrayList[1000001];
public void solve () throws FileNotFoundException {
InputReader in = new InputReader(System.in);
PrintWriter pw = new PrintWriter(System.out);
... | partial | 3 | 5 | [{"idx": 3, "reason": "wrong_answer", "expected": "0 3\n3 3 3 3 2 2 2 1 1 1", "got": "0 1\n1 1 1 1 1 1 1 1 1 1"}, {"idx": 4, "reason": "wrong_answer", "expected": "2 2\n2 2 2 1 1 1", "got": "2 1\n1 1 1 1 1 1"}] | codeforces | E | |
661 | 1256_E. Yet Another Division Into Teams | There are n students at your university. The programming skill of the i-th student is a_i. As a coach, you want to divide them into teams to prepare them for the upcoming ICPC finals. Just imagine how good this university is if it has 2 ⋅ 10^5 students ready for the finals!
Each team should consist of at least three s... | python2 | n = input()
arr2 = map(int,raw_input().split(" "))
tmp = zip(arr2,range(n))
tmp.sort()
arr,idx = zip(*tmp)
dp = [[1e18]*3 for i in range(n)]
dp[0][2] = 0
dp[1][1] = arr[1]-arr[0]
labels = [1]*n
for i in range(2,n):
dp[i][1] = dp[i-2][0]+arr[i]-arr[i-1]
dp[i][2] = dp[i-1][0]
dp[i][0] = min(dp[i-2]) + arr[i... | partial | 3 | 5 | [{"idx": 3, "reason": "wrong_answer", "expected": "0 3\n3 3 3 3 2 2 2 1 1 1", "got": "0 1\n1 1 1 1 1 1 1 1 1 1"}, {"idx": 4, "reason": "wrong_answer", "expected": "2 2\n2 2 2 1 1 1", "got": "2 1\n1 1 1 1 1 1"}] | codeforces | E | |
661 | 1256_E. Yet Another Division Into Teams | There are n students at your university. The programming skill of the i-th student is a_i. As a coach, you want to divide them into teams to prepare them for the upcoming ICPC finals. Just imagine how good this university is if it has 2 ⋅ 10^5 students ready for the finals!
Each team should consist of at least three s... | python2 | n = input()
arr2 = map(int,raw_input().split(" "))
arr2 = (arr2*2)[:n]
tmp = zip(arr2,range(n))
tmp.sort()
arr,idx = zip(*tmp)
dp = [[1e18]*3 for i in range(n)]
dp[0][2] = 0
dp[1][1] = arr[1]-arr[0]
labels = [1]*n
for i in range(2,n):
dp[i][1] = dp[i-2][0]+arr[i]-arr[i-1]
dp[i][2] = dp[i-1][0]
dp[i][0] = ... | partial | 3 | 5 | [{"idx": 3, "reason": "wrong_answer", "expected": "0 3\n3 3 3 3 2 2 2 1 1 1", "got": "0 1\n1 1 1 1 1 1 1 1 1 1"}, {"idx": 4, "reason": "wrong_answer", "expected": "2 2\n2 2 2 1 1 1", "got": "2 1\n1 1 1 1 1 1"}] | codeforces | E | |
661 | 1256_E. Yet Another Division Into Teams | There are n students at your university. The programming skill of the i-th student is a_i. As a coach, you want to divide them into teams to prepare them for the upcoming ICPC finals. Just imagine how good this university is if it has 2 ⋅ 10^5 students ready for the finals!
Each team should consist of at least three s... | python2 | N = input()
A = map(int,raw_input().split())
L = [(A[i],i) for i in range(N)]
L.sort()
dp = [-1]*N
dp[-1] = 0
dp[-2] = 0
MAX = 0
for i in range(N-3,-1,-1):
if i:
dp[i] = L[i][0] - L[i-1][0] + MAX
else:
dp[i] = MAX
MAX = max(MAX,dp[i+2])
teams = [-1]*N
MAX = dp[0]
last,last_gain = 0,0
teamcou... | partial | 1 | 5 | [{"idx": 1, "reason": "wrong_answer", "expected": "7 2\n2 2 1 1 2 1", "got": "7 2\n1 1 2 2 1 2"}, {"idx": 2, "reason": "wrong_answer", "expected": "7486 3\n3 3 3 2 2 2 2 1 1 1", "got": "7486 3\n1 1 1 2 2 2 2 3 3 3"}, {"idx": 3, "reason": "wrong_answer", "expected": "0 3\n3 3 3 3 2 2 2 1 1 1", "got": "0 3\n1 1 1 2 2 2 3... | codeforces | E | |
664 | 1384_F. Rearrange | Koa the Koala has a matrix A of n rows and m columns. Elements of this matrix are distinct integers from 1 to n ⋅ m (each number from 1 to n ⋅ m appears exactly once in the matrix).
For any matrix M of n rows and m columns let's define the following:
* The i-th row of M is defined as R_i(M) = [ M_{i1}, M_{i2}, …, M... | java | import java.io.*;
import java.util.*;
public class CF1384F extends PrintWriter {
CF1384F() { super(System.out); }
Scanner sc = new Scanner(System.in);
public static void main(String[] $) {
CF1384F o = new CF1384F(); o.main(); o.flush();
}
void main() {
int n = sc.nextInt();
int m = sc.nextInt();
int[] ii... | partial | 2 | 8 | [{"idx": 0, "reason": "wrong_answer", "expected": "12 8 6 1\n10 11 9 2\n3 4 5 7", "got": "12 10 6 4\n8 11 9 5\n1 2 3 7"}, {"idx": 1, "reason": "wrong_answer", "expected": "9 5 1\n7 8 2\n3 6 4", "got": "9 7 1\n5 8 2\n3 6 4"}, {"idx": 4, "reason": "wrong_answer", "expected": "40 33 27 21 13 9 5 1\n34 39 28 22 14 10 6 2\n... | codeforces | F | |
664 | 1384_F. Rearrange | Koa the Koala has a matrix A of n rows and m columns. Elements of this matrix are distinct integers from 1 to n ⋅ m (each number from 1 to n ⋅ m appears exactly once in the matrix).
For any matrix M of n rows and m columns let's define the following:
* The i-th row of M is defined as R_i(M) = [ M_{i1}, M_{i2}, …, M... | cpp | #include <bits/stdc++.h>
using namespace std;
const long long inf = 9223372036854775806;
const long long mod = 1e9 + 7;
const double pi = 3.1415926;
const long long N = 1e5 + 10;
const long long small = 251;
int main() {
ios_base::sync_with_stdio(0);
cin.tie(0);
cout.tie(0);
long long n, m;
cin >> n >> m;
l... | partial | 1 | 8 | [{"idx": 0, "reason": "wrong_answer", "expected": "12 8 6 1\n10 11 9 2\n3 4 5 7", "got": "7 3 2 1\n5 9 11 8\n4 6 10 12"}, {"idx": 1, "reason": "wrong_answer", "expected": "9 5 1\n7 8 2\n3 6 4", "got": "4 6 3\n2 8 5\n1 7 9"}, {"idx": 2, "reason": "wrong_answer", "expected": "4 1\n3 2", "got": "2 3\n1 4"}, {"idx": 4, "re... | codeforces | F | |
665 | 1427_D. Unshuffling a Deck | You are given a deck of n cards numbered from 1 to n (not necessarily in this order in the deck). You have to sort the deck by repeating the following operation.
* Choose 2 ≤ k ≤ n and split the deck in k nonempty contiguous parts D_1, D_2,..., D_k (D_1 contains the first |D_1| cards of the deck, D_2 contains the f... | python3 | from sys import stdin, stdout
n = int(stdin.readline())
c = [int(x) for x in stdin.readline().split()]
ops = []
turn = True
for x in range(n-1):
newC = []
newC2 = []
op = []
ind = c.index(x+1)
if turn:
if ind != 0:
op.append(ind)
op.append(n-x-ind)
op += [1]*x... | partial | 6 | 25 | [{"idx": 1, "reason": "wrong_answer", "expected": "4\n3 1 1 4\n3 1 1 4\n3 1 1 4\n3 2 2 2", "got": "5\n2 5 1\n2 1 5\n4 3 1 1 1\n4 1 1 1 3\n6 1 1 1 1 1 1"}, {"idx": 2, "reason": "wrong_answer", "expected": "2\n3 1 2 1\n2 1 3", "got": "3\n2 1 3\n3 1 1 2\n4 1 1 1 1"}, {"idx": 3, "reason": "wrong_answer", "expected": "37\n4... | codeforces | D | |
665 | 1427_D. Unshuffling a Deck | You are given a deck of n cards numbered from 1 to n (not necessarily in this order in the deck). You have to sort the deck by repeating the following operation.
* Choose 2 ≤ k ≤ n and split the deck in k nonempty contiguous parts D_1, D_2,..., D_k (D_1 contains the first |D_1| cards of the deck, D_2 contains the f... | cpp | #include <bits/stdc++.h>
using namespace std;
template <class T>
ostream& operator<<(ostream& out, vector<T>& v) {
out << "[";
for (auto k : v) out << k << " ";
out << "]"
<< "\n";
return out;
}
template <class T>
ostream& operator<<(ostream& out, set<T> s) {
out << "{";
for (auto k : s) out << k << "... | partial | 7 | 25 | [{"idx": 1, "reason": "wrong_answer", "expected": "4\n3 1 1 4\n3 1 1 4\n3 1 1 4\n3 2 2 2", "got": "1\n6 1 1 1 1 1 1"}, {"idx": 2, "reason": "wrong_answer", "expected": "2\n3 1 2 1\n2 1 3", "got": "3\n2 1 3\n3 1 1 2\n4 1 1 1 1"}, {"idx": 3, "reason": "wrong_answer", "expected": "37\n4 1 1 10 32\n3 2 23 19\n3 2 34 8\n3 1... | codeforces | D | |
665 | 1427_D. Unshuffling a Deck | You are given a deck of n cards numbered from 1 to n (not necessarily in this order in the deck). You have to sort the deck by repeating the following operation.
* Choose 2 ≤ k ≤ n and split the deck in k nonempty contiguous parts D_1, D_2,..., D_k (D_1 contains the first |D_1| cards of the deck, D_2 contains the f... | python3 | import math
import sys
from collections import deque
from typing import Deque, Dict, List, Optional, Set, Tuple
def data():
return sys.stdin.buffer.readline().strip()
def mdata():
return list(map(int, data().split()))
def outl(res):
sys.stdout.write(' '.join(map(str, res)) + '\n')
def out(var):
... | partial | 2 | 25 | [{"idx": 1, "reason": "wrong_answer", "expected": "4\n3 1 1 4\n3 1 1 4\n3 1 1 4\n3 2 2 2", "got": "5\n3 4 1 1\n3 1 1 4\n5 2 1 1 1 1\n5 1 1 1 1 2\n6 1 1 1 1 1 1"}, {"idx": 2, "reason": "wrong_answer", "expected": "2\n3 1 2 1\n2 1 3", "got": "4\n2 2 2\n2 3 1\n3 1 1 2\n4 1 1 1 1"}, {"idx": 3, "reason": "wrong_answer", "ex... | codeforces | D | |
665 | 1427_D. Unshuffling a Deck | You are given a deck of n cards numbered from 1 to n (not necessarily in this order in the deck). You have to sort the deck by repeating the following operation.
* Choose 2 ≤ k ≤ n and split the deck in k nonempty contiguous parts D_1, D_2,..., D_k (D_1 contains the first |D_1| cards of the deck, D_2 contains the f... | cpp | #include <bits/stdc++.h>
using namespace std;
int a[110], n;
vector<int> tmp;
vector<vector<int>> ans;
void work(const vector<int>& v) {
int now = 1;
for (const auto& i : v) reverse(a + now, a + now + i), now += i;
reverse(a + 1, a + n + 1);
}
int main() {
scanf("%d", &n);
for (int i = 1; i <= n; i++) scanf("... | partial | 6 | 25 | [{"idx": 1, "reason": "wrong_answer", "expected": "4\n3 1 1 4\n3 1 1 4\n3 1 1 4\n3 2 2 2", "got": "5\n2 5 1\n2 1 5\n4 3 1 1 1\n4 1 1 1 3\n6 1 1 1 1 1 1"}, {"idx": 2, "reason": "wrong_answer", "expected": "2\n3 1 2 1\n2 1 3", "got": "3\n2 1 3\n3 1 1 2\n4 1 1 1 1"}, {"idx": 3, "reason": "wrong_answer", "expected": "37\n4... | codeforces | D | |
665 | 1427_D. Unshuffling a Deck | You are given a deck of n cards numbered from 1 to n (not necessarily in this order in the deck). You have to sort the deck by repeating the following operation.
* Choose 2 ≤ k ≤ n and split the deck in k nonempty contiguous parts D_1, D_2,..., D_k (D_1 contains the first |D_1| cards of the deck, D_2 contains the f... | java | import java.io.BufferedOutputStream;
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.List;
import java.util.StringToken... | partial | 8 | 25 | [{"idx": 3, "reason": "wrong_answer", "expected": "37\n4 1 1 10 32\n3 2 23 19\n3 2 34 8\n3 1 24 19\n3 1 32 11\n3 1 13 30\n3 1 2 41\n3 1 18 25\n3 1 7 36\n3 1 14 29\n3 2 27 15\n3 1 1 42\n3 3 14 27\n3 1 15 28\n3 1 20 23\n3 1 1 42\n3 1 5 38\n3 2 6 36\n3 1 21 22\n3 1 28 15\n3 ", "got": "38\n3 1 24 19\n3 1 1 42\n3 1 14 29\n3... | codeforces | D | |
665 | 1427_D. Unshuffling a Deck | You are given a deck of n cards numbered from 1 to n (not necessarily in this order in the deck). You have to sort the deck by repeating the following operation.
* Choose 2 ≤ k ≤ n and split the deck in k nonempty contiguous parts D_1, D_2,..., D_k (D_1 contains the first |D_1| cards of the deck, D_2 contains the f... | cpp | #include <bits/stdc++.h>
using namespace std;
const int maxn = 52;
int n, a[maxn + 5], b[maxn + 5], pos[maxn + 5], lft[maxn + 5], rht[maxn + 5];
vector<int> res[maxn + 5];
void go(vector<int> vec) {
int m = vec.size();
int x = 1, p = n;
for (int i = (0); i <= int(m - 1); i++) {
int y = x;
x += vec[i];
... | partial | 7 | 25 | [{"idx": 1, "reason": "wrong_answer", "expected": "4\n3 1 1 4\n3 1 1 4\n3 1 1 4\n3 2 2 2", "got": "4\n3 4 1 1\n3 4 1 1\n3 2 2 2\n3 1 1 4"}, {"idx": 3, "reason": "wrong_answer", "expected": "37\n4 1 1 10 32\n3 2 23 19\n3 2 34 8\n3 1 24 19\n3 1 32 11\n3 1 13 30\n3 1 2 41\n3 1 18 25\n3 1 7 36\n3 1 14 29\n3 2 27 15\n3 1 1 ... | codeforces | D | |
665 | 1427_D. Unshuffling a Deck | You are given a deck of n cards numbered from 1 to n (not necessarily in this order in the deck). You have to sort the deck by repeating the following operation.
* Choose 2 ≤ k ≤ n and split the deck in k nonempty contiguous parts D_1, D_2,..., D_k (D_1 contains the first |D_1| cards of the deck, D_2 contains the f... | python3 | import os,io
input=io.BytesIO(os.read(0,os.fstat(0).st_size)).readline
n=int(input())
a=list(map(int,input().split()))
ans=[]
if a[n-1]==1:
parity=1
else:
parity=0
for i in range(n-1):
if parity%2==0:
for j in range(n):
if a[j]==i+1 and j!=i:
ans.append([])
for k in range(i):
a... | all_fail | 0 | 25 | [{"idx": 0, "reason": "runtime_error", "rc": 1, "stderr": "Traceback (most recent call last):\n File \"/tmp/sbx_793lyi74/tmp5ieenr8t.py\", line 3, in <module>\n n=int(input())\n ^^^^^^^^^^^^\nValueError: invalid literal for int() with base 10: b''\n", "stdout_tail": ""}, {"idx": 1, "reason": "runtime_error", "... | codeforces | D | |
665 | 1427_D. Unshuffling a Deck | You are given a deck of n cards numbered from 1 to n (not necessarily in this order in the deck). You have to sort the deck by repeating the following operation.
* Choose 2 ≤ k ≤ n and split the deck in k nonempty contiguous parts D_1, D_2,..., D_k (D_1 contains the first |D_1| cards of the deck, D_2 contains the f... | java |
import java.awt.*;
import java.io.*;
import java.util.*;
import java.util.List;
public class Coding {
static long MOD = 1000000007;
static long[] fact = new long[302];
static long[] invFact = new long[302];
static long[][][] segmentTree = new long[4*300000 + 11][2][2];
static long MINVALUE = In... | partial | 6 | 25 | [{"idx": 1, "reason": "wrong_answer", "expected": "4\n3 1 1 4\n3 1 1 4\n3 1 1 4\n3 2 2 2", "got": "4\n3 4 1 1\n3 4 1 1\n3 4 1 1\n3 2 2 2"}, {"idx": 3, "reason": "wrong_answer", "expected": "37\n4 1 1 10 32\n3 2 23 19\n3 2 34 8\n3 1 24 19\n3 1 32 11\n3 1 13 30\n3 1 2 41\n3 1 18 25\n3 1 7 36\n3 1 14 29\n3 2 27 15\n3 1 1 ... | codeforces | D | |
665 | 1427_D. Unshuffling a Deck | You are given a deck of n cards numbered from 1 to n (not necessarily in this order in the deck). You have to sort the deck by repeating the following operation.
* Choose 2 ≤ k ≤ n and split the deck in k nonempty contiguous parts D_1, D_2,..., D_k (D_1 contains the first |D_1| cards of the deck, D_2 contains the f... | java | //package Codeforces.GlobalRound11;
import java.io.*;
import java.util.*;
public class D {
public static int findPos(int[] arr, int ind)
{
int n = arr.length;
for(int i=0;i<n;i++)
{
if(arr[i]==ind)
return i;
}
return -1;
}
public stat... | partial | 2 | 25 | [{"idx": 1, "reason": "wrong_answer", "expected": "4\n3 1 1 4\n3 1 1 4\n3 1 1 4\n3 2 2 2", "got": "5\n3 4 1 1\n3 1 1 4\n5 2 1 1 1 1\n5 1 1 1 1 2\n6 1 1 1 1 1 1"}, {"idx": 2, "reason": "wrong_answer", "expected": "2\n3 1 2 1\n2 1 3", "got": "4\n2 2 2\n2 3 1\n3 1 1 2\n4 1 1 1 1"}, {"idx": 3, "reason": "wrong_answer", "ex... | codeforces | D | |
665 | 1427_D. Unshuffling a Deck | You are given a deck of n cards numbered from 1 to n (not necessarily in this order in the deck). You have to sort the deck by repeating the following operation.
* Choose 2 ≤ k ≤ n and split the deck in k nonempty contiguous parts D_1, D_2,..., D_k (D_1 contains the first |D_1| cards of the deck, D_2 contains the f... | python2 | n = int(raw_input())
a = map(int, raw_input().split())
ans = []
def go():
global a
for i in xrange(n):
for j in xrange(i + 1, n):
if a[i] == a[j] + 1:
b = []
k = j
while a[k-1] + 1 == a[k]:
k -= 1
if i:
... | partial | 8 | 25 | [{"idx": 3, "reason": "wrong_answer", "expected": "37\n4 1 1 10 32\n3 2 23 19\n3 2 34 8\n3 1 24 19\n3 1 32 11\n3 1 13 30\n3 1 2 41\n3 1 18 25\n3 1 7 36\n3 1 14 29\n3 2 27 15\n3 1 1 42\n3 3 14 27\n3 1 15 28\n3 1 20 23\n3 1 1 42\n3 1 5 38\n3 2 6 36\n3 1 21 22\n3 1 28 15\n3 ", "got": "33\n4 1 10 1 32\n3 24 1 19\n3 38 1 5\... | codeforces | D | |
665 | 1427_D. Unshuffling a Deck | You are given a deck of n cards numbered from 1 to n (not necessarily in this order in the deck). You have to sort the deck by repeating the following operation.
* Choose 2 ≤ k ≤ n and split the deck in k nonempty contiguous parts D_1, D_2,..., D_k (D_1 contains the first |D_1| cards of the deck, D_2 contains the f... | python2 | from collections import Counter, defaultdict, deque
import bisect
from sys import stdin, stdout
from itertools import repeat
import math
# sys.stdin = open('input')
def mod(x, y, mod):
re = 1
now = x
while y:
if y&1:
re *= now
re %= mod
y >>= 1
now = (now*no... | partial | 2 | 25 | [{"idx": 1, "reason": "wrong_answer", "expected": "4\n3 1 1 4\n3 1 1 4\n3 1 1 4\n3 2 2 2", "got": "6\n2 2 4\n3 1 2 3\n4 1 1 3 1\n4 2 1 2 1\n3 2 2 2\n3 3 1 2"}, {"idx": 2, "reason": "wrong_answer", "expected": "2\n3 1 2 1\n2 1 3", "got": "3\n2 1 3\n4 1 1 1 1\n3 2 1 1"}, {"idx": 3, "reason": "wrong_answer", "expected": "... | codeforces | D | |
665 | 1427_D. Unshuffling a Deck | You are given a deck of n cards numbered from 1 to n (not necessarily in this order in the deck). You have to sort the deck by repeating the following operation.
* Choose 2 ≤ k ≤ n and split the deck in k nonempty contiguous parts D_1, D_2,..., D_k (D_1 contains the first |D_1| cards of the deck, D_2 contains the f... | python2 | # Author: yumtam
# Created at: 2020-10-11 00:47
from __future__ import division, print_function
_interactive = False
def main():
n = int(input())
ar = input_as_list()
ans = []
def op(lst):
res = []
i = 0
for x in lst:
res.append(ar[i:i+x])
i += x
... | all_fail | 0 | 25 | [{"idx": 0, "reason": "runtime_error", "rc": 1, "stderr": "Traceback (most recent call last):\n File \"/tmp/sbx_tpmtylbn/tmpv6cd2wis.py\", line 101, in <module>\n main()\n File \"/tmp/sbx_tpmtylbn/tmpv6cd2wis.py\", line 8, in main\n n = int(input())\nValueErro", "stdout_tail": ""}, {"idx": 1, "reason": "runtime... | codeforces | D | |
666 | 1450_D. Rating Compression | On the competitive programming platform CodeCook, every person has a rating graph described by an array of integers a of length n. You are now updating the infrastructure, so you've created a program to compress these graphs.
The program works as follows. Given an integer parameter k, the program takes the minimum of ... | cpp | /* /$$ /$$
| $$ | $$
/$$$$$$$ /$$$$$$ /$$$$$$$ /$$$$$$ /$$$$$$$ /$$$$$$ /$$$$$$
/$$__ $$ /$$__ $$ /$$_____/ /$$__ $$ /$$__ $$ /$$__ $$ /$$__ $$
| $$ | $$| $$$$$$$$| $$ | $$ \ $$| $$ | $$| $$$$$$$$| $$ \__/
| $$ | $... | all_fail | 0 | 1 | [{"idx": 0, "reason": "wrong_answer", "expected": "\n10111\n0001\n00111\n1111111111\n000", "got": ""}] | codeforces | D | |
670 | 198_D. Cube Snake | You've got an n × n × n cube, split into unit cubes. Your task is to number all unit cubes in this cube with positive integers from 1 to n3 so that:
* each number was used as a cube's number exactly once;
* for each 1 ≤ i < n3, unit cubes with numbers i and i + 1 were neighbouring (that is, shared a side);
* ... | cpp | #include <bits/stdc++.h>
using namespace std;
const int maxn = 105;
inline int gi() {
char c = getchar();
while (c < '0' || c > '9') c = getchar();
int sum = 0;
while ('0' <= c && c <= '9') sum = sum * 10 + c - 48, c = getchar();
return sum;
}
int n, A[maxn][maxn][maxn];
int main() {
n = gi();
if (n == 1)... | partial | 1 | 25 | [{"idx": 0, "reason": "wrong_answer", "expected": "1 8 9\n2 7 10\n27 26 25\n\n4 5 12\n3 6 11\n22 23 24\n\n15 14 13\n16 17 18\n21 20 19", "got": "1 6 7\n2 5 8\n3 4 9\n\n16 17 22\n13 20 21\n12 11 10\n\n15 18 23\n14 19 24\n27 26 25"}, {"idx": 1, "reason": "wrong_answer", "expected": "1 11662 11707 11708 11753 11754 11799 ... | codeforces | D | |
670 | 198_D. Cube Snake | You've got an n × n × n cube, split into unit cubes. Your task is to number all unit cubes in this cube with positive integers from 1 to n3 so that:
* each number was used as a cube's number exactly once;
* for each 1 ≤ i < n3, unit cubes with numbers i and i + 1 were neighbouring (that is, shared a side);
* ... | cpp | #include <bits/stdc++.h>
using namespace std;
inline int read() {
int ret = 0, f = 1;
char ch = getchar();
while (ch > '9' || ch < '0') {
if (ch == '-') f = -1;
ch = getchar();
}
while (ch >= '0' && ch <= '9') {
ret = (ret << 1) + (ret << 3) + ch - '0';
ch = getchar();
}
return ret * f;
}
... | partial | 1 | 25 | [{"idx": 0, "reason": "wrong_answer", "expected": "1 8 9\n2 7 10\n27 26 25\n\n4 5 12\n3 6 11\n22 23 24\n\n15 14 13\n16 17 18\n21 20 19", "got": "1 2 3\n22 23 24\n27 26 25\n\n6 5 4\n21 16 11\n20 15 12\n\n7 8 9\n18 17 10\n19 14 13"}, {"idx": 1, "reason": "wrong_answer", "expected": "1 11662 11707 11708 11753 11754 11799 ... | codeforces | D | |
670 | 198_D. Cube Snake | You've got an n × n × n cube, split into unit cubes. Your task is to number all unit cubes in this cube with positive integers from 1 to n3 so that:
* each number was used as a cube's number exactly once;
* for each 1 ≤ i < n3, unit cubes with numbers i and i + 1 were neighbouring (that is, shared a side);
* ... | cpp | #include <bits/stdc++.h>
using namespace std;
int cur;
int a[55][55][55];
void yz_xy_xz(int n) {
assert(a[n - 1][0][0] == cur);
int x = n;
int y, z;
for (z = 0; z <= n; z++) {
if (z & 1) {
for (y = n - 1; y >= 0; y--) {
a[x][y][z] = ++cur;
}
} else {
for (y = 0; y < n; y++) {
... | all_fail | 0 | 25 | [{"idx": 0, "reason": "wrong_answer", "expected": "1 8 9\n2 7 10\n27 26 25\n\n4 5 12\n3 6 11\n22 23 24\n\n15 14 13\n16 17 18\n21 20 19", "got": "1 8 9\n2 7 6\n3 4 5\n\n26 25 10\n21 22 13\n18 17 14\n\n27 24 11\n20 23 12\n19 16 15"}, {"idx": 1, "reason": "wrong_answer", "expected": "1 11662 11707 11708 11753 11754 11799 ... | codeforces | D | |
670 | 198_D. Cube Snake | You've got an n × n × n cube, split into unit cubes. Your task is to number all unit cubes in this cube with positive integers from 1 to n3 so that:
* each number was used as a cube's number exactly once;
* for each 1 ≤ i < n3, unit cubes with numbers i and i + 1 were neighbouring (that is, shared a side);
* ... | java | import java.io.InputStreamReader;
import java.io.IOException;
import java.io.BufferedReader;
import java.io.OutputStream;
import java.io.PrintWriter;
import java.util.StringTokenizer;
import java.io.InputStream;
/**
* Built using CHelper plug-in
* Actual solution is at the top
*/
public class Main {
public static ... | all_fail | 0 | 25 | [{"idx": 0, "reason": "wrong_answer", "expected": "1 8 9\n2 7 10\n27 26 25\n\n4 5 12\n3 6 11\n22 23 24\n\n15 14 13\n16 17 18\n21 20 19", "got": "1 2 27\n8 7 24\n9 10 23\n\n4 3 26\n5 6 25\n12 11 22\n\n17 18 19\n16 15 20\n13 14 21"}, {"idx": 1, "reason": "wrong_answer", "expected": "1 11662 11707 11708 11753 11754 11799 ... | codeforces | D | |
672 | 245_F. Log Stream Analysis | You've got a list of program warning logs. Each record of a log stream is a string in this format:
"2012-MM-DD HH:MM:SS:MESSAGE" (without the quotes).
String "MESSAGE" consists of spaces, uppercase and lowercase English letters and characters "!", ".", ",", "?". String "2012-MM-DD" determines a correct date in the ... | cpp | #include <bits/stdc++.h>
using namespace std;
int que[10000000];
char ss[10000000];
int day[13] = {0, 31, 60, 91, 121, 152, 182, 213, 244, 274, 305, 335, 366};
int main() {
int n, m;
int head = 0, tail = 0;
int now;
int ye, mo, da, h, mi, s;
cin >> n >> m;
while (scanf("%d-%d-%d %d:%d:%d:", &ye, &mo, &da, &... | compile_error | 0 | 0 | COMPILE_ERROR:/tmp/sbx_8x0xoabf/tmpaydx7jmh.cpp: In function ‘int main()’:
/tmp/sbx_8x0xoabf/tmpaydx7jmh.cpp:13:5: error: ‘gets’ was not declared in this scope; did you mean ‘getw’?
13 | gets(ss);
| ^~~~
| getw
| [] | codeforces | F |
673 | 270_D. Greenhouse Effect | Emuskald is an avid horticulturist and owns the world's longest greenhouse — it is effectively infinite in length.
Over the years Emuskald has cultivated n plants in his greenhouse, of m different plant species numbered from 1 to m. His greenhouse is very narrow and can be viewed as an infinite line, with each plant o... | java | import com.sun.org.apache.xml.internal.utils.StringComparable;
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.text.DecimalFormat;
import java.text.NumberFormat;
import java.util.*;
public class Main {
public static void main(String[] args) {
// Test.te... | compile_error | 0 | 0 | COMPILE_ERROR:/tmp/sbx_53hdsxwm/Main.java:1: error: package com.sun.org.apache.xml.internal.utils is not visible
import com.sun.org.apache.xml.internal.utils.StringComparable;
^
(package com.sun.org.apache.xml.internal.utils is declared in module java.xml, which does not export i... | [] | codeforces | D |
674 | 317_D. Game with Powers | Vasya and Petya wrote down all integers from 1 to n to play the "powers" game (n can be quite large; however, Vasya and Petya are not confused by this fact).
Players choose numbers in turn (Vasya chooses first). If some number x is chosen at the current turn, it is forbidden to choose x or all of its other positive in... | python3 | import math, collections
mod = 10**9+7
def isPower(n):
if (n <= 1):
return True
for x in range(2, (int)(math.sqrt(n)) + 1):
p = x
while (p <= n):
p = p * x
if (p == n):
return True
return False
n = int(input())
arr = [0,1,2,1,4,3,2,1,5,6,2,1,8... | partial | 24 | 25 | [{"idx": 14, "reason": "timeout"}] | codeforces | D | |
678 | 480_D. Parcels | Jaroslav owns a small courier service. He has recently got and introduced a new system of processing parcels. Each parcel is a box, the box has its weight and strength. The system works as follows. It originally has an empty platform where you can put boxes by the following rules:
* If the platform is empty, then t... | cpp | #include <bits/stdc++.h>
using namespace std;
const int md = 1000000007;
const int maxn = 1100;
const long long inf = 2020202020202020202LL;
struct box {
int in, out, w, s, v;
};
int dp[1100][1100], n, s, subdp[1100];
vector<box> nice;
bool cmp(const box& a, const box& b) {
return a.in < b.in || a.in == b.in && a.o... | compile_error | 0 | 0 | COMPILE_ERROR:/tmp/sbx_s3vu2wtv/tmpderkrxpl.cpp:10:13: error: ‘std::vector<box> nice’ redeclared as different kind of entity
10 | vector<box> nice;
| ^~~~
In file included from /usr/include/x86_64-linux-gnu/bits/sigstksz.h:24,
from /usr/include/signal.h:328,
from /... | [] | codeforces | D |
679 | 580_D. Kefa and Dishes | When Kefa came to the restaurant and sat at a table, the waiter immediately brought him the menu. There were n dishes. Kefa knows that he needs exactly m dishes. But at that, he doesn't want to order the same dish twice to taste as many dishes as possible.
Kefa knows that the i-th dish gives him ai units of satisfact... | python3 | import os
import sys
from io import BytesIO,IOBase
def main():
n,m,k = map(int,input().split())
a = list(map(float,input().split()))
tree = [[0]*n for _ in range(n)]
for i in range(k):
x,y,z = map(int,input().split())
tree[x-1][y-1] = float(z)
po = [1]
while len(po) != n:
... | partial | 15 | 25 | [{"idx": 3, "reason": "timeout"}, {"idx": 4, "reason": "timeout"}, {"idx": 7, "reason": "timeout"}, {"idx": 13, "reason": "timeout"}, {"idx": 15, "reason": "timeout"}] | codeforces | D | |
679 | 580_D. Kefa and Dishes | When Kefa came to the restaurant and sat at a table, the waiter immediately brought him the menu. There were n dishes. Kefa knows that he needs exactly m dishes. But at that, he doesn't want to order the same dish twice to taste as many dishes as possible.
Kefa knows that the i-th dish gives him ai units of satisfact... | python3 | import sys
from array import array # noqa: F401
import typing as Tp # noqa: F401
def input():
return sys.stdin.buffer.readline().decode('utf-8')
def output(*args):
sys.stdout.buffer.write(
('\n'.join(map(str, args)) + '\n').encode('utf-8')
)
def main():
n, m, k = map(int, input().split()... | partial | 16 | 25 | [{"idx": 3, "reason": "timeout"}, {"idx": 4, "reason": "timeout"}, {"idx": 7, "reason": "timeout"}, {"idx": 13, "reason": "timeout"}, {"idx": 18, "reason": "timeout"}] | codeforces | D | |
680 | 625_A. Guest From the Past | Kolya Gerasimov loves kefir very much. He lives in year 1984 and knows all the details of buying this delicious drink. One day, as you probably know, he found himself in year 2084, and buying kefir there is much more complicated.
Kolya is hungry, so he went to the nearest milk shop. In 2084 you may buy kefir in a plas... | cpp | #include <bits/stdc++.h>
using namespace std;
const int MOD = 1e9 + 7;
int Scan() {
int res = 0, ch, flag = 0;
if ((ch = getchar()) == '-')
flag = 1;
else if (ch >= '0' && ch <= '9')
res = ch - '0';
while ((ch = getchar()) >= '0' && ch <= '9') res = res * 10 + ch - '0';
return flag ? -res : res;
}
int... | partial | 21 | 25 | [{"idx": 3, "reason": "wrong_answer", "expected": "974999999999999999", "got": " -1878949889"}, {"idx": 10, "reason": "wrong_answer", "expected": "5586592178770949", "got": " -632155131"}, {"idx": 20, "reason": "wro... | codeforces | A | |
685 | 97_B. Superset | A set of points on a plane is called good, if for any two points at least one of the three conditions is true:
* those two points lie on same horizontal line;
* those two points lie on same vertical line;
* the rectangle, with corners in these two points, contains inside or on its borders at least one point of... | cpp | #include <bits/stdc++.h>
using namespace std;
const int MOD = 1e9 + 7;
const int INF = INT_MAX;
const long long LINF = LLONG_MAX;
const int N = 1e4 + 20;
pair<int, int> a[N];
set<pair<int, int> > s;
int n;
void solve(int l, int r) {
if (r - l < 2) return;
int mid = (l + r) / 2;
solve(l, mid);
solve(mid, r);
i... | partial | 3 | 16 | [{"idx": 0, "reason": "wrong_answer", "expected": "3\n1 1\n1 2\n2 2", "got": "3\n1 1\n2 1\n2 2"}, {"idx": 1, "reason": "wrong_answer", "expected": "3\n0 0\n0 1\n1 0", "got": "3\n0 1\n1 0\n1 1"}, {"idx": 2, "reason": "wrong_answer", "expected": "8\n-10 1\n-2 -5\n-2 -3\n-2 -2\n-2 1\n-1 -3\n-1 -2\n4 -3", "got": "9\n-10 1\... | codeforces | B | |
685 | 97_B. Superset | A set of points on a plane is called good, if for any two points at least one of the three conditions is true:
* those two points lie on same horizontal line;
* those two points lie on same vertical line;
* the rectangle, with corners in these two points, contains inside or on its borders at least one point of... | java |
import java.io.*;
import java.util.*;
public class Main {
public static void main(String[] args) {
Scanner scanner = new Scanner(new BufferedInputStream(System.in));
//int nCase = scanner.nextInt();
//for (int iCase = 0; iCase < nCase; iCase++) {
int n = scanner.nextInt();
... | partial | 4 | 16 | [{"idx": 1, "reason": "wrong_answer", "expected": "3\n0 0\n0 1\n1 0", "got": "3\n0 1\n0 0\n1 0"}, {"idx": 2, "reason": "wrong_answer", "expected": "8\n-10 1\n-2 -5\n-2 -3\n-2 -2\n-2 1\n-1 -3\n-1 -2\n4 -3", "got": "12\n-10 1\n-3 1\n-3 -5\n-3 -2\n-3 -3\n-2 -5\n-1 -5\n-1 -2\n1 -5\n1 -2\n1 -3\n4 -3"}, {"idx": 3, "reason": ... | codeforces | B | |
685 | 97_B. Superset | A set of points on a plane is called good, if for any two points at least one of the three conditions is true:
* those two points lie on same horizontal line;
* those two points lie on same vertical line;
* the rectangle, with corners in these two points, contains inside or on its borders at least one point of... | cpp | #include <bits/stdc++.h>
using namespace std;
int n;
struct Point {
int x, y;
bool operator<(const Point a) const {
if (x == a.x) return y < a.y;
return x < a.x;
}
bool operator>(const Point a) const {
if (x == a.x) return y > a.y;
return x > a.x;
}
} s[200005];
bool cmp(Point a, Point b) { re... | partial | 3 | 16 | [{"idx": 0, "reason": "wrong_answer", "expected": "3\n1 1\n1 2\n2 2", "got": "3\n1 1\n2 2\n1 2"}, {"idx": 1, "reason": "wrong_answer", "expected": "3\n0 0\n0 1\n1 0", "got": "3\n0 1\n1 0\n0 0"}, {"idx": 2, "reason": "wrong_answer", "expected": "8\n-10 1\n-2 -5\n-2 -3\n-2 -2\n-2 1\n-1 -3\n-1 -2\n4 -3", "got": "9\n-10 1\... | codeforces | B | |
685 | 97_B. Superset | A set of points on a plane is called good, if for any two points at least one of the three conditions is true:
* those two points lie on same horizontal line;
* those two points lie on same vertical line;
* the rectangle, with corners in these two points, contains inside or on its borders at least one point of... | cpp | #include <bits/stdc++.h>
#pragma GCC optimize("Ofast")
using namespace std;
int n;
set<pair<int, int> > added;
vector<pair<int, int> > inp;
void conquer(const vector<pair<int, int> >& inp) {
if (inp.size() == 2) {
if (inp[0].first != inp[1].first && inp[0].second != inp[1].second)
added.insert({inp[0].first... | partial | 14 | 16 | [{"idx": 10, "reason": "wrong_answer", "expected": "78\n-86 17\n-86 49\n-84 -16\n-84 17\n-84 49\n-78 -16\n-78 12\n-78 17\n-78 38\n-78 49\n-70 12\n-70 38\n-62 -97\n-62 -62\n-62 -49\n-62 -16\n-62 12\n-62 17\n-62 38\n-62 49\n-62 62\n-48 -62\n-48 62\n-26 -97\n-26 -62\n-26 62\n-16 -9", "got": "62\n-86 17\n-84 -16\n-84 12\n-... | codeforces | B | |
685 | 97_B. Superset | A set of points on a plane is called good, if for any two points at least one of the three conditions is true:
* those two points lie on same horizontal line;
* those two points lie on same vertical line;
* the rectangle, with corners in these two points, contains inside or on its borders at least one point of... | java | import java.util.*;
import java.io.*;
import java.math.*;
public class Solution {
InputStreamReader inp = new InputStreamReader(System.in);
BufferedReader br = new BufferedReader(inp);
Scanner sc = new Scanner(inp);
class Point implements Comparable<Point> {
public int x, y;
public... | partial | 3 | 16 | [{"idx": 0, "reason": "wrong_answer", "expected": "3\n1 1\n1 2\n2 2", "got": "3\n1 2\n2 2\n1 1"}, {"idx": 1, "reason": "wrong_answer", "expected": "3\n0 0\n0 1\n1 0", "got": "3\n0 0\n1 0\n0 1"}, {"idx": 2, "reason": "wrong_answer", "expected": "8\n-10 1\n-2 -5\n-2 -3\n-2 -2\n-2 1\n-1 -3\n-1 -2\n4 -3", "got": "8\n4 -3\n... | codeforces | B | |
685 | 97_B. Superset | A set of points on a plane is called good, if for any two points at least one of the three conditions is true:
* those two points lie on same horizontal line;
* those two points lie on same vertical line;
* the rectangle, with corners in these two points, contains inside or on its borders at least one point of... | java | import java.io.*;
import java.awt.geom.Point2D;
import java.text.*;
import java.math.*;
import java.util.*;
public class Main implements Runnable {
final String filename = "";
public class point implements Comparable<point> {
int x, y;
public point(int x, int y) {
this.x = x;
this.y = y;
}
public ... | partial | 3 | 16 | [{"idx": 0, "reason": "wrong_answer", "expected": "3\n1 1\n1 2\n2 2", "got": "3\n2 1\n2 2\n1 1"}, {"idx": 1, "reason": "wrong_answer", "expected": "3\n0 0\n0 1\n1 0", "got": "3\n0 1\n1 0\n1 1"}, {"idx": 2, "reason": "wrong_answer", "expected": "8\n-10 1\n-2 -5\n-2 -3\n-2 -2\n-2 1\n-1 -3\n-1 -2\n4 -3", "got": "9\n-10 1\... | codeforces | B | |
685 | 97_B. Superset | A set of points on a plane is called good, if for any two points at least one of the three conditions is true:
* those two points lie on same horizontal line;
* those two points lie on same vertical line;
* the rectangle, with corners in these two points, contains inside or on its borders at least one point of... | python2 | def build(l, r):
if l >= r:
return
mid = (l+r) >> 1
for i in range(l, r):
s.add((a[mid][0], a[i][1]))
build(l, mid)
build(mid+1, r)
n = input()
a = []
for i in range(0, n):
x, y = map(int, raw_input().split())
a.append((x, y))
a.sort()
s = set()
build(0, n)
print len(s)
for x... | partial | 3 | 16 | [{"idx": 0, "reason": "wrong_answer", "expected": "3\n1 1\n1 2\n2 2", "got": "3\n1 1\n2 1\n2 2"}, {"idx": 1, "reason": "wrong_answer", "expected": "3\n0 0\n0 1\n1 0", "got": "3\n0 1\n1 0\n1 1"}, {"idx": 2, "reason": "wrong_answer", "expected": "8\n-10 1\n-2 -5\n-2 -3\n-2 -2\n-2 1\n-1 -3\n-1 -2\n4 -3", "got": "8\n-1 -5\... | codeforces | B |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.