Search is not available for this dataset
name stringlengths 2 112 | description stringlengths 29 13k | source int64 1 7 | difficulty int64 0 25 | solution stringlengths 7 983k | language stringclasses 4
values |
|---|---|---|---|---|---|
246_A. Buggy Sorting | Little boy Valera studies an algorithm of sorting an integer array. After studying the theory, he went on to the practical tasks. As a result, he wrote a program that sorts an array of n integers a1, a2, ..., an in the non-decreasing order. The pseudocode of the program, written by Valera, is given below. The input of ... | 2 | 7 | #include <bits/stdc++.h>
using namespace std;
int n, a[51], b[51];
int main() {
int n, i;
cin >> n;
if (n <= 2) {
cout << -1 << endl;
return 0;
}
cout << n + 2;
for (i = 2; i <= n; i++) cout << " " << n + 3 - i;
cout << endl;
return 0;
}
| CPP |
246_A. Buggy Sorting | Little boy Valera studies an algorithm of sorting an integer array. After studying the theory, he went on to the practical tasks. As a result, he wrote a program that sorts an array of n integers a1, a2, ..., an in the non-decreasing order. The pseudocode of the program, written by Valera, is given below. The input of ... | 2 | 7 | n=input()
if(n<=2):
print -1
else:
for i in range(1,n):
print i+1,
print 1 | PYTHON |
246_A. Buggy Sorting | Little boy Valera studies an algorithm of sorting an integer array. After studying the theory, he went on to the practical tasks. As a result, he wrote a program that sorts an array of n integers a1, a2, ..., an in the non-decreasing order. The pseudocode of the program, written by Valera, is given below. The input of ... | 2 | 7 | #include <bits/stdc++.h>
using namespace std;
const long long int N = 1e6 + 2, inf = 1e9 + 7;
int main() {
ios_base::sync_with_stdio(0);
cin.tie(0);
int n;
cin >> n;
if (n <= 2) cout << "-1\n", exit(0);
for (int i = n; i >= 1; i--) cout << i << " ";
cout << "\n";
return 0;
}
| CPP |
246_A. Buggy Sorting | Little boy Valera studies an algorithm of sorting an integer array. After studying the theory, he went on to the practical tasks. As a result, he wrote a program that sorts an array of n integers a1, a2, ..., an in the non-decreasing order. The pseudocode of the program, written by Valera, is given below. The input of ... | 2 | 7 | import java.util.Scanner;
public class BiggySorting {
public static void main(String[] args){
Scanner s = new Scanner(System.in);
int n = s.nextInt();
if(n<=2)
System.out.println("-1");
else{
for(int i=n;i>1;i--)
{
System.out.println(i);
}
System.out.println("1");... | JAVA |
246_A. Buggy Sorting | Little boy Valera studies an algorithm of sorting an integer array. After studying the theory, he went on to the practical tasks. As a result, he wrote a program that sorts an array of n integers a1, a2, ..., an in the non-decreasing order. The pseudocode of the program, written by Valera, is given below. The input of ... | 2 | 7 | n = int(raw_input())
if (n<3):
print -1
else:
for i in range(n,0,-1):
print i | PYTHON |
246_A. Buggy Sorting | Little boy Valera studies an algorithm of sorting an integer array. After studying the theory, he went on to the practical tasks. As a result, he wrote a program that sorts an array of n integers a1, a2, ..., an in the non-decreasing order. The pseudocode of the program, written by Valera, is given below. The input of ... | 2 | 7 | n = input()
if n < 3:
print -1
elif n == 3:
print "2 3 1"
else:
print "2 3 1 " + " ".join(map(str,range(4,n+1))) | PYTHON |
246_A. Buggy Sorting | Little boy Valera studies an algorithm of sorting an integer array. After studying the theory, he went on to the practical tasks. As a result, he wrote a program that sorts an array of n integers a1, a2, ..., an in the non-decreasing order. The pseudocode of the program, written by Valera, is given below. The input of ... | 2 | 7 | #Author: M@sud_P@rvez
n=int(input())
if n<=2:
print(-1)
else:
for i in range(n,0,-1):
print(i,end=" ")
| PYTHON3 |
246_A. Buggy Sorting | Little boy Valera studies an algorithm of sorting an integer array. After studying the theory, he went on to the practical tasks. As a result, he wrote a program that sorts an array of n integers a1, a2, ..., an in the non-decreasing order. The pseudocode of the program, written by Valera, is given below. The input of ... | 2 | 7 | import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.util.StringTokenizer;
public class BuggySorting {
public static void main(String[] args) {
PrintWriter pw = new PrintWriter(System.out);
reader(System... | JAVA |
246_A. Buggy Sorting | Little boy Valera studies an algorithm of sorting an integer array. After studying the theory, he went on to the practical tasks. As a result, he wrote a program that sorts an array of n integers a1, a2, ..., an in the non-decreasing order. The pseudocode of the program, written by Valera, is given below. The input of ... | 2 | 7 | import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.util.StringTokenizer;
public class BuggySorting {
public static void main(String[] args) throws IOException {
PrintWriter out = new PrintWriter(System.out);
sc = new StringTokenize... | JAVA |
246_A. Buggy Sorting | Little boy Valera studies an algorithm of sorting an integer array. After studying the theory, he went on to the practical tasks. As a result, he wrote a program that sorts an array of n integers a1, a2, ..., an in the non-decreasing order. The pseudocode of the program, written by Valera, is given below. The input of ... | 2 | 7 | #include <bits/stdc++.h>
using namespace std;
int n;
int main() {
scanf("%d", &n);
if (n <= 2) {
printf("-1\n");
return 0;
}
printf("%d", n);
for (n--; n; n--) printf(" %d", n);
return 0;
}
| CPP |
246_A. Buggy Sorting | Little boy Valera studies an algorithm of sorting an integer array. After studying the theory, he went on to the practical tasks. As a result, he wrote a program that sorts an array of n integers a1, a2, ..., an in the non-decreasing order. The pseudocode of the program, written by Valera, is given below. The input of ... | 2 | 7 | n=input()-2
print -1 if n<1 else '2 3','1 '*n
| PYTHON |
246_A. Buggy Sorting | Little boy Valera studies an algorithm of sorting an integer array. After studying the theory, he went on to the practical tasks. As a result, he wrote a program that sorts an array of n integers a1, a2, ..., an in the non-decreasing order. The pseudocode of the program, written by Valera, is given below. The input of ... | 2 | 7 | from Queue import * # Queue, LifoQueue, PriorityQueue
from bisect import * #bisect, insort
from datetime import *
from collections import * #deque, Counter,OrderedDict,defaultdict
import calendar
import heapq
import math
import copy
import itertools
myread = lambda : map(int,raw_input().split())
def solver():
n = ... | PYTHON |
246_A. Buggy Sorting | Little boy Valera studies an algorithm of sorting an integer array. After studying the theory, he went on to the practical tasks. As a result, he wrote a program that sorts an array of n integers a1, a2, ..., an in the non-decreasing order. The pseudocode of the program, written by Valera, is given below. The input of ... | 2 | 7 | n = int(input())
if n > 2:
l = [ i for i in range(n,0,-1)]
print(*l,sep = ' ')
else:
print(-1)
| PYTHON3 |
246_A. Buggy Sorting | Little boy Valera studies an algorithm of sorting an integer array. After studying the theory, he went on to the practical tasks. As a result, he wrote a program that sorts an array of n integers a1, a2, ..., an in the non-decreasing order. The pseudocode of the program, written by Valera, is given below. The input of ... | 2 | 7 | n = int(raw_input())
if n >= 3:
print 10,
print 9,
print 8,
for i in range(n-3):
print 1,
else:
print -1 | PYTHON |
246_A. Buggy Sorting | Little boy Valera studies an algorithm of sorting an integer array. After studying the theory, he went on to the practical tasks. As a result, he wrote a program that sorts an array of n integers a1, a2, ..., an in the non-decreasing order. The pseudocode of the program, written by Valera, is given below. The input of ... | 2 | 7 | #include <bits/stdc++.h>
int main() {
int n, i, j, k, temp;
while (scanf("%d", &n) == 1) {
if (n < 3)
printf("-1\n");
else {
printf("%d", n);
for (i = n - 1; i > 0; i--) printf(" %d", i);
}
}
return 0;
}
| CPP |
246_A. Buggy Sorting | Little boy Valera studies an algorithm of sorting an integer array. After studying the theory, he went on to the practical tasks. As a result, he wrote a program that sorts an array of n integers a1, a2, ..., an in the non-decreasing order. The pseudocode of the program, written by Valera, is given below. The input of ... | 2 | 7 | #include <bits/stdc++.h>
using namespace std;
int main() {
int n;
scanf("%d", &n);
if (n <= 2)
printf("-1\n");
else {
n -= 2;
printf("2 3");
while (n--) {
printf(" 1");
}
printf("\n");
}
}
| CPP |
246_A. Buggy Sorting | Little boy Valera studies an algorithm of sorting an integer array. After studying the theory, he went on to the practical tasks. As a result, he wrote a program that sorts an array of n integers a1, a2, ..., an in the non-decreasing order. The pseudocode of the program, written by Valera, is given below. The input of ... | 2 | 7 | #include <bits/stdc++.h>
using namespace std;
int main() {
int n, i;
cin >> n;
if (n < 3)
cout << -1;
else {
cout << "5 3 2";
for (i = 4; i <= n; i++) cout << " 5";
}
cout << endl;
return 0;
}
| CPP |
246_A. Buggy Sorting | Little boy Valera studies an algorithm of sorting an integer array. After studying the theory, he went on to the practical tasks. As a result, he wrote a program that sorts an array of n integers a1, a2, ..., an in the non-decreasing order. The pseudocode of the program, written by Valera, is given below. The input of ... | 2 | 7 | #include <bits/stdc++.h>
using namespace std;
int n;
int main() {
cin >> n;
if (n < 3)
cout << "-1";
else {
for (int i = n; i >= 1; i--) {
cout << i << " ";
}
}
return 0;
}
| CPP |
246_A. Buggy Sorting | Little boy Valera studies an algorithm of sorting an integer array. After studying the theory, he went on to the practical tasks. As a result, he wrote a program that sorts an array of n integers a1, a2, ..., an in the non-decreasing order. The pseudocode of the program, written by Valera, is given below. The input of ... | 2 | 7 | n=input()
if n<=2:
print -1
else:
a = [3,2]+[1]*(n-2)
for x in a:
print x,
print
| PYTHON |
246_A. Buggy Sorting | Little boy Valera studies an algorithm of sorting an integer array. After studying the theory, he went on to the practical tasks. As a result, he wrote a program that sorts an array of n integers a1, a2, ..., an in the non-decreasing order. The pseudocode of the program, written by Valera, is given below. The input of ... | 2 | 7 | n=input()
print -1 if n <3 else ' '.join(map(str,range(n,0,-1)))
| PYTHON |
246_A. Buggy Sorting | Little boy Valera studies an algorithm of sorting an integer array. After studying the theory, he went on to the practical tasks. As a result, he wrote a program that sorts an array of n integers a1, a2, ..., an in the non-decreasing order. The pseudocode of the program, written by Valera, is given below. The input of ... | 2 | 7 | n = int(input())
j = []
if n <= 2:
print(-1)
else:
for i in reversed(range(1, n+1)):
j.append(i)
print(' '.join(map(str, j))) | PYTHON3 |
246_A. Buggy Sorting | Little boy Valera studies an algorithm of sorting an integer array. After studying the theory, he went on to the practical tasks. As a result, he wrote a program that sorts an array of n integers a1, a2, ..., an in the non-decreasing order. The pseudocode of the program, written by Valera, is given below. The input of ... | 2 | 7 | import java.io.PrintWriter;
import java.util.Scanner;
/**
* <a href="http://codeforces.ru/problemset/problem/246/A"/>
*
* @author pvasilyev
* @since 29 Dec 2013
*/
public class Problem070 {
public static void main(String[] args) {
final Scanner reader = new Scanner(System.in);
final PrintWrit... | JAVA |
246_A. Buggy Sorting | Little boy Valera studies an algorithm of sorting an integer array. After studying the theory, he went on to the practical tasks. As a result, he wrote a program that sorts an array of n integers a1, a2, ..., an in the non-decreasing order. The pseudocode of the program, written by Valera, is given below. The input of ... | 2 | 7 |
import java.util.Scanner;
public class D {
public static void main(String[] args) {
Scanner scan = new Scanner(System.in);
int n=scan.nextInt();
if(n>2) {
for(int i=2;i<=n;i++) {
System.out.print(i+" ");
}
System.out.print("1");
}
else {
System.out.println("-1");
}
scan.close();... | JAVA |
246_A. Buggy Sorting | Little boy Valera studies an algorithm of sorting an integer array. After studying the theory, he went on to the practical tasks. As a result, he wrote a program that sorts an array of n integers a1, a2, ..., an in the non-decreasing order. The pseudocode of the program, written by Valera, is given below. The input of ... | 2 | 7 | import sys
import math
from collections import defaultdict
def read_line():
return sys.stdin.readline()[:-1]
def read_int():
return int(sys.stdin.readline())
def read_int_line():
return [int(v) for v in sys.stdin.readline().split()]
def fun(a,v):
for i,k in enumerate(a[::-1]):
if v>=k:
return (k,8-i)
... | PYTHON3 |
246_A. Buggy Sorting | Little boy Valera studies an algorithm of sorting an integer array. After studying the theory, he went on to the practical tasks. As a result, he wrote a program that sorts an array of n integers a1, a2, ..., an in the non-decreasing order. The pseudocode of the program, written by Valera, is given below. The input of ... | 2 | 7 | import java.io.*;
import java.util.*;
import java.lang.*;
public class A {
public static void main (String[] argv) throws Exception
{
BufferedReader in = new BufferedReader(new InputStreamReader(System.in));
StringTokenizer st = new StringTokenizer(in.readLine());
int n = Integer.parseInt(s... | JAVA |
246_A. Buggy Sorting | Little boy Valera studies an algorithm of sorting an integer array. After studying the theory, he went on to the practical tasks. As a result, he wrote a program that sorts an array of n integers a1, a2, ..., an in the non-decreasing order. The pseudocode of the program, written by Valera, is given below. The input of ... | 2 | 7 | #include <bits/stdc++.h>
int main() {
int n, i, j;
scanf("%d", &n);
if (n == 1 || n == 2) {
printf("-1");
} else {
for (i = n; i > 0; i--) {
printf("%d ", i);
}
}
return 0;
}
| CPP |
246_A. Buggy Sorting | Little boy Valera studies an algorithm of sorting an integer array. After studying the theory, he went on to the practical tasks. As a result, he wrote a program that sorts an array of n integers a1, a2, ..., an in the non-decreasing order. The pseudocode of the program, written by Valera, is given below. The input of ... | 2 | 7 | n = input()
if n < 3:
print '-1'
else:
for i in range(n)[::-1]:
print i + 1, | PYTHON |
246_A. Buggy Sorting | Little boy Valera studies an algorithm of sorting an integer array. After studying the theory, he went on to the practical tasks. As a result, he wrote a program that sorts an array of n integers a1, a2, ..., an in the non-decreasing order. The pseudocode of the program, written by Valera, is given below. The input of ... | 2 | 7 | import java.util.Scanner;
public class Question246A {
public static void main(String[] args) {
Scanner sc=new Scanner(System.in);
int n=sc.nextInt();
if(n>2){
for(int i=n;i>=1;i--){
System.out.print(i+" ");
}
}else {
System.out.pri... | JAVA |
246_A. Buggy Sorting | Little boy Valera studies an algorithm of sorting an integer array. After studying the theory, he went on to the practical tasks. As a result, he wrote a program that sorts an array of n integers a1, a2, ..., an in the non-decreasing order. The pseudocode of the program, written by Valera, is given below. The input of ... | 2 | 7 | import sys
n = int(sys.stdin.readline())
if(n <= 2):
print(-1)
exit()
res = []
for i in range(2, n + 1):
res.append(str(i))
res.append(str(1))
print(" ".join(res))
| PYTHON3 |
246_A. Buggy Sorting | Little boy Valera studies an algorithm of sorting an integer array. After studying the theory, he went on to the practical tasks. As a result, he wrote a program that sorts an array of n integers a1, a2, ..., an in the non-decreasing order. The pseudocode of the program, written by Valera, is given below. The input of ... | 2 | 7 | n=input()
if n<3:
print -1
else:
print 2,3,1,
for i in range(4,n+1):
print i, | PYTHON |
246_A. Buggy Sorting | Little boy Valera studies an algorithm of sorting an integer array. After studying the theory, he went on to the practical tasks. As a result, he wrote a program that sorts an array of n integers a1, a2, ..., an in the non-decreasing order. The pseudocode of the program, written by Valera, is given below. The input of ... | 2 | 7 | #include <bits/stdc++.h>
using namespace std;
int main() {
int n;
cin >> n;
if (n < 3)
cout << -1 << endl;
else {
cout << 2 << " " << 3 << " " << 1 << " ";
for (int i = 0; i < n - 3; i++) cout << 1 << " ";
cout << endl;
}
return 0;
}
| CPP |
246_A. Buggy Sorting | Little boy Valera studies an algorithm of sorting an integer array. After studying the theory, he went on to the practical tasks. As a result, he wrote a program that sorts an array of n integers a1, a2, ..., an in the non-decreasing order. The pseudocode of the program, written by Valera, is given below. The input of ... | 2 | 7 | n = int(raw_input())
if n == 1 or n == 2:
print -1
else: print ' '.join(map(str, range(2,n+1) + [1]))
| PYTHON |
246_A. Buggy Sorting | Little boy Valera studies an algorithm of sorting an integer array. After studying the theory, he went on to the practical tasks. As a result, he wrote a program that sorts an array of n integers a1, a2, ..., an in the non-decreasing order. The pseudocode of the program, written by Valera, is given below. The input of ... | 2 | 7 | #include <bits/stdc++.h>
#pragma comment(linker, "/STACK:16777216")
using namespace std;
int main() {
int n;
cin >> n;
if (n <= 2)
cout << -1;
else
for (int i = 0; i < n; ++i) cout << n - i << " ";
cout << endl;
}
| CPP |
246_A. Buggy Sorting | Little boy Valera studies an algorithm of sorting an integer array. After studying the theory, he went on to the practical tasks. As a result, he wrote a program that sorts an array of n integers a1, a2, ..., an in the non-decreasing order. The pseudocode of the program, written by Valera, is given below. The input of ... | 2 | 7 | n = int(input())
print(-1 if n < 3 else " ".join(["100"] * (n - 1) + ["1"])) | PYTHON3 |
246_A. Buggy Sorting | Little boy Valera studies an algorithm of sorting an integer array. After studying the theory, he went on to the practical tasks. As a result, he wrote a program that sorts an array of n integers a1, a2, ..., an in the non-decreasing order. The pseudocode of the program, written by Valera, is given below. The input of ... | 2 | 7 | def bubbleSort(a, n):
for i in range(n-1):
for j in range(i, n-1):
if a[j] > a[j+1]:
a[j], a[j+1] = a[j+1], a[j]
n=int(input())
if n<=2:
print(-1)
else:
#l=[]
for i in range(n, 0, -1):
print(i, end=' ')
#l.append(i)
""" print()
bubbleSort(l, l... | PYTHON3 |
246_A. Buggy Sorting | Little boy Valera studies an algorithm of sorting an integer array. After studying the theory, he went on to the practical tasks. As a result, he wrote a program that sorts an array of n integers a1, a2, ..., an in the non-decreasing order. The pseudocode of the program, written by Valera, is given below. The input of ... | 2 | 7 | #include <bits/stdc++.h>
using namespace std;
int main() {
int n, s;
cin >> n;
if (n < 3)
cout << "-1";
else
for (int i = n; i >= 1; i--) {
cout << i << " ";
}
}
| CPP |
246_A. Buggy Sorting | Little boy Valera studies an algorithm of sorting an integer array. After studying the theory, he went on to the practical tasks. As a result, he wrote a program that sorts an array of n integers a1, a2, ..., an in the non-decreasing order. The pseudocode of the program, written by Valera, is given below. The input of ... | 2 | 7 | #include <bits/stdc++.h>
using namespace std;
long long int mod = 1e9 + 7;
long long int inf = 1e9 + 7;
void solve() {
long long int n;
cin >> n;
if (n <= 2) {
cout << "-1" << endl;
} else {
long long int i;
for (i = n; i >= 1; i--) {
cout << i << " ";
}
cout << endl;
}
}
int main() ... | CPP |
246_A. Buggy Sorting | Little boy Valera studies an algorithm of sorting an integer array. After studying the theory, he went on to the practical tasks. As a result, he wrote a program that sorts an array of n integers a1, a2, ..., an in the non-decreasing order. The pseudocode of the program, written by Valera, is given below. The input of ... | 2 | 7 | #include <bits/stdc++.h>
using namespace std;
const long long N = 100;
int main() {
int n;
cin >> n;
if (n <= 2)
cout << -1;
else
for (int i = n; i >= 1; i--) {
cout << i << " ";
}
return 0;
}
| CPP |
246_A. Buggy Sorting | Little boy Valera studies an algorithm of sorting an integer array. After studying the theory, he went on to the practical tasks. As a result, he wrote a program that sorts an array of n integers a1, a2, ..., an in the non-decreasing order. The pseudocode of the program, written by Valera, is given below. The input of ... | 2 | 7 | import java.io.*;
import java.util.*;
public class A {
public static void main(String[] args) throws IOException {
Scanner s = new Scanner(System.in);
BufferedReader f = new BufferedReader(new InputStreamReader(System.in));
PrintWriter out = new PrintWriter(System.out);
int n = s.nextInt();
int[] backwar... | JAVA |
246_A. Buggy Sorting | Little boy Valera studies an algorithm of sorting an integer array. After studying the theory, he went on to the practical tasks. As a result, he wrote a program that sorts an array of n integers a1, a2, ..., an in the non-decreasing order. The pseudocode of the program, written by Valera, is given below. The input of ... | 2 | 7 |
import java.io.*;
import java.util.*;
public class BuggySorting
{
public BuggySorting(Scanner in)
{
int n;
int i;
n = in.nextInt();
if (n >= 3)
{
for (i = 0; i < n; i++)
{
if (i > 0)
System.out.printf(" ");
if (i == 2... | JAVA |
246_A. Buggy Sorting | Little boy Valera studies an algorithm of sorting an integer array. After studying the theory, he went on to the practical tasks. As a result, he wrote a program that sorts an array of n integers a1, a2, ..., an in the non-decreasing order. The pseudocode of the program, written by Valera, is given below. The input of ... | 2 | 7 | import java.util.Scanner;
public class A {
public static void main(String[] args) {
Scanner in = new Scanner(System.in);
byte n = in.nextByte();
if(n<=2) System.out.println(-1);
else {
for (int i = n; i > 0; i--) {
System.out.print(i+" ");
}
... | JAVA |
246_A. Buggy Sorting | Little boy Valera studies an algorithm of sorting an integer array. After studying the theory, he went on to the practical tasks. As a result, he wrote a program that sorts an array of n integers a1, a2, ..., an in the non-decreasing order. The pseudocode of the program, written by Valera, is given below. The input of ... | 2 | 7 | #include <bits/stdc++.h>
using namespace std;
int main() {
int n;
cin >> n;
if (n < 3) {
cout << "-1\n";
return 0;
}
for (int i = n; i > 0; i--) cout << i << " ";
return 0;
}
| CPP |
246_A. Buggy Sorting | Little boy Valera studies an algorithm of sorting an integer array. After studying the theory, he went on to the practical tasks. As a result, he wrote a program that sorts an array of n integers a1, a2, ..., an in the non-decreasing order. The pseudocode of the program, written by Valera, is given below. The input of ... | 2 | 7 | # Lista 1 PPC - K
n = int(input())
if n <= 2:
print("-1")
else:
for i in range(2,n+1):
print(str(i) + " ")
print(1)
| PYTHON3 |
246_A. Buggy Sorting | Little boy Valera studies an algorithm of sorting an integer array. After studying the theory, he went on to the practical tasks. As a result, he wrote a program that sorts an array of n integers a1, a2, ..., an in the non-decreasing order. The pseudocode of the program, written by Valera, is given below. The input of ... | 2 | 7 | import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.OutputStreamWriter;
import java.io.PrintWriter;
import java.math.BigInteger;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.HashSet;
import java.util.StringTokenizer;
import javax.swing.pl... | JAVA |
246_A. Buggy Sorting | Little boy Valera studies an algorithm of sorting an integer array. After studying the theory, he went on to the practical tasks. As a result, he wrote a program that sorts an array of n integers a1, a2, ..., an in the non-decreasing order. The pseudocode of the program, written by Valera, is given below. The input of ... | 2 | 7 | import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.StringTokenizer;
import java.io.IOException;
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.io.InputStream;
/**
* Built using CHelper plug-in
* Actual soluti... | JAVA |
246_A. Buggy Sorting | Little boy Valera studies an algorithm of sorting an integer array. After studying the theory, he went on to the practical tasks. As a result, he wrote a program that sorts an array of n integers a1, a2, ..., an in the non-decreasing order. The pseudocode of the program, written by Valera, is given below. The input of ... | 2 | 7 | n = int(input())
if n <= 2:
print(-1)
else:
print("2 " * (n - 1) + "1") | PYTHON3 |
246_A. Buggy Sorting | Little boy Valera studies an algorithm of sorting an integer array. After studying the theory, he went on to the practical tasks. As a result, he wrote a program that sorts an array of n integers a1, a2, ..., an in the non-decreasing order. The pseudocode of the program, written by Valera, is given below. The input of ... | 2 | 7 | #!/usr/local/bin/python
import sys
n = int(raw_input())
if n <=2:
print -1
sys.exit()
a = [i for i in xrange(n, 0, -1)]
print " ".join([str(i) for i in a])
"""
a = map(int, raw_input().split())
for i in xrange(n-1):
for j in xrange(i, n-1):
if a[j] > a[j+1]:
a[j+1], a[j] = a[j], a[j+1]
... | PYTHON |
246_A. Buggy Sorting | Little boy Valera studies an algorithm of sorting an integer array. After studying the theory, he went on to the practical tasks. As a result, he wrote a program that sorts an array of n integers a1, a2, ..., an in the non-decreasing order. The pseudocode of the program, written by Valera, is given below. The input of ... | 2 | 7 | n = int(input())
if n < 3:
print(-1)
else:
print(*[n - i for i in range(n)])
| PYTHON3 |
246_A. Buggy Sorting | Little boy Valera studies an algorithm of sorting an integer array. After studying the theory, he went on to the practical tasks. As a result, he wrote a program that sorts an array of n integers a1, a2, ..., an in the non-decreasing order. The pseudocode of the program, written by Valera, is given below. The input of ... | 2 | 7 | #include <bits/stdc++.h>
using namespace std;
int main() {
int n;
cin >> n;
if (n > 2) {
for (int i = n; i >= 2; i--) cout << i << " ";
cout << 1 << endl;
} else
cout << -1 << endl;
return 0;
}
| CPP |
246_A. Buggy Sorting | Little boy Valera studies an algorithm of sorting an integer array. After studying the theory, he went on to the practical tasks. As a result, he wrote a program that sorts an array of n integers a1, a2, ..., an in the non-decreasing order. The pseudocode of the program, written by Valera, is given below. The input of ... | 2 | 7 | n = int(input())
if n == 1 or n == 2:
print(-1)
else:
print(*list(range(n, 0, -1)))
| PYTHON3 |
246_A. Buggy Sorting | Little boy Valera studies an algorithm of sorting an integer array. After studying the theory, he went on to the practical tasks. As a result, he wrote a program that sorts an array of n integers a1, a2, ..., an in the non-decreasing order. The pseudocode of the program, written by Valera, is given below. The input of ... | 2 | 7 | import java.util.*;
public class Main{
public static void ValeraSort(int[] a,int n)
{
for(int i = 1; i < n; i++)
{
for (int j = i; j < n; j++)
{
if (a[j]>a[j+1])
{
int temp = a[j];
a[j] = a[j+1];
a[j+1] = temp;
... | JAVA |
246_A. Buggy Sorting | Little boy Valera studies an algorithm of sorting an integer array. After studying the theory, he went on to the practical tasks. As a result, he wrote a program that sorts an array of n integers a1, a2, ..., an in the non-decreasing order. The pseudocode of the program, written by Valera, is given below. The input of ... | 2 | 7 | import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.Scanner;
/**
* Built using CHelper plug-in
* Actual solution is at the top
*/
public class Main {
public static void main(String[] args) {
InputStream inputStream = System.in... | JAVA |
246_A. Buggy Sorting | Little boy Valera studies an algorithm of sorting an integer array. After studying the theory, he went on to the practical tasks. As a result, he wrote a program that sorts an array of n integers a1, a2, ..., an in the non-decreasing order. The pseudocode of the program, written by Valera, is given below. The input of ... | 2 | 7 | #include <bits/stdc++.h>
using namespace std;
int main() {
int n;
cin >> n;
if (n == 1 || n == 2)
cout << -1 << endl;
else
while (n) {
cout << n << " ";
n--;
}
return 0;
}
| CPP |
246_A. Buggy Sorting | Little boy Valera studies an algorithm of sorting an integer array. After studying the theory, he went on to the practical tasks. As a result, he wrote a program that sorts an array of n integers a1, a2, ..., an in the non-decreasing order. The pseudocode of the program, written by Valera, is given below. The input of ... | 2 | 7 | n = int(input())
print(*((-1,), range(n, 0, -1))[n > 2]) | PYTHON3 |
246_A. Buggy Sorting | Little boy Valera studies an algorithm of sorting an integer array. After studying the theory, he went on to the practical tasks. As a result, he wrote a program that sorts an array of n integers a1, a2, ..., an in the non-decreasing order. The pseudocode of the program, written by Valera, is given below. The input of ... | 2 | 7 | #include <bits/stdc++.h>
using namespace std;
int main() {
int n;
cin >> n;
if (n <= 2)
cout << -1 << endl;
else {
for (int i = n; i > 0; i--) {
if (i != n) cout << " ";
cout << i;
}
cout << endl;
}
return 0;
}
| CPP |
246_A. Buggy Sorting | Little boy Valera studies an algorithm of sorting an integer array. After studying the theory, he went on to the practical tasks. As a result, he wrote a program that sorts an array of n integers a1, a2, ..., an in the non-decreasing order. The pseudocode of the program, written by Valera, is given below. The input of ... | 2 | 7 | n = input()
if n <= 2: print -1
else:
print 2, 3,
for i in xrange(n - 2): print 1,
| PYTHON |
246_A. Buggy Sorting | Little boy Valera studies an algorithm of sorting an integer array. After studying the theory, he went on to the practical tasks. As a result, he wrote a program that sorts an array of n integers a1, a2, ..., an in the non-decreasing order. The pseudocode of the program, written by Valera, is given below. The input of ... | 2 | 7 | ri = lambda: raw_input().strip()
n = int(ri())
if n == 1 or n == 2:
print -1
else:
for i in xrange(n, 0, -1):
print i,
print | PYTHON |
246_A. Buggy Sorting | Little boy Valera studies an algorithm of sorting an integer array. After studying the theory, he went on to the practical tasks. As a result, he wrote a program that sorts an array of n integers a1, a2, ..., an in the non-decreasing order. The pseudocode of the program, written by Valera, is given below. The input of ... | 2 | 7 | #include <bits/stdc++.h>
const long long mod = 1000000007;
using namespace std;
int main() {
int n;
cin >> n;
if (n == 1 || n == 2)
cout << -1;
else {
for (int i = 1; i <= (n); i++) cout << (100 - i) << " ";
}
}
| CPP |
246_A. Buggy Sorting | Little boy Valera studies an algorithm of sorting an integer array. After studying the theory, he went on to the practical tasks. As a result, he wrote a program that sorts an array of n integers a1, a2, ..., an in the non-decreasing order. The pseudocode of the program, written by Valera, is given below. The input of ... | 2 | 7 | n = int(input())
if n <= 2:
print(-1)
else:
for i in range (n, 0, -1):
print(i, end= ' ') | PYTHON3 |
246_A. Buggy Sorting | Little boy Valera studies an algorithm of sorting an integer array. After studying the theory, he went on to the practical tasks. As a result, he wrote a program that sorts an array of n integers a1, a2, ..., an in the non-decreasing order. The pseudocode of the program, written by Valera, is given below. The input of ... | 2 | 7 | import java.util.*;
public class Main {
public static void main(String[] args) {
Scanner sc=new Scanner(System.in);
int inputByte=sc.nextInt();
if(inputByte<3) {
System.out.print(-1);
}
else {
for(int i=inputByte; i>0; i--){
... | JAVA |
246_A. Buggy Sorting | Little boy Valera studies an algorithm of sorting an integer array. After studying the theory, he went on to the practical tasks. As a result, he wrote a program that sorts an array of n integers a1, a2, ..., an in the non-decreasing order. The pseudocode of the program, written by Valera, is given below. The input of ... | 2 | 7 | #include <bits/stdc++.h>
using namespace std;
int main() {
int n, i;
scanf("%d", &n);
if (n <= 2)
printf("-1");
else {
for (i = 0; i < n; i++) {
printf("%d ", n - i);
}
}
return 0;
}
| CPP |
246_A. Buggy Sorting | Little boy Valera studies an algorithm of sorting an integer array. After studying the theory, he went on to the practical tasks. As a result, he wrote a program that sorts an array of n integers a1, a2, ..., an in the non-decreasing order. The pseudocode of the program, written by Valera, is given below. The input of ... | 2 | 7 | n = input()
if n == 1 or n == 2: print -1
else:
for i in xrange(n):
print n - i, | PYTHON |
246_A. Buggy Sorting | Little boy Valera studies an algorithm of sorting an integer array. After studying the theory, he went on to the practical tasks. As a result, he wrote a program that sorts an array of n integers a1, a2, ..., an in the non-decreasing order. The pseudocode of the program, written by Valera, is given below. The input of ... | 2 | 7 | n=input()
if n<3:print-1
else:print" ".join(map(str,[i for i in range(n,0,-1)]))
| PYTHON |
246_A. Buggy Sorting | Little boy Valera studies an algorithm of sorting an integer array. After studying the theory, he went on to the practical tasks. As a result, he wrote a program that sorts an array of n integers a1, a2, ..., an in the non-decreasing order. The pseudocode of the program, written by Valera, is given below. The input of ... | 2 | 7 | n = input()
print [' '.join(map(str, range(n, 0, -1))), -1][n < 3] | PYTHON |
246_A. Buggy Sorting | Little boy Valera studies an algorithm of sorting an integer array. After studying the theory, he went on to the practical tasks. As a result, he wrote a program that sorts an array of n integers a1, a2, ..., an in the non-decreasing order. The pseudocode of the program, written by Valera, is given below. The input of ... | 2 | 7 | n = input()
if n<=2:
print -1
else:
print ' '.join(map(str,range(n,0,-1))) | PYTHON |
246_A. Buggy Sorting | Little boy Valera studies an algorithm of sorting an integer array. After studying the theory, he went on to the practical tasks. As a result, he wrote a program that sorts an array of n integers a1, a2, ..., an in the non-decreasing order. The pseudocode of the program, written by Valera, is given below. The input of ... | 2 | 7 | # Description of the problem can be found at http://codeforces.com/problemset/problem/246/A
n = int(input())
if n <= 2:
print(-1)
else:
print("2 " * (n - 1) + "1") | PYTHON3 |
246_A. Buggy Sorting | Little boy Valera studies an algorithm of sorting an integer array. After studying the theory, he went on to the practical tasks. As a result, he wrote a program that sorts an array of n integers a1, a2, ..., an in the non-decreasing order. The pseudocode of the program, written by Valera, is given below. The input of ... | 2 | 7 |
import java.util.Scanner;
public class A2 {
public static void main(String[] args) {
Scanner nik = new Scanner(System.in);
int n = nik.nextInt();
if (n <= 2) {
System.out.println(-1);
} else {
System.out.print(n - 1 + " " + n + " ");
n -= 2;
for (int i = n; i >= 1; i--) {
System.out.print... | JAVA |
246_A. Buggy Sorting | Little boy Valera studies an algorithm of sorting an integer array. After studying the theory, he went on to the practical tasks. As a result, he wrote a program that sorts an array of n integers a1, a2, ..., an in the non-decreasing order. The pseudocode of the program, written by Valera, is given below. The input of ... | 2 | 7 | n = int(raw_input())
if n < 3:
print -1
else:
for i in range(n):
print n - i | PYTHON |
246_A. Buggy Sorting | Little boy Valera studies an algorithm of sorting an integer array. After studying the theory, he went on to the practical tasks. As a result, he wrote a program that sorts an array of n integers a1, a2, ..., an in the non-decreasing order. The pseudocode of the program, written by Valera, is given below. The input of ... | 2 | 7 | import sys
n = int(sys.stdin.readline())
if n < 3:
print -1
else:
print ' '.join([str(x) for x in range(n, 0, -1)])
| PYTHON |
246_A. Buggy Sorting | Little boy Valera studies an algorithm of sorting an integer array. After studying the theory, he went on to the practical tasks. As a result, he wrote a program that sorts an array of n integers a1, a2, ..., an in the non-decreasing order. The pseudocode of the program, written by Valera, is given below. The input of ... | 2 | 7 | import java.util.StringTokenizer;
import java.util.Collections;
import java.util.Collection;
import java.util.Set;
import java.util.HashSet;
import java.util.Map;
import java.util.HashMap;
import java.util.Arrays;
import java.util.ArrayList;
import java.util.Queue;
import java.util.LinkedList;
import java.util.Priority... | JAVA |
246_A. Buggy Sorting | Little boy Valera studies an algorithm of sorting an integer array. After studying the theory, he went on to the practical tasks. As a result, he wrote a program that sorts an array of n integers a1, a2, ..., an in the non-decreasing order. The pseudocode of the program, written by Valera, is given below. The input of ... | 2 | 7 | n = int(raw_input())
print ' '.join(map(str,range(2,n+1) + [1])) if n > 2 else -1
| PYTHON |
246_A. Buggy Sorting | Little boy Valera studies an algorithm of sorting an integer array. After studying the theory, he went on to the practical tasks. As a result, he wrote a program that sorts an array of n integers a1, a2, ..., an in the non-decreasing order. The pseudocode of the program, written by Valera, is given below. The input of ... | 2 | 7 |
import java.util.Scanner;
public class BuggySorting {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
int n = sc.nextInt();
if(n==1 ||n==2){
System.out.println("-1");
}else{
int ans=100;
for(int i=0;i<n;i++){
Sy... | JAVA |
246_A. Buggy Sorting | Little boy Valera studies an algorithm of sorting an integer array. After studying the theory, he went on to the practical tasks. As a result, he wrote a program that sorts an array of n integers a1, a2, ..., an in the non-decreasing order. The pseudocode of the program, written by Valera, is given below. The input of ... | 2 | 7 | #include <bits/stdc++.h>
using namespace std;
int main() {
int n, i;
cin >> n;
int lis[100];
if (n <= 2) {
cout << -1;
return 0;
} else {
for (i = 2; i <= n; i++) {
cout << i << " ";
lis[i - 2] = i;
}
cout << 1;
lis[i - 2] = 1;
}
return 0;
}
| CPP |
246_A. Buggy Sorting | Little boy Valera studies an algorithm of sorting an integer array. After studying the theory, he went on to the practical tasks. As a result, he wrote a program that sorts an array of n integers a1, a2, ..., an in the non-decreasing order. The pseudocode of the program, written by Valera, is given below. The input of ... | 2 | 7 | #include <bits/stdc++.h>
using namespace std;
int main() {
int n;
cin >> n;
if (n == 1 || n == 2)
cout << -1 << endl;
else {
cout << n;
for (int i = n - 1; i >= 1; i--) cout << " " << i;
}
return 0;
}
| CPP |
246_A. Buggy Sorting | Little boy Valera studies an algorithm of sorting an integer array. After studying the theory, he went on to the practical tasks. As a result, he wrote a program that sorts an array of n integers a1, a2, ..., an in the non-decreasing order. The pseudocode of the program, written by Valera, is given below. The input of ... | 2 | 7 | n = int(input())
if n==1 or n==2:
print(-1)
else:
for i in range(n):
print(n-i, end=' ') | PYTHON3 |
246_A. Buggy Sorting | Little boy Valera studies an algorithm of sorting an integer array. After studying the theory, he went on to the practical tasks. As a result, he wrote a program that sorts an array of n integers a1, a2, ..., an in the non-decreasing order. The pseudocode of the program, written by Valera, is given below. The input of ... | 2 | 7 | import static java.util.Arrays.*;
import java.io.*;
import java.lang.reflect.*;
import java.util.*;
public class A {
final int MOD = (int)1e9 + 7;
final double eps = 1e-12;
final int INF = (int)1e9;
public A () {
int N = sc.nextInt();
if (N <= 2)
print(-1);
else {
Integer [] A = new Integer[N];
... | JAVA |
246_A. Buggy Sorting | Little boy Valera studies an algorithm of sorting an integer array. After studying the theory, he went on to the practical tasks. As a result, he wrote a program that sorts an array of n integers a1, a2, ..., an in the non-decreasing order. The pseudocode of the program, written by Valera, is given below. The input of ... | 2 | 7 | n=input()
if n==2 or n==1:print-1;exit()
print" ".join(map(str,[x for x in range(n,0,-1)])) | PYTHON |
246_A. Buggy Sorting | Little boy Valera studies an algorithm of sorting an integer array. After studying the theory, he went on to the practical tasks. As a result, he wrote a program that sorts an array of n integers a1, a2, ..., an in the non-decreasing order. The pseudocode of the program, written by Valera, is given below. The input of ... | 2 | 7 | N = int(input())
if N < 3:
print(-1)
else:
for i in range(N, 0, -1):
print(i,end=' ') | PYTHON3 |
246_A. Buggy Sorting | Little boy Valera studies an algorithm of sorting an integer array. After studying the theory, he went on to the practical tasks. As a result, he wrote a program that sorts an array of n integers a1, a2, ..., an in the non-decreasing order. The pseudocode of the program, written by Valera, is given below. The input of ... | 2 | 7 | import java.util.*;
import java.lang.*;
import java.math.*;
import java.io.*;
import static java.lang.Math.*;
import static java.util.Arrays.*;
import static java.util.Collections.*;
// Buggy Sorting
// 2012/11/21
public class P246A{
Scanner sc=new Scanner(System.in);
int n;
void run(){
n=sc.nextInt();
solve(... | JAVA |
246_A. Buggy Sorting | Little boy Valera studies an algorithm of sorting an integer array. After studying the theory, he went on to the practical tasks. As a result, he wrote a program that sorts an array of n integers a1, a2, ..., an in the non-decreasing order. The pseudocode of the program, written by Valera, is given below. The input of ... | 2 | 7 | #include <bits/stdc++.h>
using namespace std;
const int N = 300000;
int main() {
int n;
scanf("%d", &n);
if (n == 1 || n == 2)
printf("-1\n");
else {
for (int i = n; i >= 1; i--) printf("%d ", i);
}
return 0;
}
| CPP |
246_A. Buggy Sorting | Little boy Valera studies an algorithm of sorting an integer array. After studying the theory, he went on to the practical tasks. As a result, he wrote a program that sorts an array of n integers a1, a2, ..., an in the non-decreasing order. The pseudocode of the program, written by Valera, is given below. The input of ... | 2 | 7 | m = []
n = int(input())
for i in range(1, n + 1):
m.append(n + 1 - i)
a = list(m)
a.sort()
for i in range(n - 1):
for j in range(i, n - 1):
if m[j] > m[j + 1]:
m[j], m[j + 1] = m[j + 1], m[j]
if m == a:
print(-1)
else:
a.reverse()
print(* a, sep = " ") | PYTHON3 |
246_A. Buggy Sorting | Little boy Valera studies an algorithm of sorting an integer array. After studying the theory, he went on to the practical tasks. As a result, he wrote a program that sorts an array of n integers a1, a2, ..., an in the non-decreasing order. The pseudocode of the program, written by Valera, is given below. The input of ... | 2 | 7 | import java.util.*;
public final class BuggySorting
{
public static void main(String arg[])
{
Scanner br=new Scanner(System.in);
int n=br.nextInt();
if(n<=2)
System.out.println("-1");
else
{
for(int i=1;i<n;i++)
System.out.print((i+1)+" ");
System.out.print("1");
}
}
} | JAVA |
246_A. Buggy Sorting | Little boy Valera studies an algorithm of sorting an integer array. After studying the theory, he went on to the practical tasks. As a result, he wrote a program that sorts an array of n integers a1, a2, ..., an in the non-decreasing order. The pseudocode of the program, written by Valera, is given below. The input of ... | 2 | 7 | n = int(input())
if n > 2:
print(" ".join(map(str,list(range(n,0,-1)))))
else:
print(-1)
| PYTHON3 |
246_A. Buggy Sorting | Little boy Valera studies an algorithm of sorting an integer array. After studying the theory, he went on to the practical tasks. As a result, he wrote a program that sorts an array of n integers a1, a2, ..., an in the non-decreasing order. The pseudocode of the program, written by Valera, is given below. The input of ... | 2 | 7 | #include <bits/stdc++.h>
using namespace std;
int n, a[55], i;
int main() {
cin >> n;
if (n == 1 || n == 2)
cout << -1;
else {
a[1] = 90;
a[2] = 89;
for (i = 3; i <= n; i++) a[i] = i;
for (i = 1; i <= n; i++) cout << a[i] << " ";
}
return 0;
}
| CPP |
246_A. Buggy Sorting | Little boy Valera studies an algorithm of sorting an integer array. After studying the theory, he went on to the practical tasks. As a result, he wrote a program that sorts an array of n integers a1, a2, ..., an in the non-decreasing order. The pseudocode of the program, written by Valera, is given below. The input of ... | 2 | 7 | import java.util.Scanner;
public class BuggySorting {
public static void main(String[] args) {
Scanner scan = new Scanner(System.in);
int n = scan.nextInt();
if (n <= 2)System.out.println(-1);
else for (int i = n; i > 0; i--) System.out.print(i + " ");
}
} | JAVA |
246_A. Buggy Sorting | Little boy Valera studies an algorithm of sorting an integer array. After studying the theory, he went on to the practical tasks. As a result, he wrote a program that sorts an array of n integers a1, a2, ..., an in the non-decreasing order. The pseudocode of the program, written by Valera, is given below. The input of ... | 2 | 7 |
import java.util.*;
public class BuggySorting {
public static void main(String[] args) {
// TODO Auto-generated method stub
Scanner sc=new Scanner(System.in);
int n=sc.nextInt();
if(n<=2)
System.out.println("-1");
else
{
for(int i=n;i>=1;i--)
System.out.print(i+" ");
}
}
}
| JAVA |
246_A. Buggy Sorting | Little boy Valera studies an algorithm of sorting an integer array. After studying the theory, he went on to the practical tasks. As a result, he wrote a program that sorts an array of n integers a1, a2, ..., an in the non-decreasing order. The pseudocode of the program, written by Valera, is given below. The input of ... | 2 | 7 | #include <bits/stdc++.h>
using namespace std;
map<long long int, long long int> mp, mk;
set<long long int> s1, s2;
vector<long long int> v, w;
long long int a[2000006], b[2000006];
string s = "", p = "", q = "";
char ch;
long long int m, n, c, i, j, k, l, r, x, t, y, u, e, f, g, h, mn, mx, d;
int main() {
cin >> n;
... | CPP |
246_A. Buggy Sorting | Little boy Valera studies an algorithm of sorting an integer array. After studying the theory, he went on to the practical tasks. As a result, he wrote a program that sorts an array of n integers a1, a2, ..., an in the non-decreasing order. The pseudocode of the program, written by Valera, is given below. The input of ... | 2 | 7 | import java.io.*;
import java.math.BigInteger;
import java.util.*;
public class B implements Runnable {
final boolean ONLINE_JUDGE = System.getProperty("ONLINE_JUDGE") != null;
BufferedReader in;
PrintWriter out;
StringTokenizer tok = new StringTokenizer("");
public static void main(String[] arg... | JAVA |
246_A. Buggy Sorting | Little boy Valera studies an algorithm of sorting an integer array. After studying the theory, he went on to the practical tasks. As a result, he wrote a program that sorts an array of n integers a1, a2, ..., an in the non-decreasing order. The pseudocode of the program, written by Valera, is given below. The input of ... | 2 | 7 | #include <bits/stdc++.h>
using namespace std;
int n;
int main() {
cin >> n;
if (n <= 2) {
cout << "-1";
} else {
for (int i = n; i >= 1; --i) {
cout << i << " ";
}
}
return 0;
}
| CPP |
246_A. Buggy Sorting | Little boy Valera studies an algorithm of sorting an integer array. After studying the theory, he went on to the practical tasks. As a result, he wrote a program that sorts an array of n integers a1, a2, ..., an in the non-decreasing order. The pseudocode of the program, written by Valera, is given below. The input of ... | 2 | 7 | n=int(raw_input())
if n<3:
print -1
else:
ans=range(1,n+1)[::-1]
print ' '.join(map(str,ans)) | PYTHON |
246_A. Buggy Sorting | Little boy Valera studies an algorithm of sorting an integer array. After studying the theory, he went on to the practical tasks. As a result, he wrote a program that sorts an array of n integers a1, a2, ..., an in the non-decreasing order. The pseudocode of the program, written by Valera, is given below. The input of ... | 2 | 7 | #include <bits/stdc++.h>
using namespace std;
int main() {
int n;
cin >> n;
if (n <= 2)
cout << "-1" << endl;
else {
while (n) {
cout << n << " ";
n -= 1;
}
}
}
| CPP |
246_A. Buggy Sorting | Little boy Valera studies an algorithm of sorting an integer array. After studying the theory, he went on to the practical tasks. As a result, he wrote a program that sorts an array of n integers a1, a2, ..., an in the non-decreasing order. The pseudocode of the program, written by Valera, is given below. The input of ... | 2 | 7 | import java.io.BufferedReader;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.util.Arrays;
import java.util.Random;
import java.util.StringTokenizer;
public class A {
public static void main(String[] args) throws Exception {
FastScanner sc = new FastScanner(System.in);
Random rand = ne... | JAVA |
246_A. Buggy Sorting | Little boy Valera studies an algorithm of sorting an integer array. After studying the theory, he went on to the practical tasks. As a result, he wrote a program that sorts an array of n integers a1, a2, ..., an in the non-decreasing order. The pseudocode of the program, written by Valera, is given below. The input of ... | 2 | 7 | import java.io.BufferedInputStream;
import java.io.BufferedReader;
import java.io.FileInputStream;
import java.io.FileReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.Scanner;
import java.util.StringTokenizer;
public class BuggySorting {
static BufferedReader in;
static Scanner... | JAVA |
246_A. Buggy Sorting | Little boy Valera studies an algorithm of sorting an integer array. After studying the theory, he went on to the practical tasks. As a result, he wrote a program that sorts an array of n integers a1, a2, ..., an in the non-decreasing order. The pseudocode of the program, written by Valera, is given below. The input of ... | 2 | 7 | #include <bits/stdc++.h>
using namespace std;
int main() {
int n;
cin >> n;
if (n > 2) {
for (int i = 2; i <= n; ++i) {
cout << i << " ";
}
cout << 1 << endl;
} else {
cout << -1 << endl;
}
return 0;
}
| CPP |
246_A. Buggy Sorting | Little boy Valera studies an algorithm of sorting an integer array. After studying the theory, he went on to the practical tasks. As a result, he wrote a program that sorts an array of n integers a1, a2, ..., an in the non-decreasing order. The pseudocode of the program, written by Valera, is given below. The input of ... | 2 | 7 | #include <bits/stdc++.h>
using namespace std;
void solve() {
int n;
cin >> n;
if (n <= 2) {
cout << -1 << "\n";
} else {
for (int i = n; i >= 1; i--) {
cout << i << " ";
}
cout << "\n";
}
}
signed main() {
ios_base::sync_with_stdio(0);
cin.tie(nullptr);
auto start = std::chrono::hi... | CPP |
246_A. Buggy Sorting | Little boy Valera studies an algorithm of sorting an integer array. After studying the theory, he went on to the practical tasks. As a result, he wrote a program that sorts an array of n integers a1, a2, ..., an in the non-decreasing order. The pseudocode of the program, written by Valera, is given below. The input of ... | 2 | 7 | import java.util.Scanner;
public class A_246_Buggy_Sorting {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
int n = sc.nextInt();
if (n <= 2) {
System.out.println(-1);
} else {
for (int i = 0; i < n; i++) {
System.out.println((n - i) + " ");
}
}
}
}
| JAVA |
246_A. Buggy Sorting | Little boy Valera studies an algorithm of sorting an integer array. After studying the theory, he went on to the practical tasks. As a result, he wrote a program that sorts an array of n integers a1, a2, ..., an in the non-decreasing order. The pseudocode of the program, written by Valera, is given below. The input of ... | 2 | 7 | n = input()
print " ".join(map(str,range(n,0,-1))) if n > 2 else -1 | PYTHON |
246_A. Buggy Sorting | Little boy Valera studies an algorithm of sorting an integer array. After studying the theory, he went on to the practical tasks. As a result, he wrote a program that sorts an array of n integers a1, a2, ..., an in the non-decreasing order. The pseudocode of the program, written by Valera, is given below. The input of ... | 2 | 7 | n = input()
print -1 if n <= 2 else " ".join(map(str, range(n, 0, -1))) | PYTHON |
246_A. Buggy Sorting | Little boy Valera studies an algorithm of sorting an integer array. After studying the theory, he went on to the practical tasks. As a result, he wrote a program that sorts an array of n integers a1, a2, ..., an in the non-decreasing order. The pseudocode of the program, written by Valera, is given below. The input of ... | 2 | 7 | FILE = "P1"
try:
inFile = open(FILE+".txt")
except:
pass
def read():
try:
return inFile.readline().strip()
except:
return raw_input().strip()
n = int(read())
if n <= 2:
print -1
else:
for i in xrange(2,n+1):
print i,
print 1 | PYTHON |
246_A. Buggy Sorting | Little boy Valera studies an algorithm of sorting an integer array. After studying the theory, he went on to the practical tasks. As a result, he wrote a program that sorts an array of n integers a1, a2, ..., an in the non-decreasing order. The pseudocode of the program, written by Valera, is given below. The input of ... | 2 | 7 | from sys import stdin,stdout
import bisect
import math
def st():
return list(stdin.readline().strip())
def inp():
return int(stdin.readline())
def li():
return list(map(int,stdin.readline().split()))
def mp():
return map(int,stdin.readline().split())
def pr(n):
stdout.write(str(n)+"\n")
def... | PYTHON3 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.