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 |
|---|---|---|---|---|---|---|---|---|---|---|---|
776 | p02797 Keyence Programming Contest 2020 - Subarray Sum | Given are three integers N, K, and S.
Find a sequence A_1, A_2, ..., A_N of N integers between 1 and 10^9 (inclusive) that satisfies the condition below. We can prove that, under the conditions in Constraints, such a sequence always exists.
* There are exactly K pairs (l, r) of integers such that 1 \leq l \leq r \leq... | python3 | n,k,s=map(int,input().split());print(*[s]*k+[7]*(n-k)) | all_fail | 0 | 2 | [{"idx": 0, "reason": "wrong_answer", "expected": "50 50 50 30 70", "got": "100 100 100 7 7"}, {"idx": 1, "reason": "wrong_answer", "expected": "1 2 3 4", "got": "3 3 7 7"}] | atcoder | UNKNOWN | |
776 | p02797 Keyence Programming Contest 2020 - Subarray Sum | Given are three integers N, K, and S.
Find a sequence A_1, A_2, ..., A_N of N integers between 1 and 10^9 (inclusive) that satisfies the condition below. We can prove that, under the conditions in Constraints, such a sequence always exists.
* There are exactly K pairs (l, r) of integers such that 1 \leq l \leq r \leq... | java | import java.util.*;
public class Main {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
int n = sc.nextInt();
int k = sc.nextInt();
int s = sc.nextInt();
boolean b = s==Math.pow(10,9);
for (int i=0;i<k;i++)System.out.println(s+" ");
... | all_fail | 0 | 2 | [{"idx": 0, "reason": "wrong_answer", "expected": "50 50 50 30 70", "got": "100\n100\n100\n101\n101"}, {"idx": 1, "reason": "wrong_answer", "expected": "1 2 3 4", "got": "3\n3\n4\n4"}] | atcoder | UNKNOWN | |
776 | p02797 Keyence Programming Contest 2020 - Subarray Sum | Given are three integers N, K, and S.
Find a sequence A_1, A_2, ..., A_N of N integers between 1 and 10^9 (inclusive) that satisfies the condition below. We can prove that, under the conditions in Constraints, such a sequence always exists.
* There are exactly K pairs (l, r) of integers such that 1 \leq l \leq r \leq... | java | import java.io.ByteArrayInputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.Arrays;
import java.util.InputMismatchException;
public class Main {
static InputStream is;
static PrintWriter out;
static String INPUT = "";
static void solve()
{
int n = ... | all_fail | 0 | 2 | [{"idx": 0, "reason": "wrong_answer", "expected": "50 50 50 30 70", "got": "34 33 33 34 33"}, {"idx": 1, "reason": "wrong_answer", "expected": "1 2 3 4", "got": "1 1 1 1"}] | atcoder | UNKNOWN | |
776 | p02797 Keyence Programming Contest 2020 - Subarray Sum | Given are three integers N, K, and S.
Find a sequence A_1, A_2, ..., A_N of N integers between 1 and 10^9 (inclusive) that satisfies the condition below. We can prove that, under the conditions in Constraints, such a sequence always exists.
* There are exactly K pairs (l, r) of integers such that 1 \leq l \leq r \leq... | python2 | n, k, s = map(int, raw_input().split())
if s == 10 ** 9:
a = [s] * k + [1] * (n - k)
else:
a = [s] * k + [s + 1] * (n - k)
for x in a:
print x,
print
| all_fail | 0 | 2 | [{"idx": 0, "reason": "wrong_answer", "expected": "50 50 50 30 70", "got": "100 100 100 101 101"}, {"idx": 1, "reason": "wrong_answer", "expected": "1 2 3 4", "got": "3 3 4 4"}] | atcoder | UNKNOWN | |
776 | p02797 Keyence Programming Contest 2020 - Subarray Sum | Given are three integers N, K, and S.
Find a sequence A_1, A_2, ..., A_N of N integers between 1 and 10^9 (inclusive) that satisfies the condition below. We can prove that, under the conditions in Constraints, such a sequence always exists.
* There are exactly K pairs (l, r) of integers such that 1 \leq l \leq r \leq... | python2 | n,k,s = map(int, raw_input().split())
r = [s] * k
if s == 10 ** 9:
for i in range(n - k): r.append((10 ** 9) - 2)
else:
for i in range(n - k): r.append(s + 1)
for a in r: print a,
| all_fail | 0 | 2 | [{"idx": 0, "reason": "wrong_answer", "expected": "50 50 50 30 70", "got": "100 100 100 101 101"}, {"idx": 1, "reason": "wrong_answer", "expected": "1 2 3 4", "got": "3 3 4 4"}] | atcoder | UNKNOWN | |
776 | p02797 Keyence Programming Contest 2020 - Subarray Sum | Given are three integers N, K, and S.
Find a sequence A_1, A_2, ..., A_N of N integers between 1 and 10^9 (inclusive) that satisfies the condition below. We can prove that, under the conditions in Constraints, such a sequence always exists.
* There are exactly K pairs (l, r) of integers such that 1 \leq l \leq r \leq... | python2 | input = raw_input
n, k, s = map(int, input().split(" "))
if s == 10**9:
M = 1
else:
M = s + 1
if s % 2 == 0:
a1 = s // 2
a2 = a1
else:
a1 = s // 2
a2 = a1 + 1
if k == n:
for i in range(n-1):
print s,
print s
else:
for i in range(k):
print s,
for i in range(n-k... | all_fail | 0 | 2 | [{"idx": 0, "reason": "wrong_answer", "expected": "50 50 50 30 70", "got": "100 100 100 101 101"}, {"idx": 1, "reason": "wrong_answer", "expected": "1 2 3 4", "got": "3 3 4 4"}] | atcoder | UNKNOWN | |
778 | p03069 Tenka1 Programmer Beginner Contest 2019 - Stones | There are N stones arranged in a row. Every stone is painted white or black. A string S represents the color of the stones. The i-th stone from the left is white if the i-th character of S is `.`, and the stone is black if the character is `#`.
Takahashi wants to change the colors of some stones to black or white so t... | cpp | #include "bits/stdc++.h"
using namespace std;
int main() {
int N;
string S;
cin >> N >> S;
int cnt1 = 0, cnt2 = 0;
for (int i = 0; i < N; i++) {
if (S[i] == '.') cnt2++;
}
int ans = cnt2;
for (int i = 0; i < N; i++) {
if (S[i] == '#') cnt1++;
else cnt2--;
... | partial | 2 | 4 | [{"idx": 0, "reason": "wrong_answer", "expected": "1", "got": "0"}, {"idx": 1, "reason": "wrong_answer", "expected": "2", "got": "1"}] | atcoder | UNKNOWN | |
778 | p03069 Tenka1 Programmer Beginner Contest 2019 - Stones | There are N stones arranged in a row. Every stone is painted white or black. A string S represents the color of the stones. The i-th stone from the left is white if the i-th character of S is `.`, and the stone is black if the character is `#`.
Takahashi wants to change the colors of some stones to black or white so t... | python3 | n = int(input())
s = input()
black = 0
ans = white = s.count('.')
for i in range(n):
if s[i] == "#":
black += 1
else:
white -= 1
ans = min(ans, black+white)
print(ans)
| partial | 2 | 4 | [{"idx": 0, "reason": "runtime_error", "rc": 1, "stderr": "Traceback (most recent call last):\n File \"/tmp/sbx_zj1x1e2j/tmp3gnjg2hi.py\", line 7, in <module>\n if s[i] == \"#\":\n ~^^^\nIndexError: string index out of range\n", "stdout_tail": ""}, {"idx": 1, "reason": "runtime_error", "rc": 1, "stderr": "Tra... | atcoder | UNKNOWN | |
778 | p03069 Tenka1 Programmer Beginner Contest 2019 - Stones | There are N stones arranged in a row. Every stone is painted white or black. A string S represents the color of the stones. The i-th stone from the left is white if the i-th character of S is `.`, and the stone is black if the character is `#`.
Takahashi wants to change the colors of some stones to black or white so t... | python3 | n=int(input());a=[0];b=[0]
for i in input():t=i=='.';a+=[a[-1]+t];b+=[b[-1]+1-t*2];
print(min([i+a[n] for i in b])) | partial | 2 | 4 | [{"idx": 0, "reason": "runtime_error", "rc": 1, "stderr": "Traceback (most recent call last):\n File \"/tmp/sbx_inyqv2ia/tmp0zspmves.py\", line 3, in <module>\n print(min([i+a[n] for i in b]))\n ~^^^\nIndexError: list index out of range\n", "stdout_tail": ""}, {"idx": 1, "reason": "runtime_error", "... | atcoder | UNKNOWN | |
778 | p03069 Tenka1 Programmer Beginner Contest 2019 - Stones | There are N stones arranged in a row. Every stone is painted white or black. A string S represents the color of the stones. The i-th stone from the left is white if the i-th character of S is `.`, and the stone is black if the character is `#`.
Takahashi wants to change the colors of some stones to black or white so t... | python3 | n = int(input())
s = input()
num = s.count('.')
nums = [num]
for c in s:
if c == '#':
num += 1
else:
num -= 1
nums.append(num)
print(min(nums))
| partial | 2 | 4 | [{"idx": 0, "reason": "wrong_answer", "expected": "1", "got": "0"}, {"idx": 1, "reason": "wrong_answer", "expected": "2", "got": "1"}] | atcoder | UNKNOWN | |
778 | p03069 Tenka1 Programmer Beginner Contest 2019 - Stones | There are N stones arranged in a row. Every stone is painted white or black. A string S represents the color of the stones. The i-th stone from the left is white if the i-th character of S is `.`, and the stone is black if the character is `#`.
Takahashi wants to change the colors of some stones to black or white so t... | cpp | #include <stdio.h>
#include <algorithm>
const int N = 200005;
char a[N];
int main() {
int n;
scanf("%d %s", &n, a);
int w = 0;
for (int i = 0; i < n; i++) {
w += (a[i] == '.');
}
int b = 0;
int ans = (1 << 30);
for (int i = 0; i < n; i++) {
ans = std::min(ans, b + w);
if (a[i] == '#') {
... | partial | 2 | 4 | [{"idx": 0, "reason": "wrong_answer", "expected": "1", "got": "0"}, {"idx": 1, "reason": "wrong_answer", "expected": "2", "got": "1"}] | atcoder | UNKNOWN | |
778 | p03069 Tenka1 Programmer Beginner Contest 2019 - Stones | There are N stones arranged in a row. Every stone is painted white or black. A string S represents the color of the stones. The i-th stone from the left is white if the i-th character of S is `.`, and the stone is black if the character is `#`.
Takahashi wants to change the colors of some stones to black or white so t... | java | import java.util.*;
import java.io.*;
public class Main {
public static void main(String[] args) {
FastScanner sc = new FastScanner();
int n = sc.nextInt();
String s = sc.next();
List<Integer> black = new ArrayList<>();
int cnt = 0;
black.add(0);
for (int i =... | partial | 2 | 4 | [{"idx": 0, "reason": "runtime_error", "rc": 1, "stderr": "Exception in thread \"main\" java.lang.StringIndexOutOfBoundsException: String index out of range: 2\n\tat java.base/java.lang.StringLatin1.charAt(StringLatin1.java:48)\n\tat java.base/java.lang.String.char", "stdout_tail": ""}, {"idx": 1, "reason": "runtime_er... | atcoder | UNKNOWN | |
778 | p03069 Tenka1 Programmer Beginner Contest 2019 - Stones | There are N stones arranged in a row. Every stone is painted white or black. A string S represents the color of the stones. The i-th stone from the left is white if the i-th character of S is `.`, and the stone is black if the character is `#`.
Takahashi wants to change the colors of some stones to black or white so t... | cpp | #include<bits/stdc++.h>
using namespace std;
using ll = long long;
using P = pair<ll,string>;
using Map = map<string,ll>;
int main(){
ll N;
cin >> N;
string S;
cin >> S;
ll wcounter=0;
for(ll i=0;i<N;i++){
if(S[i]=='.')wcounter++;
;}
ll ans=wcounter;
ll num=wcounter;
for(ll i=0;i<N;i++){
if(S[i]=='#')n... | partial | 2 | 4 | [{"idx": 0, "reason": "wrong_answer", "expected": "1", "got": "0"}, {"idx": 1, "reason": "wrong_answer", "expected": "2", "got": "1"}] | atcoder | UNKNOWN | |
778 | p03069 Tenka1 Programmer Beginner Contest 2019 - Stones | There are N stones arranged in a row. Every stone is painted white or black. A string S represents the color of the stones. The i-th stone from the left is white if the i-th character of S is `.`, and the stone is black if the character is `#`.
Takahashi wants to change the colors of some stones to black or white so t... | java | import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.util.Arrays;
import java.util.Scanner;
public class Main {
public static void main(String[] args) {
Scanner scan = new Scanner(new BufferedReader(new InputStreamReader(System.in)));
int N = scan.nextInt();
String S... | partial | 2 | 4 | [{"idx": 0, "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:16)\n", "stdout_tail": ""}, {"idx": 1, "reason": "runtime_error", "rc": 1, "stderr": "Exception in thread \"main\" java.lang.Arra... | atcoder | UNKNOWN | |
778 | p03069 Tenka1 Programmer Beginner Contest 2019 - Stones | There are N stones arranged in a row. Every stone is painted white or black. A string S represents the color of the stones. The i-th stone from the left is white if the i-th character of S is `.`, and the stone is black if the character is `#`.
Takahashi wants to change the colors of some stones to black or white so t... | java |
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.Arrays;
import java.util.HashMap;
import java.util.Map;
import java.util.NoSuchElementException;
import java.util.stream.IntStream;
public class Main {
public static void main(String[] args) throws IOException {
n... | partial | 2 | 4 | [{"idx": 0, "reason": "runtime_error", "rc": 1, "stderr": "Exception in thread \"main\" java.lang.StringIndexOutOfBoundsException: String index out of range: 2\n\tat java.base/java.lang.StringLatin1.charAt(StringLatin1.java:48)\n\tat java.base/java.lang.String.char", "stdout_tail": ""}, {"idx": 1, "reason": "runtime_er... | atcoder | UNKNOWN | |
778 | p03069 Tenka1 Programmer Beginner Contest 2019 - Stones | There are N stones arranged in a row. Every stone is painted white or black. A string S represents the color of the stones. The i-th stone from the left is white if the i-th character of S is `.`, and the stone is black if the character is `#`.
Takahashi wants to change the colors of some stones to black or white so t... | python2 | import sys
from collections import deque
import copy
import math
def get_read_func(fileobject):
if fileobject == None :
return raw_input
else:
return fileobject.readline
def main():
if len(sys.argv) > 1:
f = open(sys.argv[1])
else:
f = None
read_func = get_read_fun... | partial | 2 | 4 | [{"idx": 0, "reason": "runtime_error", "rc": 1, "stderr": "Traceback (most recent call last):\n File \"/tmp/sbx_v_a8uokj/tmp_jqvumcm.py\", line 68, in <module>\n main()\n File \"/tmp/sbx_v_a8uokj/tmp_jqvumcm.py\", line 27, in main\n if S[i] != \"#\":\nIndexError", "stdout_tail": ""}, {"idx": 1, "reason": "runti... | atcoder | UNKNOWN | |
778 | p03069 Tenka1 Programmer Beginner Contest 2019 - Stones | There are N stones arranged in a row. Every stone is painted white or black. A string S represents the color of the stones. The i-th stone from the left is white if the i-th character of S is `.`, and the stone is black if the character is `#`.
Takahashi wants to change the colors of some stones to black or white so t... | python2 | # -*- coding: utf-8 -*-
n = int(raw_input())
s = str(raw_input())
ans=[]
black=[]
for i in range(0,n):
ans.append(-1)
black.append(-1)
ans[0]=0
if s[0]==".":
black[0]=0
else:
black[0]=1
for i in range(1,n):
if s[i] == ".":
black[i] = black[i-1]
ans[i] = min(black[i-1], ans[i-1]+1)
... | partial | 2 | 4 | [{"idx": 0, "reason": "runtime_error", "rc": 1, "stderr": "Traceback (most recent call last):\n File \"/tmp/sbx_t2vow6_2/tmph0363tj_.py\", line 17, in <module>\n if s[i] == \".\":\nIndexError: string index out of range\n", "stdout_tail": ""}, {"idx": 1, "reason": "runtime_error", "rc": 1, "stderr": "Traceback (most... | atcoder | UNKNOWN | |
778 | p03069 Tenka1 Programmer Beginner Contest 2019 - Stones | There are N stones arranged in a row. Every stone is painted white or black. A string S represents the color of the stones. The i-th stone from the left is white if the i-th character of S is `.`, and the stone is black if the character is `#`.
Takahashi wants to change the colors of some stones to black or white so t... | python2 | N=input()
S=raw_input()
L=[0]
for i,x in enumerate(S):
if x=="#":
L.append( L[-1]+1 )
else:
L.append( L[-1] )
ans=float("inf")
for i in range(N+1):
b=L[i] # black on left
w=N-i-(L[-1]-L[i]) # white on right
ans=min(ans , b+w)
print ans | partial | 2 | 4 | [{"idx": 0, "reason": "runtime_error", "rc": 1, "stderr": "Traceback (most recent call last):\n File \"/tmp/sbx_1706sqco/tmpgtgmt14e.py\", line 14, in <module>\n b=L[i]\t\t\t# black on left\nIndexError: list index out of range\n", "stdout_tail": ""}, {"idx": 1, "reason": "runtime_error", "rc": 1, "stderr": "Traceba... | atcoder | UNKNOWN | |
780 | p03361 AtCoder Beginner Contest 096 - Grid Repainting 2 | We have a canvas divided into a grid with H rows and W columns. The square at the i-th row from the top and the j-th column from the left is represented as (i, j).
Initially, all the squares are white. square1001 wants to draw a picture with black paint. His specific objective is to make Square (i, j) black when s_{i, ... | cpp | #include <iostream>
using namespace std;
int h, w, fl=1, a[55][55];
string s;
int main() {
int i, j;
cin>>h>>w;
for(i=1; i<=h; i++) {
cin>>s;
for(j=1; j<=w; j++) a[i][j] = s[j-1]=='.' ? 0:1;
}
for(i=1; i<=h; i++) for(j=1; j<=w; j++) {
if(a[i][j]==1 && a[i-1][j] + a[i+1][j] + a[i][j-1] + a[i][j+1] == 0) fl=0;... | partial | 3 | 4 | [{"idx": 1, "reason": "wrong_answer", "expected": "No", "got": "Yes"}] | atcoder | UNKNOWN | |
780 | p03361 AtCoder Beginner Contest 096 - Grid Repainting 2 | We have a canvas divided into a grid with H rows and W columns. The square at the i-th row from the top and the j-th column from the left is represented as (i, j).
Initially, all the squares are white. square1001 wants to draw a picture with black paint. His specific objective is to make Square (i, j) black when s_{i, ... | cpp | #include<iostream>
using namespace std;
int h,k;
char s[50][50];
int main(void){
cin>>h>>k;
for(int i=0;i<h;i++)for(int j=0;j<k;j++)cin>>s[i][j];
for(int i=0 ;i<h;i++)
for(int j=0 ;j<k;j++){
bool t=0;
if(s[i][j]=='#'){
if(i!=0&&s[i-1][j]=='#')t=1;
if(i!=h&&s[i+1][j]=='#')t=1;
... | partial | 3 | 4 | [{"idx": 2, "reason": "wrong_answer", "expected": "Yes", "got": "No"}] | atcoder | UNKNOWN | |
780 | p03361 AtCoder Beginner Contest 096 - Grid Repainting 2 | We have a canvas divided into a grid with H rows and W columns. The square at the i-th row from the top and the j-th column from the left is represented as (i, j).
Initially, all the squares are white. square1001 wants to draw a picture with black paint. His specific objective is to make Square (i, j) black when s_{i, ... | cpp | #include<stdio.h>
#include<iostream>
using namespace std;
int main()
{
int H, W,i,j,cnt=0;
char map[50][51];
cin >> H>>W;
for (i = 0; i < H; i++)
{
for (j = 0; j < W; j++)
{
cin >> map[i][j];
}
}
for (i = 0; i < H; i++)
{
for (j = 0; j < W; j++)
{
if (map[i][j] == '#' && map[i - 1][j] != '#' && ... | partial | 3 | 4 | [{"idx": 2, "reason": "wrong_answer", "expected": "Yes", "got": "No"}] | atcoder | UNKNOWN | |
780 | p03361 AtCoder Beginner Contest 096 - Grid Repainting 2 | We have a canvas divided into a grid with H rows and W columns. The square at the i-th row from the top and the j-th column from the left is represented as (i, j).
Initially, all the squares are white. square1001 wants to draw a picture with black paint. His specific objective is to make Square (i, j) black when s_{i, ... | java | import java.util.*;
import java.util.Arrays;
public class Main {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
int H = sc.nextInt();
int W = sc.nextInt();
String [][] s = new String[H+2][W+2];
for(int i = 0 ; i <= (H+1) ; i++){
for(i... | partial | 1 | 4 | [{"idx": 1, "reason": "runtime_error", "rc": 1, "stderr": "Exception in thread \"main\" java.lang.ArrayIndexOutOfBoundsException: Index 4 out of bounds for length 4\n\tat Main.main(Main.java:22)\n", "stdout_tail": ""}, {"idx": 2, "reason": "runtime_error", "rc": 1, "stderr": "Exception in thread \"main\" java.lang.Arra... | atcoder | UNKNOWN | |
780 | p03361 AtCoder Beginner Contest 096 - Grid Repainting 2 | We have a canvas divided into a grid with H rows and W columns. The square at the i-th row from the top and the j-th column from the left is represented as (i, j).
Initially, all the squares are white. square1001 wants to draw a picture with black paint. His specific objective is to make Square (i, j) black when s_{i, ... | python2 | h,w = map(int, raw_input().split())
P = []
for i in range(h):
p = list(raw_input())
P.append(p)
result = True
for i in range(h):
for j in range(w):
if P[i][j] == '#':
try:
up = P[i-1][j]
except:
up = ''
try:
down = ... | partial | 1 | 4 | [{"idx": 1, "reason": "runtime_error", "rc": 1, "stderr": "Traceback (most recent call last):\n File \"/tmp/sbx_bjzc6cum/tmpf60h9zbr.py\", line 10, in <module>\n if P[i][j] == '#':\nIndexError: list index out of range\n", "stdout_tail": ""}, {"idx": 2, "reason": "runtime_error", "rc": 1, "stderr": "Traceback (most ... | atcoder | UNKNOWN | |
780 | p03361 AtCoder Beginner Contest 096 - Grid Repainting 2 | We have a canvas divided into a grid with H rows and W columns. The square at the i-th row from the top and the j-th column from the left is represented as (i, j).
Initially, all the squares are white. square1001 wants to draw a picture with black paint. His specific objective is to make Square (i, j) black when s_{i, ... | 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();
int[][] s = new int[H+2][W+2];
boolean able = true;
for(int i = 1; i <= H; i++){
String scan = sc.next();
for(int j = 1; j <= W; j++){
... | partial | 1 | 4 | [{"idx": 1, "reason": "runtime_error", "rc": 1, "stderr": "Exception in thread \"main\" java.lang.StringIndexOutOfBoundsException: String index out of range: 4\n\tat java.base/java.lang.StringLatin1.charAt(StringLatin1.java:48)\n\tat java.base/java.lang.String.char", "stdout_tail": ""}, {"idx": 2, "reason": "runtime_er... | atcoder | UNKNOWN | |
780 | p03361 AtCoder Beginner Contest 096 - Grid Repainting 2 | We have a canvas divided into a grid with H rows and W columns. The square at the i-th row from the top and the j-th column from the left is represented as (i, j).
Initially, all the squares are white. square1001 wants to draw a picture with black paint. His specific objective is to make Square (i, j) black when s_{i, ... | java | import java.util.Scanner;
class Main{
public static void main(String arg[]) {
Scanner sc = new Scanner(System.in);
int H = sc.nextInt();
int W = sc.nextInt();
sc.nextLine();
String[] str = new String[H];
String[][] S = new String[H][W];
for(int i = 0; i < H; i++ ) {
str[i]= sc.nextLine();
}
s... | partial | 1 | 4 | [{"idx": 1, "reason": "runtime_error", "rc": 1, "stderr": "Exception in thread \"main\" java.lang.ArrayIndexOutOfBoundsException: Index 4 out of bounds for length 4\n\tat Main.main(Main.java:20)\n", "stdout_tail": ""}, {"idx": 2, "reason": "runtime_error", "rc": 1, "stderr": "Exception in thread \"main\" java.lang.Arra... | atcoder | UNKNOWN | |
780 | p03361 AtCoder Beginner Contest 096 - Grid Repainting 2 | We have a canvas divided into a grid with H rows and W columns. The square at the i-th row from the top and the j-th column from the left is represented as (i, j).
Initially, all the squares are white. square1001 wants to draw a picture with black paint. His specific objective is to make Square (i, j) black when s_{i, ... | python3 | import sys
h, w = map(int, input().split())
s = [list(input()) for i in range(h)]
for i in range(h):
for j in range(w):
if s[i][j] == "#" and (i == 0 or s[i-1][j] == ".") and (i == h-1 or s[i+1][j] == ".") and (j == 0 or s[i][j-1] == ".") and (j == w-1 or s[i][j+1] == "."):
print("No")
... | partial | 1 | 4 | [{"idx": 1, "reason": "runtime_error", "rc": 1, "stderr": "Traceback (most recent call last):\n File \"/tmp/sbx_o0ape85q/tmp_3q5iypt.py\", line 6, in <module>\n if s[i][j] == \"#\" and (i == 0 or s[i-1][j] == \".\") and (i == h-1 or s[i+1][j] == \".\") and (j == 0 ", "stdout_tail": ""}, {"idx": 2, "reason": "runtim... | atcoder | UNKNOWN | |
780 | p03361 AtCoder Beginner Contest 096 - Grid Repainting 2 | We have a canvas divided into a grid with H rows and W columns. The square at the i-th row from the top and the j-th column from the left is represented as (i, j).
Initially, all the squares are white. square1001 wants to draw a picture with black paint. His specific objective is to make Square (i, j) black when s_{i, ... | python3 | h, w = map(int, input().split())
S = ["."*(w+2)] + [ "."+input()+"." for _ in range(h) ] + ["."*(w+2)]
for i in range(h+2):
for j in range(w+2):
if S[i][j] == "#":
for k in range(4):
if S[i+1][j] != "#" and S[i][j+1] != "#" and S[i-1][j] != "#" and S[i][j-1] != "#":
print("No")
e... | partial | 1 | 4 | [{"idx": 1, "reason": "runtime_error", "rc": 1, "stderr": "Traceback (most recent call last):\n File \"/tmp/sbx_doad8m9q/tmpd29r4ed7.py\", line 5, in <module>\n if S[i][j] == \"#\":\n ~~~~^^^\nIndexError: string index out of range\n", "stdout_tail": ""}, {"idx": 2, "reason": "runtime_error", "rc": 1, "stderr"... | atcoder | UNKNOWN | |
780 | p03361 AtCoder Beginner Contest 096 - Grid Repainting 2 | We have a canvas divided into a grid with H rows and W columns. The square at the i-th row from the top and the j-th column from the left is represented as (i, j).
Initially, all the squares are white. square1001 wants to draw a picture with black paint. His specific objective is to make Square (i, j) black when s_{i, ... | python3 | h, w = map(int, input().split())
s = [list(input()) for i in range(h)]
ans = "Yes"
for i in range(1, h - 1):
for j in range(1, w - 1):
if s[i][j] == "#" and s[i-1][j] == "." and s[i][j-1] == "." and s[i+1][j] == "." and s[i][j+1] == ".":
ans = "No"
print(ans) | partial | 1 | 4 | [{"idx": 1, "reason": "wrong_answer", "expected": "No", "got": "Yes"}, {"idx": 2, "reason": "runtime_error", "rc": 1, "stderr": "Traceback (most recent call last):\n File \"/tmp/sbx_t6r9lxl_/tmplr_6i3zc.py\", line 6, in <module>\n if s[i][j] == \"#\" and s[i-1][j] == \".\" and s[i][j-1] == \".\" and s[i+1][j] == \"... | atcoder | UNKNOWN | |
780 | p03361 AtCoder Beginner Contest 096 - Grid Repainting 2 | We have a canvas divided into a grid with H rows and W columns. The square at the i-th row from the top and the j-th column from the left is represented as (i, j).
Initially, all the squares are white. square1001 wants to draw a picture with black paint. His specific objective is to make Square (i, j) black when s_{i, ... | python2 | h,w = map(int,raw_input().split())
canv = [[] for i in range(h+2)]
canv[0]=canv[-1] = '.'*(w+2)
for i in range(1,h+1): # . input .
canv[i] = '.' + raw_input() + '.'
noflag = False
for i in range(1,h+1):
if noflag:
break
for j in range(1,w+1):
if canv[i][j] == '#':
if canv[i+1][j]... | partial | 1 | 4 | [{"idx": 1, "reason": "wrong_answer", "expected": "No", "got": "Yes"}, {"idx": 2, "reason": "runtime_error", "rc": 1, "stderr": "Traceback (most recent call last):\n File \"/tmp/sbx_9u3shlhz/tmpp91to34j.py\", line 11, in <module>\n if canv[i][j] == '#':\nIndexError: string index out of range\n", "stdout_tail": ""},... | atcoder | UNKNOWN | |
780 | p03361 AtCoder Beginner Contest 096 - Grid Repainting 2 | We have a canvas divided into a grid with H rows and W columns. The square at the i-th row from the top and the j-th column from the left is represented as (i, j).
Initially, all the squares are white. square1001 wants to draw a picture with black paint. His specific objective is to make Square (i, j) black when s_{i, ... | python2 | dxy = [[0, 1], [1, 0], [0, -1], [-1, 0]]
def solve():
H, W = map(int, raw_input().split())
s = [raw_input() for i in xrange(H)]
for y in xrange(H):
for x in xrange(W):
if s[y][x] == "#":
for dx, dy in dxy:
nx, ny = x + dx, y + dy
i... | partial | 1 | 4 | [{"idx": 1, "reason": "runtime_error", "rc": 1, "stderr": "Traceback (most recent call last):\n File \"/tmp/sbx_uzec7rz0/tmpz20ndz3r.py\", line 19, in <module>\n print \"Yes\" if solve() else \"No\"\n File \"/tmp/sbx_uzec7rz0/tmpz20ndz3r.py\", line 8, in solve\n ", "stdout_tail": ""}, {"idx": 2, "reason": "runt... | atcoder | UNKNOWN | |
785 | p00222 Prime Quadruplet | A set of four prime numbers arranged like (a, a + 2, a + 6, a + 8) is called a quadruplet prime number. Of the four prime numbers that make up a quadruplet prime, the largest number is called the size of the quadruplet prime. For example, the smallest prime quadruplet is a set of (5, 7, 11, 13), which is 13 in size. Th... | java | import java.util.*;
public class Main {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
int primax = 10000000;
int[] pri = new int[primax+10000];
for(int i=2;i<=primax;i++) pri[i] = i;
for(int i=2;i<=primax+1;i++){
for(int j=i+i;j<=primax;j+=i){
pri[j]=0;
}
}
... | all_fail | 0 | 1 | [{"idx": 0, "reason": "timeout"}] | aizu | UNKNOWN | |
788 | p00876 Swimming Jam | Despite urging requests of the townspeople, the municipal office cannot afford to improve many of the apparently deficient city amenities under this recession. The city swimming pool is one of the typical examples. It has only two swimming lanes. The Municipal Fitness Agency, under this circumstances, settled usage rul... | cpp | #include <iostream>
#include <algorithm>
#include <vector>
#include <map>
#include <cmath>
using namespace std;
const int N = 50;
const double EPS = 1e-8;
int n;
vector<pair<double, int> > data;
bool equals(double a, double b){ return abs(a - b) < EPS; }
int solve(){
pair<double, double> dist[N];
int round[N],... | compile_error | 0 | 0 | COMPILE_ERROR:/tmp/sbx_yq8px4gg/tmpjeakyf4b.cpp: In function ‘int solve()’:
/tmp/sbx_yq8px4gg/tmpjeakyf4b.cpp:25:29: error: reference to ‘data’ is ambiguous
25 | for(int i=0;i<n;i++) if(data[i].second) goto CONT; break;
| ^~~~
In file included from /usr/include/c++/11/string:54,... | [] | aizu | UNKNOWN |
804 | 1003_E. Tree Constructing | You are given three integers n, d and k.
Your task is to construct an undirected tree on n vertices with diameter d and degree of each vertex at most k, or say that it is impossible.
An undirected tree is a connected undirected graph with n - 1 edges.
Diameter of a tree is the maximum length of a simple path (a path... | cpp | #include <bits/stdc++.h>
int n, d, k, x, z;
std::vector<int> V1, V2;
void add(int u, int v) {
V1.push_back(u);
V2.push_back(v);
}
void dfs(int u, int dd, int p) {
if (p)
while (dd--) {
if (x >= n) return;
add(u, ++x);
dfs(x, k - 1, p - 1);
}
}
int main() {
std::cin >> n >> d >> k;
z ... | partial | 16 | 25 | [{"idx": 0, "reason": "wrong_answer", "expected": "YES\n1 2\n2 3\n3 4\n4 5\n5 6\n2 7\n3 8", "got": "YES\n1 2\n1 3\n3 4\n3 5\n1 6\n2 7\n7 8"}, {"idx": 1, "reason": "wrong_answer", "expected": "YES\n1 2\n2 3\n3 4\n2 5\n3 6", "got": "YES\n1 2\n1 3\n1 4\n2 5\n2 6"}, {"idx": 2, "reason": "wrong_answer", "expected": "YES\n1 ... | codeforces | E | |
804 | 1003_E. Tree Constructing | You are given three integers n, d and k.
Your task is to construct an undirected tree on n vertices with diameter d and degree of each vertex at most k, or say that it is impossible.
An undirected tree is a connected undirected graph with n - 1 edges.
Diameter of a tree is the maximum length of a simple path (a path... | java | import java.util.*;
import java.io.*;
import java.text.*;
public class Main {
static BufferedReader br = new BufferedReader(new InputStreamReader(System.in), 32768);
static PrintWriter out = new PrintWriter(System.out);
static StringTokenizer t;
static String sn() {
while (t == null || !t.hasM... | partial | 23 | 25 | [{"idx": 2, "reason": "wrong_answer", "expected": "YES\n1 2\n2 3\n3 4\n4 5\n2 6\n3 7\n7 8\n7 9\n4 10", "got": "YES\n1 2\n2 3\n3 4\n4 5\n2 6\n3 7\n4 8\n7 9\n7 10"}, {"idx": 5, "reason": "wrong_answer", "expected": "YES\n1 2\n2 3\n3 4\n4 5\n5 6\n6 7\n2 8\n3 9\n9 10\n9 11\n4 12\n12 13\n13 14\n13 15\n12 16\n16 17\n16 18\n5... | codeforces | E | |
804 | 1003_E. Tree Constructing | You are given three integers n, d and k.
Your task is to construct an undirected tree on n vertices with diameter d and degree of each vertex at most k, or say that it is impossible.
An undirected tree is a connected undirected graph with n - 1 edges.
Diameter of a tree is the maximum length of a simple path (a path... | cpp | #include <bits/stdc++.h>
#pragma GCC optimize("-O3")
using namespace std;
long long MOD = 1e9 + 7;
long long exp(long long n, long long e) {
if (e == 0) return 1;
long long temp = exp((n * n) % MOD, e / 2);
return e % 2 == 0 ? temp : (temp * n) % MOD;
}
int cnt = 0;
long long n, d, k;
void extend(int n, int N, ve... | partial | 13 | 25 | [{"idx": 0, "reason": "wrong_answer", "expected": "YES\n1 2\n2 3\n3 4\n4 5\n5 6\n2 7\n3 8", "got": "YES\n2 1\n2 7\n3 2\n3 8\n4 3\n5 4\n6 5"}, {"idx": 1, "reason": "wrong_answer", "expected": "YES\n1 2\n2 3\n3 4\n2 5\n3 6", "got": "YES\n2 1\n2 5\n3 2\n3 6\n4 3"}, {"idx": 2, "reason": "wrong_answer", "expected": "YES\n1 ... | codeforces | E | |
804 | 1003_E. Tree Constructing | You are given three integers n, d and k.
Your task is to construct an undirected tree on n vertices with diameter d and degree of each vertex at most k, or say that it is impossible.
An undirected tree is a connected undirected graph with n - 1 edges.
Diameter of a tree is the maximum length of a simple path (a path... | java | import java.io.*;
import java.util.*;
import java.text.*;
import java.lang.*;
import java.math.BigInteger;
import java.util.regex.*;
public class Myclass {
public static ArrayList a[]=new ArrayList[100001];
static boolean visited[]=new boolean [100001];
static HashMap<Integer,Integer>hm=new HashMap<>();
static ... | partial | 16 | 25 | [{"idx": 0, "reason": "wrong_answer", "expected": "YES\n1 2\n2 3\n3 4\n4 5\n5 6\n2 7\n3 8", "got": "YES\n2 1\n3 2\n4 3\n5 4\n6 5\n3 7\n4 8"}, {"idx": 1, "reason": "wrong_answer", "expected": "YES\n1 2\n2 3\n3 4\n2 5\n3 6", "got": "YES\n2 1\n3 2\n4 3\n2 5\n3 6"}, {"idx": 2, "reason": "wrong_answer", "expected": "YES\n1 ... | codeforces | E | |
804 | 1003_E. Tree Constructing | You are given three integers n, d and k.
Your task is to construct an undirected tree on n vertices with diameter d and degree of each vertex at most k, or say that it is impossible.
An undirected tree is a connected undirected graph with n - 1 edges.
Diameter of a tree is the maximum length of a simple path (a path... | java | /*
If you want to aim high, aim high
Don't let that studying and grades consume you
Just live life young
******************************
What do you think? What do you think?
1st on Billboard, what do you think of it
Next is a Grammy, what do you think of it
However you think, I’m sorry, but shit, I have no fcking inter... | partial | 20 | 25 | [{"idx": 0, "reason": "wrong_answer", "expected": "YES\n1 2\n2 3\n3 4\n4 5\n5 6\n2 7\n3 8", "got": "YES\n1 2\n2 3\n2 7\n3 4\n3 8\n4 5\n5 6"}, {"idx": 1, "reason": "wrong_answer", "expected": "YES\n1 2\n2 3\n3 4\n2 5\n3 6", "got": "YES\n1 2\n2 3\n2 5\n3 4\n3 6"}, {"idx": 2, "reason": "wrong_answer", "expected": "YES\n1 ... | codeforces | E | |
804 | 1003_E. Tree Constructing | You are given three integers n, d and k.
Your task is to construct an undirected tree on n vertices with diameter d and degree of each vertex at most k, or say that it is impossible.
An undirected tree is a connected undirected graph with n - 1 edges.
Diameter of a tree is the maximum length of a simple path (a path... | python3 | def main():
n, d, k = map(int, input().split())
r, odd = divmod(d, 2)
k -= 1
cap = d + 1 if k == 1 else 1
if k > 1:
cap = 2 * (k ** (r + 1) - 1) // (k - 1) if odd else 1 + (k + 1) * (k ** r - 1) // (k - 1)
if n == 1 or k < 1 < n - 1 or k == 1 and d != n - 1 or d >= n or k > 1 and not d <... | partial | 21 | 25 | [{"idx": 0, "reason": "wrong_answer", "expected": "YES\n1 2\n2 3\n3 4\n4 5\n5 6\n2 7\n3 8", "got": "YES\n1 2\n2 3\n3 4\n4 5\n5 6\n3 7\n7 8"}, {"idx": 2, "reason": "wrong_answer", "expected": "YES\n1 2\n2 3\n3 4\n4 5\n2 6\n3 7\n7 8\n7 9\n4 10", "got": "YES\n1 2\n2 3\n3 4\n4 5\n3 6\n6 7\n6 8\n2 9\n4 10"}, {"idx": 5, "rea... | codeforces | E | |
804 | 1003_E. Tree Constructing | You are given three integers n, d and k.
Your task is to construct an undirected tree on n vertices with diameter d and degree of each vertex at most k, or say that it is impossible.
An undirected tree is a connected undirected graph with n - 1 edges.
Diameter of a tree is the maximum length of a simple path (a path... | python3 |
import sys
n,d,k=map(int,input().split())
if(n<=d):
print('NO')
sys.exit()
if(k==1 and n>2):
print('NO')
sys.exit()
edgestot=[]
edges=[[] for i in range(n)]
tovisit=[]
for i in range(d):
edgestot.append([i,i+1])
tovisit.append([i+1,min(i+1,d-i-1)])
edges[i].append(i+1)
edges[i+1].appen... | partial | 20 | 25 | [{"idx": 0, "reason": "wrong_answer", "expected": "YES\n1 2\n2 3\n3 4\n4 5\n5 6\n2 7\n3 8", "got": "YES\n1 2\n2 3\n3 4\n4 5\n5 6\n7 5\n8 4"}, {"idx": 1, "reason": "wrong_answer", "expected": "YES\n1 2\n2 3\n3 4\n2 5\n3 6", "got": "YES\n1 2\n2 3\n3 4\n5 3\n6 2"}, {"idx": 2, "reason": "wrong_answer", "expected": "YES\n1 ... | codeforces | E | |
804 | 1003_E. Tree Constructing | You are given three integers n, d and k.
Your task is to construct an undirected tree on n vertices with diameter d and degree of each vertex at most k, or say that it is impossible.
An undirected tree is a connected undirected graph with n - 1 edges.
Diameter of a tree is the maximum length of a simple path (a path... | python3 | import sys
input = sys.stdin.buffer.readline
from collections import deque
n,d,k=map(int,input().split())
if d>=n:
print("NO")
exit()
graph=[[] for i in range(n+1)]
for i in range(1,d+2):
graph[i].append(min(i-1,d+1-i))
# print(graph)
for i in range(1,d+1):
graph[i].append(i+1)
graph[i+1].app... | partial | 20 | 25 | [{"idx": 0, "reason": "wrong_answer", "expected": "YES\n1 2\n2 3\n3 4\n4 5\n5 6\n2 7\n3 8", "got": "YES\n1 2\n2 3\n2 7\n3 4\n3 8\n4 5\n5 6"}, {"idx": 1, "reason": "wrong_answer", "expected": "YES\n1 2\n2 3\n3 4\n2 5\n3 6", "got": "YES\n1 2\n2 3\n2 5\n3 4\n3 6"}, {"idx": 2, "reason": "wrong_answer", "expected": "YES\n1 ... | codeforces | E | |
804 | 1003_E. Tree Constructing | You are given three integers n, d and k.
Your task is to construct an undirected tree on n vertices with diameter d and degree of each vertex at most k, or say that it is impossible.
An undirected tree is a connected undirected graph with n - 1 edges.
Diameter of a tree is the maximum length of a simple path (a path... | python2 | def main():
n, d, k = list(map(int, raw_input().split()))
if n == 2 and d == 1 and k == 1:
print("YES")
print "1 2"
return 0
if n == d + 1 and k - 1:
print("YES")
for i in range(1, d + 1):
print i, i + 1
return 0
if n < d +1 or k <= 2 or d == ... | partial | 21 | 25 | [{"idx": 0, "reason": "wrong_answer", "expected": "YES\n1 2\n2 3\n3 4\n4 5\n5 6\n2 7\n3 8", "got": "YES\n1 2\n2 3\n3 4\n4 5\n5 6\n3 7\n4 8"}, {"idx": 2, "reason": "wrong_answer", "expected": "YES\n1 2\n2 3\n3 4\n4 5\n2 6\n3 7\n7 8\n7 9\n4 10", "got": "YES\n1 2\n2 3\n3 4\n4 5\n3 6\n6 7\n6 8\n2 9\n4 10"}, {"idx": 5, "rea... | codeforces | E | |
804 | 1003_E. Tree Constructing | You are given three integers n, d and k.
Your task is to construct an undirected tree on n vertices with diameter d and degree of each vertex at most k, or say that it is impossible.
An undirected tree is a connected undirected graph with n - 1 edges.
Diameter of a tree is the maximum length of a simple path (a path... | 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,d,k = map... | all_fail | 0 | 25 | [{"idx": 0, "reason": "runtime_error", "rc": 1, "stderr": "Traceback (most recent call last):\n File \"/tmp/sbx_p2y41str/tmp8fz3x1pq.py\", line 10, in <module>\n n,d,k = map(int,raw_input().split(\" \"))\nValueError: invalid literal for int() with base 10: ''\n", "stdout_tail": ""}, {"idx": 1, "reason": "runtime_er... | codeforces | E | |
804 | 1003_E. Tree Constructing | You are given three integers n, d and k.
Your task is to construct an undirected tree on n vertices with diameter d and degree of each vertex at most k, or say that it is impossible.
An undirected tree is a connected undirected graph with n - 1 edges.
Diameter of a tree is the maximum length of a simple path (a path... | python2 | def main():
n, d, k = list(map(int, raw_input().split()))
if n == 2 and d == 1 and k == 1:
print("YES")
print "1 2"
return 0
if n == d + 1 and k - 1:
print("YES")
for i in range(1, d + 1):
print i, i + 1
return 0
if n < d +1 or k <= 2 or d == ... | partial | 21 | 25 | [{"idx": 0, "reason": "wrong_answer", "expected": "YES\n1 2\n2 3\n3 4\n4 5\n5 6\n2 7\n3 8", "got": "YES\n1 2\n2 3\n3 4\n4 5\n5 6\n3 7\n4 8"}, {"idx": 2, "reason": "wrong_answer", "expected": "YES\n1 2\n2 3\n3 4\n4 5\n2 6\n3 7\n7 8\n7 9\n4 10", "got": "YES\n1 2\n2 3\n3 4\n4 5\n3 6\n6 7\n6 8\n2 9\n4 10"}, {"idx": 5, "rea... | codeforces | E | |
806 | 1046_E. Ancient civilizations | On the surface of a newly discovered planet, which we model by a plane, explorers found remains of two different civilizations in various locations. They would like to learn more about those civilizations and to explore the area they need to build roads between some of locations. But as always, there are some restricti... | cpp | #include <bits/stdc++.h>
using namespace std;
struct point {
int x, y, op, id;
} p[1100];
int multi(point p1, point p2, point p0) {
int x1, y1, x2, y2;
x1 = p1.x - p0.x;
y1 = p1.y - p0.y;
x2 = p2.x - p0.x;
y2 = p2.y - p0.y;
return x1 * y2 - x2 * y1;
}
bool cmp(point p1, point p2) { return multi(p1, p2, p[... | partial | 4 | 9 | [{"idx": 0, "reason": "wrong_answer", "expected": "3\n1 4\n4 2\n3 0", "got": "3\n1 4\n4 2\n0 3"}, {"idx": 2, "reason": "wrong_answer", "expected": "6\n7 2\n2 0\n0 3\n3 1\n1 4\n7 6", "got": "6\n2 0\n0 3\n3 1\n1 4\n4 7\n7 6"}, {"idx": 5, "reason": "wrong_answer", "expected": "6\n0 1\n2 7\n1 3\n7 5\n6 0\n5 4", "got": "6\n... | codeforces | E | |
806 | 1046_E. Ancient civilizations | On the surface of a newly discovered planet, which we model by a plane, explorers found remains of two different civilizations in various locations. They would like to learn more about those civilizations and to explore the area they need to build roads between some of locations. But as always, there are some restricti... | cpp | #include <bits/stdc++.h>
using namespace std;
long long read() {
long long x = 0, f = 0;
char ch = getchar();
while (!isdigit(ch)) f |= ch == '-', ch = getchar();
while (isdigit(ch)) x = (x << 1) + (x << 3) + (ch ^ 48), ch = getchar();
return f ? -x : x;
}
const int N = 1005;
int n;
struct Point {
int x, y;... | partial | 4 | 9 | [{"idx": 0, "reason": "wrong_answer", "expected": "3\n1 4\n4 2\n3 0", "got": "3\n1 4\n4 2\n0 3"}, {"idx": 2, "reason": "wrong_answer", "expected": "6\n7 2\n2 0\n0 3\n3 1\n1 4\n7 6", "got": "6\n2 0\n0 3\n3 1\n1 4\n4 7\n2 6"}, {"idx": 5, "reason": "wrong_answer", "expected": "6\n0 1\n2 7\n1 3\n7 5\n6 0\n5 4", "got": "6\n... | codeforces | E | |
806 | 1046_E. Ancient civilizations | On the surface of a newly discovered planet, which we model by a plane, explorers found remains of two different civilizations in various locations. They would like to learn more about those civilizations and to explore the area they need to build roads between some of locations. But as always, there are some restricti... | cpp | #include <bits/stdc++.h>
using namespace std;
template <typename _T>
inline void read(_T &f) {
f = 0;
_T fu = 1;
char c = getchar();
while (c < '0' || c > '9') {
if (c == '-') {
fu = -1;
}
c = getchar();
}
while (c >= '0' && c <= '9') {
f = (f << 3) + (f << 1) + (c & 15);
c = getch... | partial | 3 | 9 | [{"idx": 0, "reason": "wrong_answer", "expected": "3\n1 4\n4 2\n3 0", "got": "3\n2 4\n0 3\n4 1"}, {"idx": 2, "reason": "wrong_answer", "expected": "6\n7 2\n2 0\n0 3\n3 1\n1 4\n7 6", "got": "6\n7 2\n2 0\n0 3\n3 1\n1 4\n2 6"}, {"idx": 4, "reason": "wrong_answer", "expected": "1\n0 1", "got": "1\n1 0"}, {"idx": 5, "reason... | codeforces | E | |
807 | 1070_D. Garbage Disposal | Enough is enough. Too many times it happened that Vasya forgot to dispose of garbage and his apartment stank afterwards. Now he wants to create a garbage disposal plan and stick to it.
For each of next n days Vasya knows a_i — number of units of garbage he will produce on the i-th day. Each unit of garbage must be dis... | java | import jdk.nashorn.internal.runtime.regexp.joni.ScanEnvironment;
import java.io.OutputStreamWriter;
import java.io.PrintWriter;
import java.util.ArrayList;
import java.util.LinkedList;
import java.util.Queue;
import java.util.Scanner;
import java.io.IOException;
import java.io.DataInputStream;
import java.io.FileInput... | compile_error | 0 | 0 | COMPILE_ERROR:/tmp/sbx_m5_28v58/main.java:1: error: package jdk.nashorn.internal.runtime.regexp.joni does not exist
import jdk.nashorn.internal.runtime.regexp.joni.ScanEnvironment;
^
1 error
| [] | codeforces | D |
809 | 1140_C. Playlist | You have a playlist consisting of n songs. The i-th song is characterized by two numbers t_i and b_i — its length and beauty respectively. The pleasure of listening to set of songs is equal to the total length of the songs in the set multiplied by the minimum beauty among them. For example, the pleasure of listening to... | python2 | """
Author : raj1307
Institute : Jalpaiguri Government Engineering College
Date : 27.03.19
"""
from __future__ import division, print_function
import itertools,os,sys
#from collections import deque, Counter, OrderedDict
from heapq import nsmallest, nlargest, heapify,heappop ,heappush, heapreplace
#from math imp... | all_fail | 0 | 7 | [{"idx": 0, "reason": "runtime_error", "rc": 1, "stderr": "Traceback (most recent call last):\n File \"/tmp/sbx_fh492iok/tmp5yyv4ox3.py\", line 83, in <module>\n main()\n File \"/tmp/sbx_fh492iok/tmp5yyv4ox3.py\", line 63, in main\n n,k=mi()\nValueError: inval", "stdout_tail": ""}, {"idx": 1, "reason": "runtime... | codeforces | C | |
809 | 1140_C. Playlist | You have a playlist consisting of n songs. The i-th song is characterized by two numbers t_i and b_i — its length and beauty respectively. The pleasure of listening to set of songs is equal to the total length of the songs in the set multiplied by the minimum beauty among them. For example, the pleasure of listening to... | python2 | #!/usr/bin/env python
""" https://github.com/cheran-senthil/PyRival <hello@cheran.io> """
from __future__ import division, print_function
import os
import sys
from atexit import register
from heapq import heappop, heappush
if sys.version_info[0] < 3:
from cStringIO import StringIO
from itertools import ifilt... | all_fail | 0 | 7 | [{"idx": 0, "reason": "runtime_error", "rc": 1, "stderr": "Traceback (most recent call last):\n File \"/tmp/sbx_b3s0urw4/tmpxovuvyfl.py\", line 52, in <module>\n main()\n File \"/tmp/sbx_b3s0urw4/tmpxovuvyfl.py\", line 30, in main\n n, k = map(int, input().sp", "stdout_tail": ""}, {"idx": 1, "reason": "runtime_... | codeforces | C | |
812 | 1216_E1. Numerical Sequence (easy version) | The only difference between the easy and the hard versions is the maximum value of k.
You are given an infinite sequence of form "112123123412345..." which consist of blocks of all consecutive positive integers written one after another. The first block consists of all numbers from 1 to 1, the second one — from 1 to 2... | java | import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
import java.io.PrintWriter;
import java.io.BufferedWriter;
import java.io.Writer;
import java.io.OutputStreamWriter;
import java.util.InputMismatchException;
import java.io.IOException;
import java.io.Input... | partial | 14 | 24 | [{"idx": 3, "reason": "wrong_answer", "expected": "1\n4\n1\n4\n9\n2\n6\n2\n6\n8\n1\n1\n9\n8\n3\n7\n6\n1\n1", "got": "1\n4\n1\n4\n9\n2\n6\n2\n6\n8\n1\n1\n9\n8\n3\n7\n6\n1\n9"}, {"idx": 7, "reason": "wrong_answer", "expected": "7\n1", "got": "3\n1"}, {"idx": 9, "reason": "wrong_answer", "expected": "1", "got": "2"}, {"id... | codeforces | E | |
812 | 1216_E1. Numerical Sequence (easy version) | The only difference between the easy and the hard versions is the maximum value of k.
You are given an infinite sequence of form "112123123412345..." which consist of blocks of all consecutive positive integers written one after another. The first block consists of all numbers from 1 to 1, the second one — from 1 to 2... | python3 | # ---------------------------iye ha aam zindegi---------------------------------------------
import math
import heapq, bisect
import sys
from collections import deque, defaultdict
from fractions import Fraction
import sys
mod = 10 ** 9 + 7
mod1 = 998244353
# ------------------------------warmup------------------------... | partial | 13 | 24 | [{"idx": 3, "reason": "timeout"}, {"idx": 7, "reason": "timeout"}, {"idx": 9, "reason": "timeout"}, {"idx": 12, "reason": "timeout"}, {"idx": 13, "reason": "timeout"}] | codeforces | E | |
812 | 1216_E1. Numerical Sequence (easy version) | The only difference between the easy and the hard versions is the maximum value of k.
You are given an infinite sequence of form "112123123412345..." which consist of blocks of all consecutive positive integers written one after another. The first block consists of all numbers from 1 to 1, the second one — from 1 to 2... | python3 | for _ in range(int(input())):
n=int(input())
u=0
prev=0
for i in range(1,50005):
# print("u",u)
if u+prev+len(str(i))>=n:
for k in range(1,i+1):
if u+len(str(k))>=n:
for j in str(k):
if u+1==n:
... | partial | 14 | 24 | [{"idx": 3, "reason": "wrong_answer", "expected": "1\n4\n1\n4\n9\n2\n6\n2\n6\n8\n1\n1\n9\n8\n3\n7\n6\n1\n1", "got": "1\n4\n1\n4\n9\n2\n6\n2\n6\n8"}, {"idx": 7, "reason": "wrong_answer", "expected": "7\n1", "got": "1"}, {"idx": 9, "reason": "wrong_answer", "expected": "1", "got": ""}, {"idx": 12, "reason": "wrong_answer... | codeforces | E | |
812 | 1216_E1. Numerical Sequence (easy version) | The only difference between the easy and the hard versions is the maximum value of k.
You are given an infinite sequence of form "112123123412345..." which consist of blocks of all consecutive positive integers written one after another. The first block consists of all numbers from 1 to 1, the second one — from 1 to 2... | python2 | import decimal,math
from collections import *
from fractions import gcd
from bisect import bisect_right,bisect_left
import sys
def primeFactors(n):
arr=[]
while n % 2 == 0:
arr.append(2)
n = n / 2
for i in xrange(3,int(math.sqrt(n))+1,2):
while n % i== 0:
arr.append(i)
n = n / i
if n > 2:
arr... | partial | 13 | 24 | [{"idx": 3, "reason": "runtime_error", "rc": 1, "stderr": "Traceback (most recent call last):\n File \"/tmp/sbx_fc7m2nx2/tmpvn2_c7qg.py\", line 134, in <module>\n print s[itr-1]\nIndexError: string index out of range\n", "stdout_tail": "1\n4\n1\n4\n9\n2\n6\n2\n6\n8\n"}, {"idx": 7, "reason": "runtime_error", "rc": 1... | codeforces | E | |
812 | 1216_E1. Numerical Sequence (easy version) | The only difference between the easy and the hard versions is the maximum value of k.
You are given an infinite sequence of form "112123123412345..." which consist of blocks of all consecutive positive integers written one after another. The first block consists of all numbers from 1 to 1, the second one — from 1 to 2... | python2 | import decimal,math
from collections import *
from fractions import gcd
from bisect import bisect_right,bisect_left
import sys
def primeFactors(n):
arr=[]
while n % 2 == 0:
arr.append(2)
n = n / 2
for i in xrange(3,int(math.sqrt(n))+1,2):
while n % i== 0:
arr.append(i)
n = n / i
if n > 2:
arr... | partial | 15 | 24 | [{"idx": 3, "reason": "wrong_answer", "expected": "1\n4\n1\n4\n9\n2\n6\n2\n6\n8\n1\n1\n9\n8\n3\n7\n6\n1\n1", "got": "1\n4\n1\n4\n9\n2\n6\n2\n6\n8\n1\n1\n9\n8\n3\n7\n6\n3\n9"}, {"idx": 7, "reason": "wrong_answer", "expected": "7\n1", "got": "4\n1"}, {"idx": 9, "reason": "wrong_answer", "expected": "1", "got": "3"}, {"id... | codeforces | E | |
814 | 1281_C. Cut and Paste | We start with a string s consisting only of the digits 1, 2, or 3. The length of s is denoted by |s|. For each i from 1 to |s|, the i-th character of s is denoted by s_i.
There is one cursor. The cursor's location ℓ is denoted by an integer in \{0, …, |s|\}, with the following meaning:
* If ℓ = 0, then the cursor... | python3 | import math, collections, sys
# input = sys.stdin.readline
mod = 10**9+7
for _ in range(int(input())):
x = int(input())
s = [i for i in input()]
l = len(s)
for i in range(1, x+1):
rep = int(s[i-1])-1
if len(s) < x:
start = i
end = len(s)
for j in range... | partial | 8 | 10 | [{"idx": 6, "reason": "timeout"}, {"idx": 9, "reason": "timeout"}] | codeforces | C | |
814 | 1281_C. Cut and Paste | We start with a string s consisting only of the digits 1, 2, or 3. The length of s is denoted by |s|. For each i from 1 to |s|, the i-th character of s is denoted by s_i.
There is one cursor. The cursor's location ℓ is denoted by an integer in \{0, …, |s|\}, with the following meaning:
* If ℓ = 0, then the cursor... | python3 | import time
import sys
MOD = 1e9 + 7
# f = open('test.txt', 'w+')
# f.write("1\n333047\n")
# f.write('1'*300 + '2' + '1'*20 + '2')
# f.seek(0)
f = sys.stdin
t1 = time.time()
for t in range(int(f.readline())):
x, s = int(f.readline().rstrip()), f.readline().rstrip()
i = 0
while len(s) < x:
i += 1
... | partial | 7 | 10 | [{"idx": 2, "reason": "timeout"}, {"idx": 6, "reason": "timeout"}, {"idx": 9, "reason": "timeout"}] | codeforces | C | |
817 | 1386_B. Mixture | Serge, the chef of the famous restaurant "Salt, Pepper & Garlic" is trying to obtain his first Michelin star. He has been informed that a secret expert plans to visit his restaurant this evening.
Even though the expert's name hasn't been disclosed, Serge is certain he knows which dish from the menu will be ordered as ... | cpp | #include <bits/stdc++.h>
using namespace std;
inline long long read() {
long long x = 0, f = 1;
char c = getchar();
while ((c < '0' || c > '9') && (c != '-')) c = getchar();
if (c == '-') f = -1, c = getchar();
while (c >= '0' && c <= '9') x = x * 10 + c - '0', c = getchar();
return x * f;
}
const int N = 1... | compile_error | 0 | 0 | COMPILE_ERROR:In file included from /usr/include/c++/11/map:60,
from /usr/include/x86_64-linux-gnu/c++/11/bits/stdc++.h:81,
from /tmp/sbx_a9zcofjb/tmp4brfx0q6.cpp:1:
/usr/include/c++/11/bits/stl_tree.h: In instantiation of ‘static const _Key& std::_Rb_tree<_Key, _Val, _KeyOfValue, _Com... | [] | codeforces | B |
820 | 1451_F. Nullify The Matrix | Jeel and Ashish play a game on an n × m matrix. The rows are numbered 1 to n from top to bottom and the columns are numbered 1 to m from left to right. They play turn by turn. Ashish goes first.
Initially, each cell of the matrix contains a non-negative integer. Each turn, a player must perform all of the following ac... | java | //package round685;
import java.io.*;
import java.util.ArrayDeque;
import java.util.Arrays;
import java.util.InputMismatchException;
import java.util.Queue;
public class F {
InputStream is;
FastWriter out;
String INPUT = "";
void solve()
{
for(int T = ni();T > 0;T--)go();
}
void go()
{
int n = ni(), m =... | all_fail | 0 | 4 | [{"idx": 0, "reason": "wrong_answer", "expected": "\nJeel\nAshish\nJeel\nAshish", "got": "[0ms]"}, {"idx": 1, "reason": "wrong_answer", "expected": "Jeel\nAshish\nAshish", "got": "[0ms]"}, {"idx": 2, "reason": "wrong_answer", "expected": "Jeel\nJeel\nAshish\nJeel\nAshish", "got": "[0ms]"}, {"idx": 3, "reason": "wrong_a... | codeforces | F | |
821 | 1475_E. Advertising Agency | Masha works in an advertising agency. In order to promote the new brand, she wants to conclude contracts with some bloggers. In total, Masha has connections of n different bloggers. Blogger numbered i has a_i followers.
Since Masha has a limited budget, she can only sign a contract with k different bloggers. Of course... | python3 | import io,os
input=io.BytesIO(os.read(0,os.fstat(0).st_size)).readline
N = 10001
# array to store inverse of 1 to N
factorialNumInverse = [None] * (N + 1)
# array to precompute inverse of 1! to N!
naturalNumInverse = [None] * (N + 1)
# array to store factorial of
# first N numbers
fact = [None] * (N + 1)
# Fun... | all_fail | 0 | 1 | [{"idx": 0, "reason": "runtime_error", "rc": 1, "stderr": "Traceback (most recent call last):\n File \"/tmp/sbx__c74wdpp/tmpmap3wzcw.py\", line 51, in <module>\n t=int(input())\n ^^^^^^^^^^^^\nValueError: invalid literal for int() with base 10: b''\n", "stdout_tail": ""}] | codeforces | E | |
822 | 1500_C. Matrix Sorting | You are given two tables A and B of size n × m.
We define a sorting by column as the following: we choose a column and reorder the rows of the table by the value in this column, from the rows with the smallest value to the rows with the largest. In case there are two or more rows with equal value in this column, thei... | cpp | #include <bits/stdc++.h>
using namespace std;
typedef long long ll;
int main() {
ios::sync_with_stdio(false);
cin.tie(0);
int n, m;
cin >> n >> m;
vector<vector<int>> a(n, vector<int>(m));
for (int i = 0; i < n; ++i) {
for (int j = 0; j < m; ++j) cin >> a[i][j];
}
vector<vector<int>> b(n, vector<i... | partial | 10 | 25 | [{"idx": 3, "reason": "wrong_answer", "expected": "\n2\n1 2", "got": "2\n2 1"}, {"idx": 4, "reason": "wrong_answer", "expected": "3\n2 3 1", "got": "1\n1"}, {"idx": 5, "reason": "wrong_answer", "expected": "2\n2 1", "got": "0"}, {"idx": 6, "reason": "wrong_answer", "expected": "10\n10 9 8 7 5 4 3 2 1 6", "got": "1\n6"}... | codeforces | C | |
822 | 1500_C. Matrix Sorting | You are given two tables A and B of size n × m.
We define a sorting by column as the following: we choose a column and reorder the rows of the table by the value in this column, from the rows with the smallest value to the rows with the largest. In case there are two or more rows with equal value in this column, thei... | cpp | #include <bits/stdc++.h>
using namespace std;
#pragma GCC optimize("unroll-loops")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,avx,avx2,fma,tune=native")
#define ll long long
//#define int ll
#define ull unsigned ll
#define ld long double
#define rep(a) rep1(i,a)
#define rep1(i,a) rep2(i,0,a)
#define rep2(i,b,a) for(... | partial | 19 | 25 | [{"idx": 1, "reason": "wrong_answer", "expected": "\n1\n1", "got": "2\n2 1"}, {"idx": 3, "reason": "wrong_answer", "expected": "\n2\n1 2", "got": "3\n3 2 1"}, {"idx": 4, "reason": "wrong_answer", "expected": "3\n2 3 1", "got": "3\n3 2 1"}, {"idx": 13, "reason": "wrong_answer", "expected": "6\n1 5 4 3 6 2", "got": "6\n6... | codeforces | C | |
822 | 1500_C. Matrix Sorting | You are given two tables A and B of size n × m.
We define a sorting by column as the following: we choose a column and reorder the rows of the table by the value in this column, from the rows with the smallest value to the rows with the largest. In case there are two or more rows with equal value in this column, thei... | cpp | #include <bits/stdc++.h>
using namespace std;
const int N = 1505, mod = 1e9 + 9;
int n, m, a[N][N], b[N][N], A[N], id[N], d[N];
vector <int> ans;
bool vis[N];
queue <int> q;
int main() {
scanf("%d%d", &n, &m);
for (int i = 1; i <= n; i++)
for (int j = 1; j <= m; j++)
scanf("%d", &a[i][j]), A[i] = (A[i]*23... | partial | 22 | 25 | [{"idx": 1, "reason": "wrong_answer", "expected": "\n1\n1", "got": "2\n2 1"}, {"idx": 3, "reason": "wrong_answer", "expected": "\n2\n1 2", "got": "3\n3 2 1"}, {"idx": 6, "reason": "wrong_answer", "expected": "10\n10 9 8 7 5 4 3 2 1 6", "got": "10\n10 9 8 2 7 4 1 3 5 6"}] | codeforces | C | |
822 | 1500_C. Matrix Sorting | You are given two tables A and B of size n × m.
We define a sorting by column as the following: we choose a column and reorder the rows of the table by the value in this column, from the rows with the smallest value to the rows with the largest. In case there are two or more rows with equal value in this column, thei... | java | //stan hu tao
//join nct ridin by first year culture reps
import static java.lang.Math.max;
import static java.lang.Math.min;
import static java.lang.Math.abs;
import static java.lang.System.out;
import java.util.*;
import java.io.*;
import java.math.*;
public class x1500C
{
public static void main(String hi[]) th... | partial | 12 | 25 | [{"idx": 1, "reason": "wrong_answer", "expected": "\n1\n1", "got": "2\n1 2"}, {"idx": 3, "reason": "wrong_answer", "expected": "\n2\n1 2", "got": "3\n3 1 2"}, {"idx": 4, "reason": "wrong_answer", "expected": "3\n2 3 1", "got": "3\n1 2 3"}, {"idx": 5, "reason": "wrong_answer", "expected": "2\n2 1", "got": "2\n1 2"}, {"i... | codeforces | C | |
822 | 1500_C. Matrix Sorting | You are given two tables A and B of size n × m.
We define a sorting by column as the following: we choose a column and reorder the rows of the table by the value in this column, from the rows with the smallest value to the rows with the largest. In case there are two or more rows with equal value in this column, thei... | java | //package com.company;
import java.io.BufferedReader;
import java.io.File;
import java.io.FileNotFoundException;
import java.io.FileReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.util.ArrayList;
import java.util.Arrays;
import j... | partial | 9 | 25 | [{"idx": 1, "reason": "wrong_answer", "expected": "\n1\n1", "got": "2\n1 2"}, {"idx": 3, "reason": "wrong_answer", "expected": "\n2\n1 2", "got": "3\n3 1 2"}, {"idx": 4, "reason": "wrong_answer", "expected": "3\n2 3 1", "got": "3\n1 2 3"}, {"idx": 5, "reason": "wrong_answer", "expected": "2\n2 1", "got": "2\n1 2"}, {"i... | codeforces | C | |
822 | 1500_C. Matrix Sorting | You are given two tables A and B of size n × m.
We define a sorting by column as the following: we choose a column and reorder the rows of the table by the value in this column, from the rows with the smallest value to the rows with the largest. In case there are two or more rows with equal value in this column, thei... | java | import java.util.*;
import java.io.*;
import java.math.BigInteger;
public class C {
FastScanner in;
PrintWriter out;
boolean systemIO = true;
public static void quickSort(int[] a, int from, int to) {
if (to - from <= 1) {
return;
}
int i = from;
int j = to - 1;
int x = a[from + (new Random()).nextIn... | partial | 19 | 25 | [{"idx": 1, "reason": "wrong_answer", "expected": "\n1\n1", "got": "2\n2 1"}, {"idx": 3, "reason": "wrong_answer", "expected": "\n2\n1 2", "got": "3\n3 2 1"}, {"idx": 4, "reason": "wrong_answer", "expected": "3\n2 3 1", "got": "3\n3 2 1"}, {"idx": 13, "reason": "wrong_answer", "expected": "6\n1 5 4 3 6 2", "got": "6\n6... | codeforces | C | |
823 | 1525_E. Assimilation IV | Monocarp is playing a game "Assimilation IV". In this game he manages a great empire: builds cities and conquers new lands.
Monocarp's empire has n cities. In order to conquer new lands he plans to build one Monument in each city. The game is turn-based and, since Monocarp is still amateur, he builds exactly one Monum... | java | //package ecr109;
import java.io.*;
import java.util.ArrayDeque;
import java.util.Arrays;
import java.util.InputMismatchException;
import java.util.Queue;
public class E {
InputStream is;
FastWriter out;
String INPUT = "";
void solve()
{
int n = ni(), m = ni();
int[][] a = nmi(n, m);
final int mod = 99824... | all_fail | 0 | 4 | [{"idx": 0, "reason": "runtime_error", "rc": 1, "stderr": "Exception in thread \"main\" java.util.InputMismatchException\n\tat E.readByte(E.java:74)\n\tat E.nl(E.java:144)\n\tat E.ni(E.java:137)\n\tat E.solve(E.java:15)\n\tat E.run(E.java:62)\n\tat E.main(E.java:67)\n", "stdout_tail": ""}, {"idx": 1, "reason": "runtime... | codeforces | E | |
824 | 157_B. Trace | One day, as Sherlock Holmes was tracking down one very important criminal, he found a wonderful painting on the wall. This wall could be represented as a plane. The painting had several concentric circles that divided the wall into several parts. Some parts were painted red and all the other were painted blue. Besides,... | cpp | #include <bits/stdc++.h>
using namespace std;
int main() {
long long int n, k, i, j, p, cnt = 2, ans = 0, m, l, r = 0;
long double pi = 3.1415926536;
cin >> n;
vector<int> a;
for (i = 0; i < n; i++) {
cin >> p;
a.push_back(p);
}
a.push_back(0);
sort(a.begin(), a.end());
for (i = n; i > 0; i -=... | partial | 12 | 25 | [{"idx": 4, "reason": "wrong_answer", "expected": "1556458.0979239128", "got": "1.55646e+06"}, {"idx": 5, "reason": "wrong_answer", "expected": "1479184.3434235647", "got": "1.47918e+06"}, {"idx": 8, "reason": "wrong_answer", "expected": "1615601.7212203941", "got": "1.6156e+06"}, {"idx": 9, "reason": "wrong_answer", "... | codeforces | B | |
826 | 248_B. Chilly Willy | Chilly Willy loves playing with numbers. He only knows prime numbers that are digits yet. These numbers are 2, 3, 5 and 7. But Willy grew rather bored of such numbers, so he came up with a few games that were connected with them.
Chilly Willy wants to find the minimum number of length n, such that it is simultaneously... | python3 | n = int(input())
if n < 3:
print(-1)
else:
t = 10**(n-1)
print(t+210-t%210)
| partial | 14 | 25 | [{"idx": 2, "reason": "runtime_error", "rc": 1, "stderr": "Traceback (most recent call last):\n File \"/tmp/sbx_of2sfu38/tmpvxoo__11.py\", line 6, in <module>\n print(t+210-t%210)\nValueError: Exceeds the limit (4300 digits) for integer string conversion; use ", "stdout_tail": ""}, {"idx": 3, "reason": "runtime_err... | codeforces | B | |
826 | 248_B. Chilly Willy | Chilly Willy loves playing with numbers. He only knows prime numbers that are digits yet. These numbers are 2, 3, 5 and 7. But Willy grew rather bored of such numbers, so he came up with a few games that were connected with them.
Chilly Willy wants to find the minimum number of length n, such that it is simultaneously... | python3 | import math
def check(i):
return ((i % 2 == 0) and (i % 3 == 0) and (i % 5 == 0) and (i % 7 == 0))
n = int(input())
temp = 10 ** (n - 1)
m = 10 ** n
while check(temp) == 0 :
temp += 1
if temp > m:
print(-1)
else:
print(temp)
| partial | 14 | 25 | [{"idx": 2, "reason": "runtime_error", "rc": 1, "stderr": "Traceback (most recent call last):\n File \"/tmp/sbx_gg26wmi1/tmpzj9lbua7.py\", line 15, in <module>\n print(temp)\nValueError: Exceeds the limit (4300 digits) for integer string conversion; use sys.se", "stdout_tail": ""}, {"idx": 3, "reason": "runtime_err... | codeforces | B | |
826 | 248_B. Chilly Willy | Chilly Willy loves playing with numbers. He only knows prime numbers that are digits yet. These numbers are 2, 3, 5 and 7. But Willy grew rather bored of such numbers, so he came up with a few games that were connected with them.
Chilly Willy wants to find the minimum number of length n, such that it is simultaneously... | python3 | n = int(input())
b = 2*3*5*7
a = b * (10**(n - 1) // b + 1)
if a >= 10**n:
print(-1)
else:
print(a) | partial | 14 | 25 | [{"idx": 2, "reason": "runtime_error", "rc": 1, "stderr": "Traceback (most recent call last):\n File \"/tmp/sbx_hucdiq8u/tmp6n390x_z.py\", line 9, in <module>\n print(a)\nValueError: Exceeds the limit (4300 digits) for integer string conversion; use sys.set_in", "stdout_tail": ""}, {"idx": 3, "reason": "runtime_err... | codeforces | B | |
828 | 38_D. Vasya the Architect | Once Vasya played bricks. All the bricks in the set had regular cubical shape. Vasya vas a talented architect, however the tower he built kept falling apart.
Let us consider the building process. Vasya takes a brick and puts it on top of the already built tower so that the sides of the brick are parallel to the sides ... | java | import java.io.*;
import java.util.*;
public class Main {
private static boolean _READ_FROM_FILE = System.getProperty("ONLINE_JUDGE") == null;
private static Scanner in;
private static void core() {
int n = in.nextInt();
double[] x1 = new double[n];
double[] y1 = new double[n];
double[] x2 = new double[n];
... | all_fail | 0 | 25 | [{"idx": 0, "reason": "runtime_error", "rc": 1, "stderr": "Exception in thread \"main\" java.io.FileNotFoundException: in.in (No such file or directory)\n\tat java.base/java.io.FileInputStream.open0(Native Method)\n\tat java.base/java.io.FileInputStream.open(FileIn", "stdout_tail": ""}, {"idx": 1, "reason": "runtime_er... | codeforces | D | |
829 | 45_I. TCMCF+++ | Vasya has gotten interested in programming contests in TCMCF+++ rules. On the contest n problems were suggested and every problem had a cost — a certain integral number of points (perhaps, negative or even equal to zero). According to TCMCF+++ rules, only accepted problems can earn points and the overall number of poin... | python3 | import sys
input=sys.stdin.readline
n=int(input())
s=list(map(int,input().split()))
s.sort()
s.reverse()
num_manfi=0
num_sefr=0
flag=0
for i in s:
if i>0:
print(i,end=' ')
flag=1
elif i==0:
num_sefr+=1
else:
num_manfi+=1
num_manfi-=(num_manfi%2)
s.reverse()
for i in ... | partial | 18 | 25 | [{"idx": 2, "reason": "wrong_answer", "expected": "1 2 3 3", "got": "3 3 2 1"}, {"idx": 5, "reason": "wrong_answer", "expected": "98 30 48 69 70 3 85 67 73 64 31 98 57 84 54 81 24 37 41 73 3 62 86 67 79 38 60 64 78 81 95 98 100 38 14 18 58 95 94 57 21 66 8 26 89 99 74 46 69 75 97 54 29 79 1 67 61 24 62 78 96 82 23 87 9... | codeforces | I | |
829 | 45_I. TCMCF+++ | Vasya has gotten interested in programming contests in TCMCF+++ rules. On the contest n problems were suggested and every problem had a cost — a certain integral number of points (perhaps, negative or even equal to zero). According to TCMCF+++ rules, only accepted problems can earn points and the overall number of poin... | cpp | #include <bits/stdc++.h>
int cmp(const void *n1, const void *n2) {
return (*((int *)n1)) - (*((int *)n2));
}
int main() {
int ar[100], n, neg = 0, qna = 0;
scanf("%d", &n);
for (long long i = 0; i < n; i++) {
scanf("%d", ar + i);
}
qsort(ar, n, sizeof(int), cmp);
if (ar[0] > 0) {
for (long long i ... | partial | 16 | 25 | [{"idx": 5, "reason": "wrong_answer", "expected": "98 30 48 69 70 3 85 67 73 64 31 98 57 84 54 81 24 37 41 73 3 62 86 67 79 38 60 64 78 81 95 98 100 38 14 18 58 95 94 57 21 66 8 26 89 99 74 46 69 75 97 54 29 79 1 67 61 24 62 78 96 82 23 87 9 87 2 30 7", "got": "-90 -65 -60 -50 -50 -46 -45 -34 -29 -28 -26 -23 -23 -22 -8... | codeforces | I | |
829 | 45_I. TCMCF+++ | Vasya has gotten interested in programming contests in TCMCF+++ rules. On the contest n problems were suggested and every problem had a cost — a certain integral number of points (perhaps, negative or even equal to zero). According to TCMCF+++ rules, only accepted problems can earn points and the overall number of poin... | java | import java.util.*;
public class TCMCF {
public static void main(String[] args){
Scanner in = new Scanner(System.in);
int n = in.nextInt();
ArrayList<Integer> arr = new ArrayList<Integer>();
int taken = 0;
boolean zero = false;
for(... | partial | 17 | 25 | [{"idx": 3, "reason": "wrong_answer", "expected": "-100 -100 -100 -100 -100 -100 -100 -100 -100 -100 -100 -100 -100 -100 -100 -100 -100 -100 -100 -100 -100 -100 -100 -100 -100 -100 -100 -100 -100 -100 -100 -100 -100 -100 -100 -100 -100 -100 -100 -100 ", "got": "-92\n-93\n-93\n-93\n-93\n-93\n-94\n-95\n-95\n-96\n-96\n-97... | codeforces | I | |
829 | 45_I. TCMCF+++ | Vasya has gotten interested in programming contests in TCMCF+++ rules. On the contest n problems were suggested and every problem had a cost — a certain integral number of points (perhaps, negative or even equal to zero). According to TCMCF+++ rules, only accepted problems can earn points and the overall number of poin... | cpp | #include <bits/stdc++.h>
using namespace std;
int n;
int k[1005];
int HMF() {
int sum = 0;
for (int i = 1; i <= n; i = i + 1)
if (k[i] < 0) sum = sum + 1;
return sum;
}
int HMZ() {
int sum = 0;
for (int i = 1; i <= n; i = i + 1)
if (k[i] > 0) sum = sum + 1;
return sum;
}
int HM0() {
int sum = 0;
... | partial | 19 | 25 | [{"idx": 3, "reason": "wrong_answer", "expected": "-100 -100 -100 -100 -100 -100 -100 -100 -100 -100 -100 -100 -100 -100 -100 -100 -100 -100 -100 -100 -100 -100 -100 -100 -100 -100 -100 -100 -100 -100 -100 -100 -100 -100 -100 -100 -100 -100 -100 -100 ", "got": "-93 -100 -99 -100 -99 -100 -99 -99 -99 -100 -99 -99 -100 -... | codeforces | I | |
829 | 45_I. TCMCF+++ | Vasya has gotten interested in programming contests in TCMCF+++ rules. On the contest n problems were suggested and every problem had a cost — a certain integral number of points (perhaps, negative or even equal to zero). According to TCMCF+++ rules, only accepted problems can earn points and the overall number of poin... | cpp | #include <bits/stdc++.h>
using namespace std;
int main() {
int n, a[1000];
vector<int> ot, b, c;
cin >> n;
for (int i = 0; i < n; ++i) cin >> a[i];
sort(a, a + n);
for (int i = 0; i < n; ++i)
if (a[i] < 0)
b.push_back(a[i]);
else if (a[i] > 0)
c.push_back(a[i]);
sort(b.begin(), b.end()... | partial | 17 | 25 | [{"idx": 2, "reason": "wrong_answer", "expected": "1 2 3 3", "got": "3 3 2 1"}, {"idx": 5, "reason": "wrong_answer", "expected": "98 30 48 69 70 3 85 67 73 64 31 98 57 84 54 81 24 37 41 73 3 62 86 67 79 38 60 64 78 81 95 98 100 38 14 18 58 95 94 57 21 66 8 26 89 99 74 46 69 75 97 54 29 79 1 67 61 24 62 78 96 82 23 87 9... | codeforces | I | |
829 | 45_I. TCMCF+++ | Vasya has gotten interested in programming contests in TCMCF+++ rules. On the contest n problems were suggested and every problem had a cost — a certain integral number of points (perhaps, negative or even equal to zero). According to TCMCF+++ rules, only accepted problems can earn points and the overall number of poin... | python3 |
a= int(input())
t = list(map(int,input().split()))
ne =[]
po=[]
for s in t:
if s<0:
ne.append(s)
elif s>0:
po.append(s)
ne.sort()
if len(po)==0 and len(ne)==0:
if 0 in t:
print(0)
else:
if len(ne)%2==0:
print(*(ne+po))
else:
if len(ne)==1:
... | partial | 19 | 25 | [{"idx": 5, "reason": "wrong_answer", "expected": "98 30 48 69 70 3 85 67 73 64 31 98 57 84 54 81 24 37 41 73 3 62 86 67 79 38 60 64 78 81 95 98 100 38 14 18 58 95 94 57 21 66 8 26 89 99 74 46 69 75 97 54 29 79 1 67 61 24 62 78 96 82 23 87 9 87 2 30 7", "got": "-90 -65 -60 -50 -50 -46 -45 -34 -29 -28 -26 -23 -23 -22 -8... | codeforces | I | |
829 | 45_I. TCMCF+++ | Vasya has gotten interested in programming contests in TCMCF+++ rules. On the contest n problems were suggested and every problem had a cost — a certain integral number of points (perhaps, negative or even equal to zero). According to TCMCF+++ rules, only accepted problems can earn points and the overall number of poin... | python2 | n = int(raw_input())
s = raw_input().split()
for i in range(n):
s[i] = int(s[i])
s.sort()
ans = ''
i = 0
while i < n:
if s[i] < 0:
if i+1 < n and s[i+1] < 0:
ans += str(s[i])+' '+str(s[i+1])+' '
i += 1
elif s[i] > 0:
ans += str(s[i])+' '
i += 1
if ans == '':
ans += str(s[-1])
print ans
| partial | 16 | 25 | [{"idx": 5, "reason": "wrong_answer", "expected": "98 30 48 69 70 3 85 67 73 64 31 98 57 84 54 81 24 37 41 73 3 62 86 67 79 38 60 64 78 81 95 98 100 38 14 18 58 95 94 57 21 66 8 26 89 99 74 46 69 75 97 54 29 79 1 67 61 24 62 78 96 82 23 87 9 87 2 30 7", "got": "-90 -65 -60 -50 -50 -46 -45 -34 -29 -28 -26 -23 -23 -22 -8... | codeforces | I | |
829 | 45_I. TCMCF+++ | Vasya has gotten interested in programming contests in TCMCF+++ rules. On the contest n problems were suggested and every problem had a cost — a certain integral number of points (perhaps, negative or even equal to zero). According to TCMCF+++ rules, only accepted problems can earn points and the overall number of poin... | python2 | num_probs = int(raw_input())
costs = map(int, raw_input().split())
costs.sort()
num_negs = len([x for x in costs if x < 0])
if num_negs % 2 == 1 and len(costs) > 1:
for i in xrange(len(costs)):
if costs[i] >= 0:
costs.pop(i-1)
break
else:
costs.pop(len(costs)-1)
for n in xrange(costs.count(0)):
if len(cost... | partial | 16 | 25 | [{"idx": 5, "reason": "wrong_answer", "expected": "98 30 48 69 70 3 85 67 73 64 31 98 57 84 54 81 24 37 41 73 3 62 86 67 79 38 60 64 78 81 95 98 100 38 14 18 58 95 94 57 21 66 8 26 89 99 74 46 69 75 97 54 29 79 1 67 61 24 62 78 96 82 23 87 9 87 2 30 7", "got": "-90 -65 -60 -50 -50 -46 -45 -34 -29 -28 -26 -23 -23 -22 -8... | codeforces | I | |
830 | 483_C. Diverse Permutation | Permutation p is an ordered set of integers p1, p2, ..., pn, consisting of n distinct positive integers not larger than n. We'll denote as n the length of permutation p1, p2, ..., pn.
Your task is to find such permutation p of length n, that the group of numbers |p1 - p2|, |p2 - p3|, ..., |pn - 1 - pn| has exactly k d... | java | import java.util.*;
import java.io.*;
public class Main {
public static void main(String[] args) {
InputReader in = new InputReader(System.in);
OutputWriter out = new OutputWriter(System.out);
int n =in.nextInt();
int k = in.nextInt();
int[] a = new int[n];
for (... | partial | 7 | 22 | [{"idx": 0, "reason": "wrong_answer", "expected": "1 3 2 4 5", "got": "1 5 4 3 2"}, {"idx": 3, "reason": "wrong_answer", "expected": "1 9844 2 9843 3 9842 4 9841 5 9840 6 9839 7 9838 8 9837 9 9836 10 9835 11 9834 12 9833 13 9832 14 9831 15 9830 16 9829 17 9828 18 9827 19 9826 20 9825 21 9824 22 9823 23 9822 24 9821 25 ... | codeforces | C | |
830 | 483_C. Diverse Permutation | Permutation p is an ordered set of integers p1, p2, ..., pn, consisting of n distinct positive integers not larger than n. We'll denote as n the length of permutation p1, p2, ..., pn.
Your task is to find such permutation p of length n, that the group of numbers |p1 - p2|, |p2 - p3|, ..., |pn - 1 - pn| has exactly k d... | java | import java.util.*;
public class DiversePermutation {
public static void main(String[] args){
Scanner k = new Scanner(System.in);
// System.nanoTime();
int total = k.nextInt();
int diff = k.nextInt();
// int [] perm = new int[total];
int a = 0;
int b = total-1;
... | partial | 7 | 22 | [{"idx": 0, "reason": "wrong_answer", "expected": "1 3 2 4 5", "got": "1 5 4 3 2"}, {"idx": 3, "reason": "wrong_answer", "expected": "1 9844 2 9843 3 9842 4 9841 5 9840 6 9839 7 9838 8 9837 9 9836 10 9835 11 9834 12 9833 13 9832 14 9831 15 9830 16 9829 17 9828 18 9827 19 9826 20 9825 21 9824 22 9823 23 9822 24 9821 25 ... | codeforces | C | |
830 | 483_C. Diverse Permutation | Permutation p is an ordered set of integers p1, p2, ..., pn, consisting of n distinct positive integers not larger than n. We'll denote as n the length of permutation p1, p2, ..., pn.
Your task is to find such permutation p of length n, that the group of numbers |p1 - p2|, |p2 - p3|, ..., |pn - 1 - pn| has exactly k d... | java | import java.io.*;
import java.util.*;
public class DiversePermutation {
public static InputReader in;
public static PrintWriter out;
public static final int MOD = (int) (1e9 + 7);
public static void main(String[] args) {
in = new InputReader(System.in);
out = new PrintWriter(Syste... | partial | 5 | 22 | [{"idx": 0, "reason": "wrong_answer", "expected": "1 3 2 4 5", "got": "1 2 4 3 5"}, {"idx": 3, "reason": "wrong_answer", "expected": "1 9844 2 9843 3 9842 4 9841 5 9840 6 9839 7 9838 8 9837 9 9836 10 9835 11 9834 12 9833 13 9832 14 9831 15 9830 16 9829 17 9828 18 9827 19 9826 20 9825 21 9824 22 9823 23 9822 24 9821 25 ... | codeforces | C | |
830 | 483_C. Diverse Permutation | Permutation p is an ordered set of integers p1, p2, ..., pn, consisting of n distinct positive integers not larger than n. We'll denote as n the length of permutation p1, p2, ..., pn.
Your task is to find such permutation p of length n, that the group of numbers |p1 - p2|, |p2 - p3|, ..., |pn - 1 - pn| has exactly k d... | cpp | #include <bits/stdc++.h>
int n, k;
int bef;
int tmp;
int main() {
int i;
scanf("%d %d", &n, &k);
if (1 + k < n)
for (i = n; i > 1 + k; i--) printf("%d ", i);
for (i = 0; i < 1 + k; i++)
if (i % 2 == 0)
printf("%d ", 1 + k - i / 2);
else
printf("%d ", 1 + i / 2);
printf("\n");
return ... | all_fail | 0 | 22 | [{"idx": 0, "reason": "wrong_answer", "expected": "1 3 2 4 5", "got": "5 4 3 1 2"}, {"idx": 1, "reason": "wrong_answer", "expected": "1 2 3", "got": "3 2 1"}, {"idx": 2, "reason": "wrong_answer", "expected": "1 3 2", "got": "3 1 2"}, {"idx": 3, "reason": "wrong_answer", "expected": "1 9844 2 9843 3 9842 4 9841 5 9840 6... | codeforces | C | |
830 | 483_C. Diverse Permutation | Permutation p is an ordered set of integers p1, p2, ..., pn, consisting of n distinct positive integers not larger than n. We'll denote as n the length of permutation p1, p2, ..., pn.
Your task is to find such permutation p of length n, that the group of numbers |p1 - p2|, |p2 - p3|, ..., |pn - 1 - pn| has exactly k d... | python2 | #! /usr/bin/python
if __name__ == "__main__":
n, k = map(int, raw_input().split())
initial = [i/2 + 1 if i%2 == 0 else n - i/2 for i in xrange(n)]
res = initial[:k] + (sorted(initial[k:]) if k % 2 == 1 else list(reversed(sorted(initial[k:]))))
print ' '.join(map(str, res))
| partial | 7 | 22 | [{"idx": 0, "reason": "wrong_answer", "expected": "1 3 2 4 5", "got": "1 5 4 3 2"}, {"idx": 3, "reason": "wrong_answer", "expected": "1 9844 2 9843 3 9842 4 9841 5 9840 6 9839 7 9838 8 9837 9 9836 10 9835 11 9834 12 9833 13 9832 14 9831 15 9830 16 9829 17 9828 18 9827 19 9826 20 9825 21 9824 22 9823 23 9822 24 9821 25 ... | codeforces | C | |
830 | 483_C. Diverse Permutation | Permutation p is an ordered set of integers p1, p2, ..., pn, consisting of n distinct positive integers not larger than n. We'll denote as n the length of permutation p1, p2, ..., pn.
Your task is to find such permutation p of length n, that the group of numbers |p1 - p2|, |p2 - p3|, ..., |pn - 1 - pn| has exactly k d... | python2 | n,k=map(int,raw_input().split())
p1=1
p2=n
z=n
while(k>0):
if True:
if k%2==0:
print p2,
p2-=1
else:
print p1,
p1+=1
k-=1
z-=1
for i in xrange(z):
print p1,
p1+=1
| partial | 4 | 22 | [{"idx": 0, "reason": "wrong_answer", "expected": "1 3 2 4 5", "got": "5 1 2 3 4"}, {"idx": 2, "reason": "wrong_answer", "expected": "1 3 2", "got": "3 1 2"}, {"idx": 3, "reason": "wrong_answer", "expected": "1 9844 2 9843 3 9842 4 9841 5 9840 6 9839 7 9838 8 9837 9 9836 10 9835 11 9834 12 9833 13 9832 14 9831 15 9830 ... | codeforces | C | |
830 | 483_C. Diverse Permutation | Permutation p is an ordered set of integers p1, p2, ..., pn, consisting of n distinct positive integers not larger than n. We'll denote as n the length of permutation p1, p2, ..., pn.
Your task is to find such permutation p of length n, that the group of numbers |p1 - p2|, |p2 - p3|, ..., |pn - 1 - pn| has exactly k d... | cpp | #include <bits/stdc++.h>
using namespace std;
int n, i, j, k, ct, b, lv;
vector<int> inc, decr;
int main() {
cin >> n >> k;
for (i = 1; i <= n; i++) inc.push_back(i);
for (i = n; i > 0; i--) decr.push_back(i);
ct = 0;
i = 0;
j = 0;
lv = 0;
k--;
while (ct < k) {
if (lv == 0) {
cout << inc[i] ... | partial | 7 | 22 | [{"idx": 0, "reason": "wrong_answer", "expected": "1 3 2 4 5", "got": "1 5 4 3 2"}, {"idx": 3, "reason": "wrong_answer", "expected": "1 9844 2 9843 3 9842 4 9841 5 9840 6 9839 7 9838 8 9837 9 9836 10 9835 11 9834 12 9833 13 9832 14 9831 15 9830 16 9829 17 9828 18 9827 19 9826 20 9825 21 9824 22 9823 23 9822 24 9821 25 ... | codeforces | C | |
830 | 483_C. Diverse Permutation | Permutation p is an ordered set of integers p1, p2, ..., pn, consisting of n distinct positive integers not larger than n. We'll denote as n the length of permutation p1, p2, ..., pn.
Your task is to find such permutation p of length n, that the group of numbers |p1 - p2|, |p2 - p3|, ..., |pn - 1 - pn| has exactly k d... | python2 | s=raw_input().split()
n=int(s[0])
k=int(s[1])
h=n
l=2
if k==1:
for i in range(1,n+1):
print i,
print ""
else:
flag=1
print 1,
while(k!=1):
if(flag==1):
print h,
h-=1
flag=0
else:
print l,
l+=1
flag=1
k-=1
if(flag==1):
while(l<=h):
print l,
l+=1
print ""
else:
while(h>=l)... | partial | 7 | 22 | [{"idx": 0, "reason": "wrong_answer", "expected": "1 3 2 4 5", "got": "1 5 4 3 2"}, {"idx": 3, "reason": "wrong_answer", "expected": "1 9844 2 9843 3 9842 4 9841 5 9840 6 9839 7 9838 8 9837 9 9836 10 9835 11 9834 12 9833 13 9832 14 9831 15 9830 16 9829 17 9828 18 9827 19 9826 20 9825 21 9824 22 9823 23 9822 24 9821 25 ... | codeforces | C | |
830 | 483_C. Diverse Permutation | Permutation p is an ordered set of integers p1, p2, ..., pn, consisting of n distinct positive integers not larger than n. We'll denote as n the length of permutation p1, p2, ..., pn.
Your task is to find such permutation p of length n, that the group of numbers |p1 - p2|, |p2 - p3|, ..., |pn - 1 - pn| has exactly k d... | python3 | a, b = map(int, input().split(' '))
for i in range(1, a - b + 1):
print(i)
curr = i
if b % 2 == 0:
for i in range(b, 0, -1):
if i % 2 == 0:
curr = curr + i
else:
curr = curr - i
print(curr)
else:
for i in range(b, 0, -1):
if i % 2 == 1:
c... | partial | 7 | 22 | [{"idx": 0, "reason": "wrong_answer", "expected": "1 3 2 4 5", "got": "1\n2\n3\n5\n4"}, {"idx": 3, "reason": "wrong_answer", "expected": "1 9844 2 9843 3 9842 4 9841 5 9840 6 9839 7 9838 8 9837 9 9836 10 9835 11 9834 12 9833 13 9832 14 9831 15 9830 16 9829 17 9828 18 9827 19 9826 20 9825 21 9824 22 9823 23 9822 24 9821... | codeforces | C | |
830 | 483_C. Diverse Permutation | Permutation p is an ordered set of integers p1, p2, ..., pn, consisting of n distinct positive integers not larger than n. We'll denote as n the length of permutation p1, p2, ..., pn.
Your task is to find such permutation p of length n, that the group of numbers |p1 - p2|, |p2 - p3|, ..., |pn - 1 - pn| has exactly k d... | python3 | n,k=(int(i) for i in input().split())
l=[i for i in range(1,n-k+1)]
l1=[i for i in range(n-k+1,n+1)]
k1=0
k2=k-1
for i in range(k):
if(i%2==0):
l.append(l1[k2])
k2-=1
else:
l.append(l1[k1])
k1+=1
print(*l) | partial | 7 | 22 | [{"idx": 0, "reason": "wrong_answer", "expected": "1 3 2 4 5", "got": "1 2 3 5 4"}, {"idx": 3, "reason": "wrong_answer", "expected": "1 9844 2 9843 3 9842 4 9841 5 9840 6 9839 7 9838 8 9837 9 9836 10 9835 11 9834 12 9833 13 9832 14 9831 15 9830 16 9829 17 9828 18 9827 19 9826 20 9825 21 9824 22 9823 23 9822 24 9821 25 ... | codeforces | C | |
831 | 556_D. Case of Fugitive | Andrewid the Android is a galaxy-famous detective. He is now chasing a criminal hiding on the planet Oxa-5, the planet almost fully covered with water.
The only dry land there is an archipelago of n narrow islands located in a row. For more comfort let's represent them as non-intersecting segments on a straight line: ... | java | import java.util.*;
public class Main {
public static class Bridge implements Comparable<Bridge> {
int nomber;
long length;
public Bridge(int nomber, long length) {
this.nomber = nomber;
this.length = length;
}
@Override
public int compareTo... | partial | 10 | 12 | [{"idx": 7, "reason": "wrong_answer", "expected": "Yes\n1 6 4 5 8", "got": "Yes\n6 4 5 8 1"}, {"idx": 11, "reason": "wrong_answer", "expected": "Yes\n1 6 3 2", "got": "Yes\n6 3 7 8"}] | codeforces | D | |
831 | 556_D. Case of Fugitive | Andrewid the Android is a galaxy-famous detective. He is now chasing a criminal hiding on the planet Oxa-5, the planet almost fully covered with water.
The only dry land there is an archipelago of n narrow islands located in a row. For more comfort let's represent them as non-intersecting segments on a straight line: ... | java | import java.util.Arrays;
import java.util.Scanner;
import java.util.Stack;
import java.util.TreeSet;
import java.util.Collections;
import java.util.Iterator;
import java.util.Random;
public class P556D {
static void print(Object O){System.out.print(O);}
static void println() {print("\n");}
public static void... | partial | 10 | 12 | [{"idx": 7, "reason": "wrong_answer", "expected": "Yes\n1 6 4 5 8", "got": "Yes\n6 4 5 8 1"}, {"idx": 11, "reason": "wrong_answer", "expected": "Yes\n1 6 3 2", "got": "Yes\n1 3 5 8"}] | codeforces | D | |
831 | 556_D. Case of Fugitive | Andrewid the Android is a galaxy-famous detective. He is now chasing a criminal hiding on the planet Oxa-5, the planet almost fully covered with water.
The only dry land there is an archipelago of n narrow islands located in a row. For more comfort let's represent them as non-intersecting segments on a straight line: ... | cpp | #include <bits/stdc++.h>
using namespace std;
const int N = 2 * 1e5 + 5;
struct node {
long long mx, mn;
int id;
bool operator<(const node &t) const { return mx > t.mx; }
} w[N];
bool cmp(node a, node b) { return a.mn < b.mn; }
struct num {
long long v;
int id;
bool operator<(const num &t) const { return v ... | partial | 10 | 12 | [{"idx": 4, "reason": "wrong_answer", "expected": "Yes\n1 2", "got": "No"}, {"idx": 8, "reason": "wrong_answer", "expected": "Yes\n2 1", "got": "No"}] | codeforces | D | |
832 | 582_B. Once Again... | You are given an array of positive integers a1, a2, ..., an × T of length n × T. We know that for any i > n it is true that ai = ai - n. Find the length of the longest non-decreasing sequence of the given array.
Input
The first line contains two space-separated integers: n, T (1 ≤ n ≤ 100, 1 ≤ T ≤ 107). The second li... | python3 | # ---------------------------iye ha aam zindegi---------------------------------------------
import math
import random
import heapq,bisect
import sys
from collections import deque, defaultdict
from fractions import Fraction
import sys
import threading
from collections import defaultdict
threading.stack_size(10**8)
mod ... | partial | 23 | 25 | [{"idx": 2, "reason": "timeout"}, {"idx": 18, "reason": "timeout"}] | codeforces | B | |
838 | 855_E. Salazar Slytherin's Locket | Harry came to know from Dumbledore that Salazar Slytherin's locket is a horcrux. This locket was present earlier at 12 Grimmauld Place, the home of Sirius Black's mother. It was stolen from there and is now present in the Ministry of Magic in the office of Dolorous Umbridge, Harry's former Defense Against the Dark Arts... | cpp | #include <bits/stdc++.h>
using namespace std;
const int N = 1e5 + 5;
const int mod = 1e9 + 7;
long long dp[64][1025];
long long ans[N];
int n, q, base, t, a[100], B[N];
long long L[N], R[N];
long long dfs(int cnt, int mask, int limit, int zero) {
if (!zero && !limit && dp[cnt][mask] != -1) return dp[cnt][mask];
if ... | partial | 4 | 5 | [{"idx": 4, "reason": "wrong_answer", "expected": "774752389568", "got": " 0"}] | codeforces | E | |
839 | 87_C. Interesting Game | Two best friends Serozha and Gena play a game.
Initially there is one pile consisting of n stones on the table. During one move one pile should be taken and divided into an arbitrary number of piles consisting of a1 > a2 > ... > ak > 0 stones. The piles should meet the condition a1 - a2 = a2 - a3 = ... = ak - 1 - ak =... | python2 |
n = input()
spg = [0] * (n + 1)
xor = [0] * (n + 1)
for i in range(3, n + 1):
k = 2
movs = set()
while k * (k + 1) <= 2 * i:
s = 2 * i - k * (k - 1)
if s % (2 * k) == 0:
a = s / 2 / k
movs.add(xor[a + k - 1] ^ xor[a - 1])
k += 1
mex = 0
while m... | partial | 13 | 25 | [{"idx": 6, "reason": "timeout"}, {"idx": 8, "reason": "timeout"}, {"idx": 10, "reason": "timeout"}, {"idx": 12, "reason": "timeout"}, {"idx": 13, "reason": "timeout"}] | codeforces | C | |
839 | 87_C. Interesting Game | Two best friends Serozha and Gena play a game.
Initially there is one pile consisting of n stones on the table. During one move one pile should be taken and divided into an arbitrary number of piles consisting of a1 > a2 > ... > ak > 0 stones. The piles should meet the condition a1 - a2 = a2 - a3 = ... = ak - 1 - ak =... | python3 | import math
from collections import Counter
n = int(input())
g = [0 for i in range(n + 1)]
prefix_xor = g.copy()
def in_range(d, k):
if (2 * k - d * d + d) % (2 * d) != 0:
return -1
x = (2 * k - d * d + d) / (2 * d)
return int(x) if x > 0 else -1
def mex(arr):
counter = Counter()
for i ... | partial | 14 | 25 | [{"idx": 6, "reason": "timeout"}, {"idx": 8, "reason": "timeout"}, {"idx": 10, "reason": "timeout"}, {"idx": 12, "reason": "timeout"}, {"idx": 13, "reason": "timeout"}] | codeforces | C | |
840 | 903_E. Swapping Characters | We had a string s consisting of n lowercase Latin letters. We made k copies of this string, thus obtaining k identical strings s1, s2, ..., sk. After that, in each of these strings we swapped exactly two characters (the characters we swapped could be identical, but they had different indices in the string).
You are gi... | java | //189301019.akshay
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.Scanner;
import java.util.Random;
import java.util.Arrays;
import java.util.StringTokenizer;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.HashSet;
import java.u... | partial | 23 | 25 | [{"idx": 6, "reason": "wrong_answer", "expected": "szk", "got": "zks"}, {"idx": 10, "reason": "wrong_answer", "expected": "bacdef", "got": "abdcef"}] | codeforces | E | |
840 | 903_E. Swapping Characters | We had a string s consisting of n lowercase Latin letters. We made k copies of this string, thus obtaining k identical strings s1, s2, ..., sk. After that, in each of these strings we swapped exactly two characters (the characters we swapped could be identical, but they had different indices in the string).
You are gi... | cpp | #include <bits/stdc++.h>
volatile bool isLocalTestEnabled = 0;
bool g_isLocalPrintEnabled = (bool)(0);
template <typename T>
void UpdateMin(T& a, const T b) {
a = std::min(a, b);
}
template <typename T>
void UpdateMax(T& a, const T b) {
a = std::max(a, b);
}
const long double Pi = std::atan(1.0L) * 4.0L;
static con... | partial | 23 | 25 | [{"idx": 6, "reason": "wrong_answer", "expected": "szk", "got": "zks"}, {"idx": 17, "reason": "wrong_answer", "expected": "vuh", "got": "uhv"}] | codeforces | E | |
840 | 903_E. Swapping Characters | We had a string s consisting of n lowercase Latin letters. We made k copies of this string, thus obtaining k identical strings s1, s2, ..., sk. After that, in each of these strings we swapped exactly two characters (the characters we swapped could be identical, but they had different indices in the string).
You are gi... | cpp | #include <bits/stdc++.h>
using namespace std;
template <typename T>
void out(T x) {
cout << x << endl;
exit(0);
}
const int maxn = 1e6 + 5;
int n, k;
vector<string> s;
bool test(string x) {
for (int i = 0; i < n; i++) {
int cnt = 0;
map<char, int> freq;
for (int j = 0; j < k; j++) {
freq[s[i][j]... | partial | 23 | 25 | [{"idx": 6, "reason": "wrong_answer", "expected": "szk", "got": "zks"}, {"idx": 17, "reason": "wrong_answer", "expected": "vuh", "got": "uhv"}] | codeforces | E | |
840 | 903_E. Swapping Characters | We had a string s consisting of n lowercase Latin letters. We made k copies of this string, thus obtaining k identical strings s1, s2, ..., sk. After that, in each of these strings we swapped exactly two characters (the characters we swapped could be identical, but they had different indices in the string).
You are gi... | java | //stan hu tao
//join nct ridin by first year culture reps
import static java.lang.Math.max;
import static java.lang.Math.min;
import static java.lang.Math.abs;
import static java.lang.System.out;
import java.util.*;
import java.io.*;
import java.math.*;
public class x903E
{
public static void main(String hi[]) thr... | partial | 24 | 25 | [{"idx": 6, "reason": "wrong_answer", "expected": "szk", "got": "zks"}] | codeforces | E |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.