prob_desc_description
stringlengths
63
3.8k
prob_desc_output_spec
stringlengths
17
1.47k
lang_cluster
stringclasses
2 values
src_uid
stringlengths
32
32
code_uid
stringlengths
32
32
lang
stringclasses
7 values
prob_desc_output_to
stringclasses
3 values
prob_desc_memory_limit
stringclasses
19 values
file_name
stringclasses
111 values
tags
listlengths
0
11
prob_desc_created_at
stringlengths
10
10
prob_desc_sample_inputs
stringlengths
2
802
prob_desc_notes
stringlengths
4
3k
exec_outcome
stringclasses
1 value
difficulty
int64
-1
3.5k
prob_desc_input_from
stringclasses
3 values
prob_desc_time_limit
stringclasses
27 values
prob_desc_input_spec
stringlengths
28
2.42k
prob_desc_sample_outputs
stringlengths
2
796
source_code
stringlengths
42
65.5k
hidden_unit_tests
stringclasses
1 value
You are given a description of a depot. It is a rectangular checkered field of n × m size. Each cell in a field can be empty (".") or it can be occupied by a wall ("*"). You have one bomb. If you lay the bomb at the cell (x, y), then after triggering it will wipe out all walls in the row x and all walls in the column y...
If it is impossible to wipe out all walls by placing and triggering exactly one bomb, then print "NO" in the first line (without quotes). Otherwise print "YES" (without quotes) in the first line and two integers in the second line — the coordinates of the cell at which the bomb should be laid. If there are multiple ans...
C
12a768b502ddb07798830c9728fba5c4
c49f5521753cbc66180b28731f147d89
GNU C
standard output
256 megabytes
train_002.jsonl
[ "implementation" ]
1468933500
["3 4\n.*..\n....\n.*..", "3 3\n..*\n.*.\n*..", "6 5\n..*..\n..*..\n*****\n..*..\n..*..\n..*.."]
null
PASSED
1,400
standard input
1 second
The first line contains two positive integers n and m (1 ≤ n, m ≤ 1000) — the number of rows and columns in the depot field. The next n lines contain m symbols "." and "*" each — the description of the field. j-th symbol in i-th of them stands for cell (i, j). If the symbol is equal to ".", then the corresponding cell...
["YES\n1 2", "NO", "YES\n3 3"]
#include <stdio.h> int cnt_r[1020],cnt_c[1020],wall[1020][1020]; int main() { int r,c,cnt=0,i,j; char x; scanf("%d%d",&r,&c); for (i=1;i<=r;i++) for (j=1;j<=c;j++) { scanf(" %c",&x); if (x=='*') cnt_r[i]++, cnt_c[j]++, wall[i][j] = 1, cnt++; } for (i=1;i<=r;i++) for (j=1;j<=c;j++) ...
You are given a description of a depot. It is a rectangular checkered field of n × m size. Each cell in a field can be empty (".") or it can be occupied by a wall ("*"). You have one bomb. If you lay the bomb at the cell (x, y), then after triggering it will wipe out all walls in the row x and all walls in the column y...
If it is impossible to wipe out all walls by placing and triggering exactly one bomb, then print "NO" in the first line (without quotes). Otherwise print "YES" (without quotes) in the first line and two integers in the second line — the coordinates of the cell at which the bomb should be laid. If there are multiple ans...
C
12a768b502ddb07798830c9728fba5c4
6464498d9951f0b3cca6cbb55876de92
GNU C
standard output
256 megabytes
train_002.jsonl
[ "implementation" ]
1468933500
["3 4\n.*..\n....\n.*..", "3 3\n..*\n.*.\n*..", "6 5\n..*..\n..*..\n*****\n..*..\n..*..\n..*.."]
null
PASSED
1,400
standard input
1 second
The first line contains two positive integers n and m (1 ≤ n, m ≤ 1000) — the number of rows and columns in the depot field. The next n lines contain m symbols "." and "*" each — the description of the field. j-th symbol in i-th of them stands for cell (i, j). If the symbol is equal to ".", then the corresponding cell...
["YES\n1 2", "NO", "YES\n3 3"]
/* Problem: 699B - One Bomb */ /* Solver: Gusztav Szmolik */ #include <stdio.h> #include <string.h> unsigned char d[1000][1000]; int main () { unsigned short n; unsigned short m; unsigned short i; unsigned short wr[1000]; unsigned short wc[1000]; unsigned int sw; unsigned char s[1002]...
You are given a description of a depot. It is a rectangular checkered field of n × m size. Each cell in a field can be empty (".") or it can be occupied by a wall ("*"). You have one bomb. If you lay the bomb at the cell (x, y), then after triggering it will wipe out all walls in the row x and all walls in the column y...
If it is impossible to wipe out all walls by placing and triggering exactly one bomb, then print "NO" in the first line (without quotes). Otherwise print "YES" (without quotes) in the first line and two integers in the second line — the coordinates of the cell at which the bomb should be laid. If there are multiple ans...
C
12a768b502ddb07798830c9728fba5c4
3e05fbc9f0ff03a41faabb29d8311305
GNU C
standard output
256 megabytes
train_002.jsonl
[ "implementation" ]
1468933500
["3 4\n.*..\n....\n.*..", "3 3\n..*\n.*.\n*..", "6 5\n..*..\n..*..\n*****\n..*..\n..*..\n..*.."]
null
PASSED
1,400
standard input
1 second
The first line contains two positive integers n and m (1 ≤ n, m ≤ 1000) — the number of rows and columns in the depot field. The next n lines contain m symbols "." and "*" each — the description of the field. j-th symbol in i-th of them stands for cell (i, j). If the symbol is equal to ".", then the corresponding cell...
["YES\n1 2", "NO", "YES\n3 3"]
#include<stdio.h> int wallrow[1000001],wallcol[1000001]; int wall[1000][1000]; int main(){ int n,m,i,j,length=0,row,col,flag=0,count=0; char c; scanf("%d %d",&n,&m); for(i=0;i<n;i++) { for(j=0;j<m;j++) { scanf(" %c",&c); if(c=='*') { wall[i][j]=1; ...
You are given a description of a depot. It is a rectangular checkered field of n × m size. Each cell in a field can be empty (".") or it can be occupied by a wall ("*"). You have one bomb. If you lay the bomb at the cell (x, y), then after triggering it will wipe out all walls in the row x and all walls in the column y...
If it is impossible to wipe out all walls by placing and triggering exactly one bomb, then print "NO" in the first line (without quotes). Otherwise print "YES" (without quotes) in the first line and two integers in the second line — the coordinates of the cell at which the bomb should be laid. If there are multiple ans...
C
12a768b502ddb07798830c9728fba5c4
1fed02a255dfd8e49b4bc025d2643b67
GNU C
standard output
256 megabytes
train_002.jsonl
[ "implementation" ]
1468933500
["3 4\n.*..\n....\n.*..", "3 3\n..*\n.*.\n*..", "6 5\n..*..\n..*..\n*****\n..*..\n..*..\n..*.."]
null
PASSED
1,400
standard input
1 second
The first line contains two positive integers n and m (1 ≤ n, m ≤ 1000) — the number of rows and columns in the depot field. The next n lines contain m symbols "." and "*" each — the description of the field. j-th symbol in i-th of them stands for cell (i, j). If the symbol is equal to ".", then the corresponding cell...
["YES\n1 2", "NO", "YES\n3 3"]
#include<stdio.h> char field[1000][1000];int n,m,i=0,t=0,wall=0,a,k,ooo[1000]; void depot(int n,int m) { for(;i<n;i++) {scanf("%s",field[i]); getchar();} for(i=0;i<n;i++) for(t=0;t<m;t++) if(field[i][t]=='*') wall++; for(i=0;i<n;i++) { a=0; for(t=0;t<m;t++) if(field[i][t]=='*') a++; ooo[i]=a; } for(i=0;i<n...
You are given a description of a depot. It is a rectangular checkered field of n × m size. Each cell in a field can be empty (".") or it can be occupied by a wall ("*"). You have one bomb. If you lay the bomb at the cell (x, y), then after triggering it will wipe out all walls in the row x and all walls in the column y...
If it is impossible to wipe out all walls by placing and triggering exactly one bomb, then print "NO" in the first line (without quotes). Otherwise print "YES" (without quotes) in the first line and two integers in the second line — the coordinates of the cell at which the bomb should be laid. If there are multiple ans...
C
12a768b502ddb07798830c9728fba5c4
aa08ff01190ead270069b81688dde9ce
GNU C
standard output
256 megabytes
train_002.jsonl
[ "implementation" ]
1468933500
["3 4\n.*..\n....\n.*..", "3 3\n..*\n.*.\n*..", "6 5\n..*..\n..*..\n*****\n..*..\n..*..\n..*.."]
null
PASSED
1,400
standard input
1 second
The first line contains two positive integers n and m (1 ≤ n, m ≤ 1000) — the number of rows and columns in the depot field. The next n lines contain m symbols "." and "*" each — the description of the field. j-th symbol in i-th of them stands for cell (i, j). If the symbol is equal to ".", then the corresponding cell...
["YES\n1 2", "NO", "YES\n3 3"]
/*#include<cstdio> #include<iostream> using namespace std; int main() { int T; cin>>T; getchar(); while(T--) { } return 0; } */ #include<stdio.h> char field[1000][1000];int n,m,i=0,t=0,wall=0,a,ooo[1000],ttt[2222]; void depot(int n,int m) { for(;i<n;i++) {scanf("%s",field[i]); getchar();} for(i=0;i<n;i++) fo...
You are given a description of a depot. It is a rectangular checkered field of n × m size. Each cell in a field can be empty (".") or it can be occupied by a wall ("*"). You have one bomb. If you lay the bomb at the cell (x, y), then after triggering it will wipe out all walls in the row x and all walls in the column y...
If it is impossible to wipe out all walls by placing and triggering exactly one bomb, then print "NO" in the first line (without quotes). Otherwise print "YES" (without quotes) in the first line and two integers in the second line — the coordinates of the cell at which the bomb should be laid. If there are multiple ans...
C
12a768b502ddb07798830c9728fba5c4
6f7467044262b031ace6acee7398acf9
GNU C
standard output
256 megabytes
train_002.jsonl
[ "implementation" ]
1468933500
["3 4\n.*..\n....\n.*..", "3 3\n..*\n.*.\n*..", "6 5\n..*..\n..*..\n*****\n..*..\n..*..\n..*.."]
null
PASSED
1,400
standard input
1 second
The first line contains two positive integers n and m (1 ≤ n, m ≤ 1000) — the number of rows and columns in the depot field. The next n lines contain m symbols "." and "*" each — the description of the field. j-th symbol in i-th of them stands for cell (i, j). If the symbol is equal to ".", then the corresponding cell...
["YES\n1 2", "NO", "YES\n3 3"]
#include<stdio.h> #define MAXN 1002 int cntx[MAXN],cnty[MAXN]; char vis[MAXN][MAXN]; int main() { int n,m,i,j,x,y,ans,num; char c; scanf("%d%d",&n,&m); i=j=0; num=0; while(i<n) { scanf("%c",&c); if(c=='.'||c=='*') { if(c=='*') { ...
You are given a description of a depot. It is a rectangular checkered field of n × m size. Each cell in a field can be empty (".") or it can be occupied by a wall ("*"). You have one bomb. If you lay the bomb at the cell (x, y), then after triggering it will wipe out all walls in the row x and all walls in the column y...
If it is impossible to wipe out all walls by placing and triggering exactly one bomb, then print "NO" in the first line (without quotes). Otherwise print "YES" (without quotes) in the first line and two integers in the second line — the coordinates of the cell at which the bomb should be laid. If there are multiple ans...
C
12a768b502ddb07798830c9728fba5c4
5cdc72e9d69876c068beb4bb5c113bf1
GNU C
standard output
256 megabytes
train_002.jsonl
[ "implementation" ]
1468933500
["3 4\n.*..\n....\n.*..", "3 3\n..*\n.*.\n*..", "6 5\n..*..\n..*..\n*****\n..*..\n..*..\n..*.."]
null
PASSED
1,400
standard input
1 second
The first line contains two positive integers n and m (1 ≤ n, m ≤ 1000) — the number of rows and columns in the depot field. The next n lines contain m symbols "." and "*" each — the description of the field. j-th symbol in i-th of them stands for cell (i, j). If the symbol is equal to ".", then the corresponding cell...
["YES\n1 2", "NO", "YES\n3 3"]
#include <stdio.h> char a[1010][1010]; int x[1010],y[1010]; int main() { int n,m,i,j,cnt=0;; scanf("%d %d",&n,&m); for(i=1; i<=n; i++) { for(j=1; j<=m; j++) { scanf(" %c",&a[i][j]); if(a[i][j] == '*') cnt++,x[i]++,y[j]++; } } for(...
You are given a description of a depot. It is a rectangular checkered field of n × m size. Each cell in a field can be empty (".") or it can be occupied by a wall ("*"). You have one bomb. If you lay the bomb at the cell (x, y), then after triggering it will wipe out all walls in the row x and all walls in the column y...
If it is impossible to wipe out all walls by placing and triggering exactly one bomb, then print "NO" in the first line (without quotes). Otherwise print "YES" (without quotes) in the first line and two integers in the second line — the coordinates of the cell at which the bomb should be laid. If there are multiple ans...
C
12a768b502ddb07798830c9728fba5c4
db50cf4159ffd5ec52105ccd7cb72d19
GNU C
standard output
256 megabytes
train_002.jsonl
[ "implementation" ]
1468933500
["3 4\n.*..\n....\n.*..", "3 3\n..*\n.*.\n*..", "6 5\n..*..\n..*..\n*****\n..*..\n..*..\n..*.."]
null
PASSED
1,400
standard input
1 second
The first line contains two positive integers n and m (1 ≤ n, m ≤ 1000) — the number of rows and columns in the depot field. The next n lines contain m symbols "." and "*" each — the description of the field. j-th symbol in i-th of them stands for cell (i, j). If the symbol is equal to ".", then the corresponding cell...
["YES\n1 2", "NO", "YES\n3 3"]
#include <stdio.h> char field[1000][1010]; int main(){ int i, j; int n, m; int bombsinrow; int bombsincol; int bombcol=-1; int bombrow=-1; int col; scanf("%d%d",&n,&m); for(i=0;i<n;i++){ scanf("%s",field[i]); } for(j=0;j<m;j++){ bombsincol=0; for(i=0;i<n;i++){ if(field[i][j] == '*'){ bomb...
You are given a description of a depot. It is a rectangular checkered field of n × m size. Each cell in a field can be empty (".") or it can be occupied by a wall ("*"). You have one bomb. If you lay the bomb at the cell (x, y), then after triggering it will wipe out all walls in the row x and all walls in the column y...
If it is impossible to wipe out all walls by placing and triggering exactly one bomb, then print "NO" in the first line (without quotes). Otherwise print "YES" (without quotes) in the first line and two integers in the second line — the coordinates of the cell at which the bomb should be laid. If there are multiple ans...
C
12a768b502ddb07798830c9728fba5c4
1c151af8522f60c4d0b96402e9bd77ac
GNU C
standard output
256 megabytes
train_002.jsonl
[ "implementation" ]
1468933500
["3 4\n.*..\n....\n.*..", "3 3\n..*\n.*.\n*..", "6 5\n..*..\n..*..\n*****\n..*..\n..*..\n..*.."]
null
PASSED
1,400
standard input
1 second
The first line contains two positive integers n and m (1 ≤ n, m ≤ 1000) — the number of rows and columns in the depot field. The next n lines contain m symbols "." and "*" each — the description of the field. j-th symbol in i-th of them stands for cell (i, j). If the symbol is equal to ".", then the corresponding cell...
["YES\n1 2", "NO", "YES\n3 3"]
#include <stdio.h> int a[1111], b[1111], n, m, c; char d[1111][1111]; int main() { scanf("%d%d", &n, &m); for (int i = 0; i < n; i++) {scanf("%s", d[i]);for (int j = 0; j < m; j++) if (d[i][j] == '*') a[i]++, b[j]++, c++;} for (int i = 0; i < n; i++) for (int j = 0; j < m; j++) if (a[i] + b[j] - (d[i][j] == '*'...
You are given a description of a depot. It is a rectangular checkered field of n × m size. Each cell in a field can be empty (".") or it can be occupied by a wall ("*"). You have one bomb. If you lay the bomb at the cell (x, y), then after triggering it will wipe out all walls in the row x and all walls in the column y...
If it is impossible to wipe out all walls by placing and triggering exactly one bomb, then print "NO" in the first line (without quotes). Otherwise print "YES" (without quotes) in the first line and two integers in the second line — the coordinates of the cell at which the bomb should be laid. If there are multiple ans...
C
12a768b502ddb07798830c9728fba5c4
f18e75386b0d0b8836d2988c7178dba1
GNU C
standard output
256 megabytes
train_002.jsonl
[ "implementation" ]
1468933500
["3 4\n.*..\n....\n.*..", "3 3\n..*\n.*.\n*..", "6 5\n..*..\n..*..\n*****\n..*..\n..*..\n..*.."]
null
PASSED
1,400
standard input
1 second
The first line contains two positive integers n and m (1 ≤ n, m ≤ 1000) — the number of rows and columns in the depot field. The next n lines contain m symbols "." and "*" each — the description of the field. j-th symbol in i-th of them stands for cell (i, j). If the symbol is equal to ".", then the corresponding cell...
["YES\n1 2", "NO", "YES\n3 3"]
#include <stdio.h> #include <stdlib.h> int main() { int n,m, i, j; scanf("%d %d", &n, &m); int maxCol = 0, maxRow = 0; long sum = 0, res = 0; char s[m+5]; int arrRow[n], arrCol[m]; char db[n][m]; for (i = 0; i < m; i++) arrCol[i] = 0; for (i = 0; i < n; i++){ arrRow[i] = 0; ...
You are given a description of a depot. It is a rectangular checkered field of n × m size. Each cell in a field can be empty (".") or it can be occupied by a wall ("*"). You have one bomb. If you lay the bomb at the cell (x, y), then after triggering it will wipe out all walls in the row x and all walls in the column y...
If it is impossible to wipe out all walls by placing and triggering exactly one bomb, then print "NO" in the first line (without quotes). Otherwise print "YES" (without quotes) in the first line and two integers in the second line — the coordinates of the cell at which the bomb should be laid. If there are multiple ans...
C
12a768b502ddb07798830c9728fba5c4
dbfa0a913c7e425772fd2de9ff863265
GNU C
standard output
256 megabytes
train_002.jsonl
[ "implementation" ]
1468933500
["3 4\n.*..\n....\n.*..", "3 3\n..*\n.*.\n*..", "6 5\n..*..\n..*..\n*****\n..*..\n..*..\n..*.."]
null
PASSED
1,400
standard input
1 second
The first line contains two positive integers n and m (1 ≤ n, m ≤ 1000) — the number of rows and columns in the depot field. The next n lines contain m symbols "." and "*" each — the description of the field. j-th symbol in i-th of them stands for cell (i, j). If the symbol is equal to ".", then the corresponding cell...
["YES\n1 2", "NO", "YES\n3 3"]
#include<stdio.h> int main() { int n , m , k , i , j , t = 0 ; scanf("%d%d",&n,&m); char s[n][m]; int row[1000] = {0} , col[1000] = {0}; for(i = 0 ; i<n ; i++) { scanf("%s",s[i]); for(j=0 ; j<m ; j++) { if(s[i][j]=='*')row[i]++,col[j]++,t++; } ...
You are given a description of a depot. It is a rectangular checkered field of n × m size. Each cell in a field can be empty (".") or it can be occupied by a wall ("*"). You have one bomb. If you lay the bomb at the cell (x, y), then after triggering it will wipe out all walls in the row x and all walls in the column y...
If it is impossible to wipe out all walls by placing and triggering exactly one bomb, then print "NO" in the first line (without quotes). Otherwise print "YES" (without quotes) in the first line and two integers in the second line — the coordinates of the cell at which the bomb should be laid. If there are multiple ans...
C
12a768b502ddb07798830c9728fba5c4
eef7bd642ad51ef868999ba8cfe63f1c
GNU C
standard output
256 megabytes
train_002.jsonl
[ "implementation" ]
1468933500
["3 4\n.*..\n....\n.*..", "3 3\n..*\n.*.\n*..", "6 5\n..*..\n..*..\n*****\n..*..\n..*..\n..*.."]
null
PASSED
1,400
standard input
1 second
The first line contains two positive integers n and m (1 ≤ n, m ≤ 1000) — the number of rows and columns in the depot field. The next n lines contain m symbols "." and "*" each — the description of the field. j-th symbol in i-th of them stands for cell (i, j). If the symbol is equal to ".", then the corresponding cell...
["YES\n1 2", "NO", "YES\n3 3"]
#include <stdio.h> #include <string.h> #include <stdbool.h> #define MAX 1000010 #define clr(ar) memset(ar, 0, sizeof(ar)) #define read() freopen("lol.txt", "r", stdin) char str[1010][1010]; int n, m, row[1010], col[1010]; int main(){ int i, j, k, x, flag, counter; while (scanf("%d %d", &n, &m) != EOF){ ...
You are given a description of a depot. It is a rectangular checkered field of n × m size. Each cell in a field can be empty (".") or it can be occupied by a wall ("*"). You have one bomb. If you lay the bomb at the cell (x, y), then after triggering it will wipe out all walls in the row x and all walls in the column y...
If it is impossible to wipe out all walls by placing and triggering exactly one bomb, then print "NO" in the first line (without quotes). Otherwise print "YES" (without quotes) in the first line and two integers in the second line — the coordinates of the cell at which the bomb should be laid. If there are multiple ans...
C
12a768b502ddb07798830c9728fba5c4
db95bbb58ef3cfea61a15c2a7e1a33db
GNU C
standard output
256 megabytes
train_002.jsonl
[ "implementation" ]
1468933500
["3 4\n.*..\n....\n.*..", "3 3\n..*\n.*.\n*..", "6 5\n..*..\n..*..\n*****\n..*..\n..*..\n..*.."]
null
PASSED
1,400
standard input
1 second
The first line contains two positive integers n and m (1 ≤ n, m ≤ 1000) — the number of rows and columns in the depot field. The next n lines contain m symbols "." and "*" each — the description of the field. j-th symbol in i-th of them stands for cell (i, j). If the symbol is equal to ".", then the corresponding cell...
["YES\n1 2", "NO", "YES\n3 3"]
#include <stdio.h> #include <stdlib.h> #include <math.h> #define sc1(a) scanf("%d",&a) #define scs(a) scanf("%s",a) #define sc2(a,b) scanf("%d%d",&a,&b) #define sc3(a,b,c) scanf("%d%d%d",&a,&b,&c) #define impossible -1 #define undefined 0 void check_if_holds(int* py,int* px,int cy,int cx){ if(*py==impossible||*px==...
You are given a description of a depot. It is a rectangular checkered field of n × m size. Each cell in a field can be empty (".") or it can be occupied by a wall ("*"). You have one bomb. If you lay the bomb at the cell (x, y), then after triggering it will wipe out all walls in the row x and all walls in the column y...
If it is impossible to wipe out all walls by placing and triggering exactly one bomb, then print "NO" in the first line (without quotes). Otherwise print "YES" (without quotes) in the first line and two integers in the second line — the coordinates of the cell at which the bomb should be laid. If there are multiple ans...
C
12a768b502ddb07798830c9728fba5c4
0968da8f71af8e804ab434a4c9498f4b
GNU C
standard output
256 megabytes
train_002.jsonl
[ "implementation" ]
1468933500
["3 4\n.*..\n....\n.*..", "3 3\n..*\n.*.\n*..", "6 5\n..*..\n..*..\n*****\n..*..\n..*..\n..*.."]
null
PASSED
1,400
standard input
1 second
The first line contains two positive integers n and m (1 ≤ n, m ≤ 1000) — the number of rows and columns in the depot field. The next n lines contain m symbols "." and "*" each — the description of the field. j-th symbol in i-th of them stands for cell (i, j). If the symbol is equal to ".", then the corresponding cell...
["YES\n1 2", "NO", "YES\n3 3"]
#include <stdio.h> int main(void) { // your code goes here int n,m; scanf("%d %d",&n,&m); char inp[m]; int arr[n][m],i,row[n],col[m],j,c=0,t; for(i=0;i<n;i++)row[i]=0; for(i=0;i<m;i++)col[i]=0; for(i=0;i<n;i++) { scanf("%s",inp); for(j=0;j<m;j++) { if(inp[j]=='*') { ...
You are given a description of a depot. It is a rectangular checkered field of n × m size. Each cell in a field can be empty (".") or it can be occupied by a wall ("*"). You have one bomb. If you lay the bomb at the cell (x, y), then after triggering it will wipe out all walls in the row x and all walls in the column y...
If it is impossible to wipe out all walls by placing and triggering exactly one bomb, then print "NO" in the first line (without quotes). Otherwise print "YES" (without quotes) in the first line and two integers in the second line — the coordinates of the cell at which the bomb should be laid. If there are multiple ans...
C
12a768b502ddb07798830c9728fba5c4
2757c4b0c2685ded89edf7059f8f31fe
GNU C
standard output
256 megabytes
train_002.jsonl
[ "implementation" ]
1468933500
["3 4\n.*..\n....\n.*..", "3 3\n..*\n.*.\n*..", "6 5\n..*..\n..*..\n*****\n..*..\n..*..\n..*.."]
null
PASSED
1,400
standard input
1 second
The first line contains two positive integers n and m (1 ≤ n, m ≤ 1000) — the number of rows and columns in the depot field. The next n lines contain m symbols "." and "*" each — the description of the field. j-th symbol in i-th of them stands for cell (i, j). If the symbol is equal to ".", then the corresponding cell...
["YES\n1 2", "NO", "YES\n3 3"]
#include <stdio.h> int main(void) { // your code goes here int i,j,n,m; scanf("%d %d",&n,&m); char inp[m]; int r[n],c[m],arr[n][m],count=0; for(i=0;i<n;i++)r[i]=0; for(i=0;i<m;i++)c[i]=0; for(i=0;i<n;i++) { scanf("%s",inp); for(j=0;j<m;j++) { if(inp[j]=='*') { r[i...
You are given a description of a depot. It is a rectangular checkered field of n × m size. Each cell in a field can be empty (".") or it can be occupied by a wall ("*"). You have one bomb. If you lay the bomb at the cell (x, y), then after triggering it will wipe out all walls in the row x and all walls in the column y...
If it is impossible to wipe out all walls by placing and triggering exactly one bomb, then print "NO" in the first line (without quotes). Otherwise print "YES" (without quotes) in the first line and two integers in the second line — the coordinates of the cell at which the bomb should be laid. If there are multiple ans...
C
12a768b502ddb07798830c9728fba5c4
cad7289235fe1ad2949c11aefb81218f
GNU C
standard output
256 megabytes
train_002.jsonl
[ "implementation" ]
1468933500
["3 4\n.*..\n....\n.*..", "3 3\n..*\n.*.\n*..", "6 5\n..*..\n..*..\n*****\n..*..\n..*..\n..*.."]
null
PASSED
1,400
standard input
1 second
The first line contains two positive integers n and m (1 ≤ n, m ≤ 1000) — the number of rows and columns in the depot field. The next n lines contain m symbols "." and "*" each — the description of the field. j-th symbol in i-th of them stands for cell (i, j). If the symbol is equal to ".", then the corresponding cell...
["YES\n1 2", "NO", "YES\n3 3"]
#include<stdio.h> #include<stdlib.h> #include<string.h> #include<math.h> int main() { int n,m,i,j,k;long count=0,a,b; scanf("%d%d",&n,&m); char field[n][m],p,q;int row[n*m],col[n*m]; for(i=0;i<n;i++) { for(j=0;j<m;j++) { scanf(" %c",&field[i][j]); if(field[i][j]=='*') { row[count]=i; col[count]=j; ...
Boy Valera likes strings. And even more he likes them, when they are identical. That's why in his spare time Valera plays the following game. He takes any two strings, consisting of lower case Latin letters, and tries to make them identical. According to the game rules, with each move Valera can change one arbitrary ch...
If the answer exists, output the answer to the problem, and the resulting string. Otherwise output -1 in the only line. If the answer is not unique, output any.
C
88c82ada2e66429900caeac758f7083b
fa879bd3062b0bba37dcd60b4ca122d9
GNU C
standard output
256 megabytes
train_002.jsonl
[ "shortest paths" ]
1286463600
["uayd\nuxxd\n3\na x 8\nx y 13\nd c 3", "a\nb\n3\na b 2\na b 3\nb a 5", "abc\nab\n6\na b 4\na b 7\nb a 8\nc b 11\nc a 3\na c 0"]
null
PASSED
1,800
standard input
2 seconds
The first input line contains two initial non-empty strings s and t, consisting of lower case Latin letters. The length of each string doesn't exceed 105. The following line contains integer n (0 ≤ n ≤ 500) — amount of possible changings. Then follow n lines, each containing characters Ai and Bi (lower case Latin lette...
["21\nuxyd", "2\nb", "-1"]
#include <stdio.h> #include <string.h> #define oo 1000000000 #define min(a,b) ((a)<(b)?(a):(b)) char str1[200005]={'\0'}; char str2[200005]={'\0'}; char ans[200005]={'\0'}; long to[505][505]={0}; long get[505][505]={0}; char trans[505][505]={0}; int main() { long l,i; long n; char ch; char ch2; char ch3; long...
Boy Valera likes strings. And even more he likes them, when they are identical. That's why in his spare time Valera plays the following game. He takes any two strings, consisting of lower case Latin letters, and tries to make them identical. According to the game rules, with each move Valera can change one arbitrary ch...
If the answer exists, output the answer to the problem, and the resulting string. Otherwise output -1 in the only line. If the answer is not unique, output any.
C
88c82ada2e66429900caeac758f7083b
eec146967e41576734fa8449bd9a5082
GNU C
standard output
256 megabytes
train_002.jsonl
[ "shortest paths" ]
1286463600
["uayd\nuxxd\n3\na x 8\nx y 13\nd c 3", "a\nb\n3\na b 2\na b 3\nb a 5", "abc\nab\n6\na b 4\na b 7\nb a 8\nc b 11\nc a 3\na c 0"]
null
PASSED
1,800
standard input
2 seconds
The first input line contains two initial non-empty strings s and t, consisting of lower case Latin letters. The length of each string doesn't exceed 105. The following line contains integer n (0 ≤ n ≤ 500) — amount of possible changings. Then follow n lines, each containing characters Ai and Bi (lower case Latin lette...
["21\nuxyd", "2\nb", "-1"]
#include <stdio.h> #include <string.h> #define _CRT_SECURE_NO_WARNINGS #define N_MAX 100001 #define ALP_S 26 #define INF (int) 1e9 #define min(a,b) (a < b ? a : b) int d[ALP_S][ALP_S]; char s[N_MAX]; char t[N_MAX]; char ans[N_MAX]; void init() { int i, j; for (i = 0; i < ALP_S; ++i) { for (j = 0; j < ALP_S; ++j) ...
Boy Valera likes strings. And even more he likes them, when they are identical. That's why in his spare time Valera plays the following game. He takes any two strings, consisting of lower case Latin letters, and tries to make them identical. According to the game rules, with each move Valera can change one arbitrary ch...
If the answer exists, output the answer to the problem, and the resulting string. Otherwise output -1 in the only line. If the answer is not unique, output any.
C
88c82ada2e66429900caeac758f7083b
2d5c5840fc8f8a6614344bdfcbb4415b
GNU C
standard output
256 megabytes
train_002.jsonl
[ "shortest paths" ]
1286463600
["uayd\nuxxd\n3\na x 8\nx y 13\nd c 3", "a\nb\n3\na b 2\na b 3\nb a 5", "abc\nab\n6\na b 4\na b 7\nb a 8\nc b 11\nc a 3\na c 0"]
null
PASSED
1,800
standard input
2 seconds
The first input line contains two initial non-empty strings s and t, consisting of lower case Latin letters. The length of each string doesn't exceed 105. The following line contains integer n (0 ≤ n ≤ 500) — amount of possible changings. Then follow n lines, each containing characters Ai and Bi (lower case Latin lette...
["21\nuxyd", "2\nb", "-1"]
#include<stdio.h> #include<stdlib.h> #include<math.h> #define REP(i,a,b) for(i=a;i<b;i++) #define rep(i,n) REP(i,0,n) #define ll long long #define INF 1000000000000000LL int main(){ int i,j,k,l,m,n; ll cnv[300][300]; ll res=0, tmp, g; char a[110000], b[110000], c[110000]; char tmp1[10], tmp2[10]; int len;...
Boy Valera likes strings. And even more he likes them, when they are identical. That's why in his spare time Valera plays the following game. He takes any two strings, consisting of lower case Latin letters, and tries to make them identical. According to the game rules, with each move Valera can change one arbitrary ch...
If the answer exists, output the answer to the problem, and the resulting string. Otherwise output -1 in the only line. If the answer is not unique, output any.
C
88c82ada2e66429900caeac758f7083b
d69138536d4404bc3ddc8f1c22ec9a0d
GNU C
standard output
256 megabytes
train_002.jsonl
[ "shortest paths" ]
1286463600
["uayd\nuxxd\n3\na x 8\nx y 13\nd c 3", "a\nb\n3\na b 2\na b 3\nb a 5", "abc\nab\n6\na b 4\na b 7\nb a 8\nc b 11\nc a 3\na c 0"]
null
PASSED
1,800
standard input
2 seconds
The first input line contains two initial non-empty strings s and t, consisting of lower case Latin letters. The length of each string doesn't exceed 105. The following line contains integer n (0 ≤ n ≤ 500) — amount of possible changings. Then follow n lines, each containing characters Ai and Bi (lower case Latin lette...
["21\nuxyd", "2\nb", "-1"]
#include<stdio.h> #include<string.h> #define N 100010 #define M 30 #define INF 9999 #define min(a,b) ((a)>(b)?(b):(a)) int dp[M][M],rec[M][M],res[M][M],vis[M][M]; char s[N],t[N]; int find(int i,int j) { if(vis[i][j]) return res[i][j]; int k,ans=res[i][j]; vis[i][j]=vis[j][i]=1; for(k=0; k<26;...
Boy Valera likes strings. And even more he likes them, when they are identical. That's why in his spare time Valera plays the following game. He takes any two strings, consisting of lower case Latin letters, and tries to make them identical. According to the game rules, with each move Valera can change one arbitrary ch...
If the answer exists, output the answer to the problem, and the resulting string. Otherwise output -1 in the only line. If the answer is not unique, output any.
C
88c82ada2e66429900caeac758f7083b
eb7fed5a07731731a3d8e91585e3e5b0
GNU C
standard output
256 megabytes
train_002.jsonl
[ "shortest paths" ]
1286463600
["uayd\nuxxd\n3\na x 8\nx y 13\nd c 3", "a\nb\n3\na b 2\na b 3\nb a 5", "abc\nab\n6\na b 4\na b 7\nb a 8\nc b 11\nc a 3\na c 0"]
null
PASSED
1,800
standard input
2 seconds
The first input line contains two initial non-empty strings s and t, consisting of lower case Latin letters. The length of each string doesn't exceed 105. The following line contains integer n (0 ≤ n ≤ 500) — amount of possible changings. Then follow n lines, each containing characters Ai and Bi (lower case Latin lette...
["21\nuxyd", "2\nb", "-1"]
#include<stdio.h> #include<string.h> #define N 100010 #define M 30 #define INF 9999 #define min(a,b) ((a)>(b)?(b):(a)) int dp[M][M],rec[M][M],res[M][M],vis[M][M],tag[M][M]; char s[N],t[N]; int f(int i,int j) { if(tag[i][j]) return dp[i][j]; int ans=dp[i][j]; int k; tag[i][j]=1; for(k=0; k<...
Boy Valera likes strings. And even more he likes them, when they are identical. That's why in his spare time Valera plays the following game. He takes any two strings, consisting of lower case Latin letters, and tries to make them identical. According to the game rules, with each move Valera can change one arbitrary ch...
If the answer exists, output the answer to the problem, and the resulting string. Otherwise output -1 in the only line. If the answer is not unique, output any.
C
88c82ada2e66429900caeac758f7083b
b118d10f7631a2fb6f87113bfb77a480
GNU C
standard output
256 megabytes
train_002.jsonl
[ "shortest paths" ]
1286463600
["uayd\nuxxd\n3\na x 8\nx y 13\nd c 3", "a\nb\n3\na b 2\na b 3\nb a 5", "abc\nab\n6\na b 4\na b 7\nb a 8\nc b 11\nc a 3\na c 0"]
null
PASSED
1,800
standard input
2 seconds
The first input line contains two initial non-empty strings s and t, consisting of lower case Latin letters. The length of each string doesn't exceed 105. The following line contains integer n (0 ≤ n ≤ 500) — amount of possible changings. Then follow n lines, each containing characters Ai and Bi (lower case Latin lette...
["21\nuxyd", "2\nb", "-1"]
#include <stdio.h> #include <string.h> long f[64][64] = { 0 }; char str1[100001]; char str2[100001]; char str3[100001] = { 0 }; char c1[100]; char c2[100]; #define MAX 100000000 long min(long x, long y) { return x > y ? y : x; } int main() { scanf("%s%s", str1, str2); int n, i, j, k; long cost, totalcost = 0; ...
Boy Valera likes strings. And even more he likes them, when they are identical. That's why in his spare time Valera plays the following game. He takes any two strings, consisting of lower case Latin letters, and tries to make them identical. According to the game rules, with each move Valera can change one arbitrary ch...
If the answer exists, output the answer to the problem, and the resulting string. Otherwise output -1 in the only line. If the answer is not unique, output any.
C
88c82ada2e66429900caeac758f7083b
2860fe096f1299ef88c5768951af0abf
GNU C
standard output
256 megabytes
train_002.jsonl
[ "shortest paths" ]
1286463600
["uayd\nuxxd\n3\na x 8\nx y 13\nd c 3", "a\nb\n3\na b 2\na b 3\nb a 5", "abc\nab\n6\na b 4\na b 7\nb a 8\nc b 11\nc a 3\na c 0"]
null
PASSED
1,800
standard input
2 seconds
The first input line contains two initial non-empty strings s and t, consisting of lower case Latin letters. The length of each string doesn't exceed 105. The following line contains integer n (0 ≤ n ≤ 500) — amount of possible changings. Then follow n lines, each containing characters Ai and Bi (lower case Latin lette...
["21\nuxyd", "2\nb", "-1"]
#include <stdio.h> #include <math.h> #include <time.h> #include <string.h> #include <stdlib.h> #define oo 100000000 #define pi 3.14159265359 #define zero(a) (abb(a)<=1e-7) #define lowbit(a) ((a)&(-(a))) #define min(a,b) ((a)<(b)?(a):(b)) #define max(a,b) ((a)>(b)?(a):(b)) #define abb(a) ((a)>0?(a):(-(a))) #define cj(x1...
Boy Valera likes strings. And even more he likes them, when they are identical. That's why in his spare time Valera plays the following game. He takes any two strings, consisting of lower case Latin letters, and tries to make them identical. According to the game rules, with each move Valera can change one arbitrary ch...
If the answer exists, output the answer to the problem, and the resulting string. Otherwise output -1 in the only line. If the answer is not unique, output any.
C
88c82ada2e66429900caeac758f7083b
58100d2affd4eca3619f8a9481db243f
GNU C
standard output
256 megabytes
train_002.jsonl
[ "shortest paths" ]
1286463600
["uayd\nuxxd\n3\na x 8\nx y 13\nd c 3", "a\nb\n3\na b 2\na b 3\nb a 5", "abc\nab\n6\na b 4\na b 7\nb a 8\nc b 11\nc a 3\na c 0"]
null
PASSED
1,800
standard input
2 seconds
The first input line contains two initial non-empty strings s and t, consisting of lower case Latin letters. The length of each string doesn't exceed 105. The following line contains integer n (0 ≤ n ≤ 500) — amount of possible changings. Then follow n lines, each containing characters Ai and Bi (lower case Latin lette...
["21\nuxyd", "2\nb", "-1"]
#include <stdio.h> #include <string.h> #define MAX 100000000 int mx[26][26]; int min(int a, int b) { return (a < b) ? a : b; } int main() { char string1[100001], string2[100001]; int i, j, z, m; scanf("%s %s\n%d\n", string1, string2, &m); char ch1, ch2; int val; for(i = 0; i < 26; i++) { for(j = 0...
As a German University in Cairo (GUC) student and a basketball player, Herr Wafa was delighted once he heard the news. GUC is finally participating in the Annual Basketball Competition (ABC). A team is to be formed of n players, all of which are GUC students. However, the team might have players belonging to different ...
Print the probability that Herr Wafa will have at least one teammate from his department. If there is not enough basketball players in GUC to participate in ABC, print -1. The answer will be accepted if it has absolute or relative error not exceeding 10 - 6.
C
ffafd385ec79aa28b8d30224baf6bcfe
a43084b1a89a13606eb8d8b388827aa2
GNU C
standard output
256 megabytes
train_002.jsonl
[ "dp", "combinatorics", "probabilities", "math" ]
1314111600
["3 2 1\n2 1", "3 2 1\n1 1", "3 2 1\n2 2"]
NoteIn the first example all 3 players (2 from department 1 and 1 from department 2) must be chosen for the team. Both players from Wafa's departments will be chosen, so he's guaranteed to have a teammate from his department.In the second example, there are not enough players.In the third example, there are three possi...
PASSED
1,600
standard input
1 second
The first line contains three integers n, m and h (1 ≤ n ≤ 100, 1 ≤ m ≤ 1000, 1 ≤ h ≤ m) — the number of players on the team, the number of departments in GUC and Herr Wafa's department, correspondingly. The second line contains a single-space-separated list of m integers si (1 ≤ si ≤ 100), denoting the number of stud...
["1", "-1", "0.666667"]
#include <stdio.h> int main() { int n,m,h; int s[1000]; int i,a = 0,b = 0; double pro,c = 1,d = 1,e; scanf("%d%d%d",&n,&m,&h); for(i = 0;i < m;i++) { scanf("%d",&s[i]); a = a + s[i]; if(i + 1 != h) b= b + s[i]; } if(a < n) printf("-1.0\n"); else { if(b + 1 < n) printf("1.0\n"); else ...
As a German University in Cairo (GUC) student and a basketball player, Herr Wafa was delighted once he heard the news. GUC is finally participating in the Annual Basketball Competition (ABC). A team is to be formed of n players, all of which are GUC students. However, the team might have players belonging to different ...
Print the probability that Herr Wafa will have at least one teammate from his department. If there is not enough basketball players in GUC to participate in ABC, print -1. The answer will be accepted if it has absolute or relative error not exceeding 10 - 6.
C
ffafd385ec79aa28b8d30224baf6bcfe
8b466fef9a7db1bf064dc54de8f98a41
GNU C
standard output
256 megabytes
train_002.jsonl
[ "dp", "combinatorics", "probabilities", "math" ]
1314111600
["3 2 1\n2 1", "3 2 1\n1 1", "3 2 1\n2 2"]
NoteIn the first example all 3 players (2 from department 1 and 1 from department 2) must be chosen for the team. Both players from Wafa's departments will be chosen, so he's guaranteed to have a teammate from his department.In the second example, there are not enough players.In the third example, there are three possi...
PASSED
1,600
standard input
1 second
The first line contains three integers n, m and h (1 ≤ n ≤ 100, 1 ≤ m ≤ 1000, 1 ≤ h ≤ m) — the number of players on the team, the number of departments in GUC and Herr Wafa's department, correspondingly. The second line contains a single-space-separated list of m integers si (1 ≤ si ≤ 100), denoting the number of stud...
["1", "-1", "0.666667"]
#include <stdio.h> int main() { int n, m, h, sum = 0, i; int s[1000]; double d = 1; scanf("%d %d %d", &n, &m, &h); for (i = 0; i < m; i++) { scanf("%d", &s[i]); sum += s[i]; } if (sum < n) { puts("-1.0\n"); return 0; } if (sum - s[h - 1] < n - 1) { puts...
As a German University in Cairo (GUC) student and a basketball player, Herr Wafa was delighted once he heard the news. GUC is finally participating in the Annual Basketball Competition (ABC). A team is to be formed of n players, all of which are GUC students. However, the team might have players belonging to different ...
Print the probability that Herr Wafa will have at least one teammate from his department. If there is not enough basketball players in GUC to participate in ABC, print -1. The answer will be accepted if it has absolute or relative error not exceeding 10 - 6.
C
ffafd385ec79aa28b8d30224baf6bcfe
9d8978a4922bf67532fab3880ca11a7c
GNU C
standard output
256 megabytes
train_002.jsonl
[ "dp", "combinatorics", "probabilities", "math" ]
1314111600
["3 2 1\n2 1", "3 2 1\n1 1", "3 2 1\n2 2"]
NoteIn the first example all 3 players (2 from department 1 and 1 from department 2) must be chosen for the team. Both players from Wafa's departments will be chosen, so he's guaranteed to have a teammate from his department.In the second example, there are not enough players.In the third example, there are three possi...
PASSED
1,600
standard input
1 second
The first line contains three integers n, m and h (1 ≤ n ≤ 100, 1 ≤ m ≤ 1000, 1 ≤ h ≤ m) — the number of players on the team, the number of departments in GUC and Herr Wafa's department, correspondingly. The second line contains a single-space-separated list of m integers si (1 ≤ si ≤ 100), denoting the number of stud...
["1", "-1", "0.666667"]
#include <stdio.h> int main() { int n, m, h, i; int s[1000]; int sum = 0; double ans = 1; scanf("%d %d %d", &n, &m, &h); for (i = 0; i < m; i++) { scanf(" %d", s+i); sum += s[i]; } if (sum < n) { puts("-1"); return 0; } for (i = sum - 1; i > sum - s[h-1]; i--) ans *= (double)(i - n + 1...
A line on the plane is described by an equation Ax + By + C = 0. You are to find any point on this line, whose coordinates are integer numbers from  - 5·1018 to 5·1018 inclusive, or to find out that such points do not exist.
If the required point exists, output its coordinates, otherwise output -1.
C
a01e1c545542c1641eca556439f0692e
0623da09a665b13fe2f041aaf8a119f9
GNU C11
standard output
256 megabytes
train_002.jsonl
[ "number theory", "math" ]
1270136700
["2 5 3"]
null
PASSED
1,800
standard input
1 second
The first line contains three integers A, B and C ( - 2·109 ≤ A, B, C ≤ 2·109) — corresponding coefficients of the line equation. It is guaranteed that A2 + B2 &gt; 0.
["6 -3"]
#include <stdbool.h> #include "stdio.h" #include "stdint.h" #include "string.h" #include "stdlib.h" #define ll long long #define max(a,b) ((a)>(b)?(a):(b)) #define min(a,b) ((a)<(b)?(a):(b)) #define N 100000 // Ax + By + C = 0. ll gcd(ll a, ll b, ll* x, ll* y) { if (!b) { *x = 1; *y = 0; return a...
A line on the plane is described by an equation Ax + By + C = 0. You are to find any point on this line, whose coordinates are integer numbers from  - 5·1018 to 5·1018 inclusive, or to find out that such points do not exist.
If the required point exists, output its coordinates, otherwise output -1.
C
a01e1c545542c1641eca556439f0692e
dc738d4d001414a19512f26889796794
GNU C11
standard output
256 megabytes
train_002.jsonl
[ "number theory", "math" ]
1270136700
["2 5 3"]
null
PASSED
1,800
standard input
1 second
The first line contains three integers A, B and C ( - 2·109 ≤ A, B, C ≤ 2·109) — corresponding coefficients of the line equation. It is guaranteed that A2 + B2 &gt; 0.
["6 -3"]
int main() { long long x[2]={0,-1}; long long y[2]={-1,0}; int a,b,c,q,r,p=0; scanf("%d %d %d\n",&a,&b,&c); while (b) { p=!p; r=a%b; q=(a-r)/b; x[p]-=q*x[!p]; y[p]-=q*y[!p]; a=b; b=r; } if (c%a) printf("-1\n"); else printf("%lli %lli\n",x[!p]*c/a,y[!p]*c/a); return 0; }
A company has n employees numbered from 1 to n. Each employee either has no immediate manager or exactly one immediate manager, who is another employee with a different number. An employee A is said to be the superior of another employee B if at least one of the following is true: Employee A is the immediate manager o...
Print a single integer denoting the minimum number of groups that will be formed in the party.
C
8d911f79dde31f2c6f62e73b925e6996
e45d0e57377a01065e55b1a22c2506d5
GNU C
standard output
256 megabytes
train_002.jsonl
[ "dfs and similar", "trees", "graphs" ]
1316098800
["5\n-1\n1\n2\n1\n-1"]
NoteFor the first example, three groups are sufficient, for example: Employee 1 Employees 2 and 4 Employees 3 and 5
PASSED
900
standard input
3 seconds
The first line contains integer n (1 ≤ n ≤ 2000) — the number of employees. The next n lines contain the integers pi (1 ≤ pi ≤ n or pi = -1). Every pi denotes the immediate manager for the i-th employee. If pi is -1, that means that the i-th employee does not have an immediate manager. It is guaranteed, that no employ...
["3"]
#include <stdio.h> #include<stdlib.h> #include<string.h> int nagasa(int hito[2000],int a){ if(hito[a]==-1)return 1; else return nagasa(hito,hito[a]-1)+1; } int main(void) { int n; int hito[2000]; int i,j,tmp;; int longest=1; scanf("%d",&n); for(i=0;i<n;i++){ scanf(" %d",&hito[i]); } for(i=0;i<n;i++){ ...
A company has n employees numbered from 1 to n. Each employee either has no immediate manager or exactly one immediate manager, who is another employee with a different number. An employee A is said to be the superior of another employee B if at least one of the following is true: Employee A is the immediate manager o...
Print a single integer denoting the minimum number of groups that will be formed in the party.
C
8d911f79dde31f2c6f62e73b925e6996
e02cd9c6011da7e297152c2335f092d4
GNU C
standard output
256 megabytes
train_002.jsonl
[ "dfs and similar", "trees", "graphs" ]
1316098800
["5\n-1\n1\n2\n1\n-1"]
NoteFor the first example, three groups are sufficient, for example: Employee 1 Employees 2 and 4 Employees 3 and 5
PASSED
900
standard input
3 seconds
The first line contains integer n (1 ≤ n ≤ 2000) — the number of employees. The next n lines contain the integers pi (1 ≤ pi ≤ n or pi = -1). Every pi denotes the immediate manager for the i-th employee. If pi is -1, that means that the i-th employee does not have an immediate manager. It is guaranteed, that no employ...
["3"]
#include<stdio.h> int bs[2000]; int n; int dfs(int); int dfs(int boss) { int i,height=0; for (i=0;i<n;i++) { if (boss==bs[i]) { int new_height=dfs(i+1)+1; height=height<new_height?new_height:height; } } return height; } int main() { int i; scanf("%d",&n); for (i=0;i<n;i++) scanf("%...
A company has n employees numbered from 1 to n. Each employee either has no immediate manager or exactly one immediate manager, who is another employee with a different number. An employee A is said to be the superior of another employee B if at least one of the following is true: Employee A is the immediate manager o...
Print a single integer denoting the minimum number of groups that will be formed in the party.
C
8d911f79dde31f2c6f62e73b925e6996
1cdc61d7becee6ab741e98b132f47661
GNU C
standard output
256 megabytes
train_002.jsonl
[ "dfs and similar", "trees", "graphs" ]
1316098800
["5\n-1\n1\n2\n1\n-1"]
NoteFor the first example, three groups are sufficient, for example: Employee 1 Employees 2 and 4 Employees 3 and 5
PASSED
900
standard input
3 seconds
The first line contains integer n (1 ≤ n ≤ 2000) — the number of employees. The next n lines contain the integers pi (1 ≤ pi ≤ n or pi = -1). Every pi denotes the immediate manager for the i-th employee. If pi is -1, that means that the i-th employee does not have an immediate manager. It is guaranteed, that no employ...
["3"]
#include <stdio.h> typedef struct tree { struct tree *lc,*rs,*p; } node; int main(void) { int n,i,max=0,t,p; scanf("%d",&n); node x[n],*curr; for(i=0;i<n;++i) x[i].lc=x[i].rs=x[i].p=NULL; for(i=0;i<n;++i) { scanf("%d",&p); if(p==-1){ x[i].p=NULL; continue; } x[i].p=&x[p-1]; if(x[p-1].lc==NULL) x[p-1...
A company has n employees numbered from 1 to n. Each employee either has no immediate manager or exactly one immediate manager, who is another employee with a different number. An employee A is said to be the superior of another employee B if at least one of the following is true: Employee A is the immediate manager o...
Print a single integer denoting the minimum number of groups that will be formed in the party.
C
8d911f79dde31f2c6f62e73b925e6996
614b287d31f1d1c6313cc4968e796f6f
GNU C
standard output
256 megabytes
train_002.jsonl
[ "dfs and similar", "trees", "graphs" ]
1316098800
["5\n-1\n1\n2\n1\n-1"]
NoteFor the first example, three groups are sufficient, for example: Employee 1 Employees 2 and 4 Employees 3 and 5
PASSED
900
standard input
3 seconds
The first line contains integer n (1 ≤ n ≤ 2000) — the number of employees. The next n lines contain the integers pi (1 ≤ pi ≤ n or pi = -1). Every pi denotes the immediate manager for the i-th employee. If pi is -1, that means that the i-th employee does not have an immediate manager. It is guaranteed, that no employ...
["3"]
#include<stdio.h> int emp[2000]; int searchsup(int n,int floor); int main(void){ int i,n,m=1,tmp; scanf("%d",&n); for(i=0;i<n;i++) scanf("%d",&emp[i]); for(i=0;i<n;i++) --emp[i]; for(i=0;i<n;i++){ tmp=searchsup(i,1); if(tmp>m) m=tmp; } printf("%d\n",m); return 0; } int searchsup(int n,in...
A company has n employees numbered from 1 to n. Each employee either has no immediate manager or exactly one immediate manager, who is another employee with a different number. An employee A is said to be the superior of another employee B if at least one of the following is true: Employee A is the immediate manager o...
Print a single integer denoting the minimum number of groups that will be formed in the party.
C
8d911f79dde31f2c6f62e73b925e6996
200113463f7f21b858ae73afaace1741
GNU C
standard output
256 megabytes
train_002.jsonl
[ "dfs and similar", "trees", "graphs" ]
1316098800
["5\n-1\n1\n2\n1\n-1"]
NoteFor the first example, three groups are sufficient, for example: Employee 1 Employees 2 and 4 Employees 3 and 5
PASSED
900
standard input
3 seconds
The first line contains integer n (1 ≤ n ≤ 2000) — the number of employees. The next n lines contain the integers pi (1 ≤ pi ≤ n or pi = -1). Every pi denotes the immediate manager for the i-th employee. If pi is -1, that means that the i-th employee does not have an immediate manager. It is guaranteed, that no employ...
["3"]
#include <stdio.h> #define MAX 2001 int emp[MAX]; int depth[MAX]; int main() { int n, i, p, c; int max = 0; scanf("%d", &n); for (i = 1; i <= n; ++i) { scanf("%d", emp+i); } for (i = 1; i <= n; ++i) { p = i; c = 0; while (p > 0) { if (depth[p] == 0) { p = emp[p]; c++; } else { break; ...
A company has n employees numbered from 1 to n. Each employee either has no immediate manager or exactly one immediate manager, who is another employee with a different number. An employee A is said to be the superior of another employee B if at least one of the following is true: Employee A is the immediate manager o...
Print a single integer denoting the minimum number of groups that will be formed in the party.
C
8d911f79dde31f2c6f62e73b925e6996
62973107ecf56c21619fa324efd8996b
GNU C
standard output
256 megabytes
train_002.jsonl
[ "dfs and similar", "trees", "graphs" ]
1316098800
["5\n-1\n1\n2\n1\n-1"]
NoteFor the first example, three groups are sufficient, for example: Employee 1 Employees 2 and 4 Employees 3 and 5
PASSED
900
standard input
3 seconds
The first line contains integer n (1 ≤ n ≤ 2000) — the number of employees. The next n lines contain the integers pi (1 ≤ pi ≤ n or pi = -1). Every pi denotes the immediate manager for the i-th employee. If pi is -1, that means that the i-th employee does not have an immediate manager. It is guaranteed, that no employ...
["3"]
#include <stdio.h> int a[2000]; int dfs(int x) { if (a[x] == -1) return 1; return dfs(a[x]) + 1; } int main() { int n, max = 0, i; scanf("%d", &n); for (i = 0; i < n; i++) a[i] = -1; for (i = 0; i < n; i++) { int p; scanf("%d", &p); if (p != -1) a[i] = p - 1; } ...
A company has n employees numbered from 1 to n. Each employee either has no immediate manager or exactly one immediate manager, who is another employee with a different number. An employee A is said to be the superior of another employee B if at least one of the following is true: Employee A is the immediate manager o...
Print a single integer denoting the minimum number of groups that will be formed in the party.
C
8d911f79dde31f2c6f62e73b925e6996
ce940f584ce91fccc10a6dd09a824ad2
GNU C
standard output
256 megabytes
train_002.jsonl
[ "dfs and similar", "trees", "graphs" ]
1316098800
["5\n-1\n1\n2\n1\n-1"]
NoteFor the first example, three groups are sufficient, for example: Employee 1 Employees 2 and 4 Employees 3 and 5
PASSED
900
standard input
3 seconds
The first line contains integer n (1 ≤ n ≤ 2000) — the number of employees. The next n lines contain the integers pi (1 ≤ pi ≤ n or pi = -1). Every pi denotes the immediate manager for the i-th employee. If pi is -1, that means that the i-th employee does not have an immediate manager. It is guaranteed, that no employ...
["3"]
#include <stdio.h> int p[2001], rank[2001]; int dfs(int n) { if (rank[n] == 0) rank[n] = 1 + (p[n] == -1 ? 0 : dfs(p[n])); return rank[n]; } int main() { int i, n, max; scanf("%d", &n); for (i = 1; i <= n; i++) scanf("%d", &p[i]); for (i = 1; i <= n; i++) dfs(i); max = 0; for (i = 1; i <= n; i++) if...
A company has n employees numbered from 1 to n. Each employee either has no immediate manager or exactly one immediate manager, who is another employee with a different number. An employee A is said to be the superior of another employee B if at least one of the following is true: Employee A is the immediate manager o...
Print a single integer denoting the minimum number of groups that will be formed in the party.
C
8d911f79dde31f2c6f62e73b925e6996
588b755934c0058ca8dfee5f5fb37a64
GNU C
standard output
256 megabytes
train_002.jsonl
[ "dfs and similar", "trees", "graphs" ]
1316098800
["5\n-1\n1\n2\n1\n-1"]
NoteFor the first example, three groups are sufficient, for example: Employee 1 Employees 2 and 4 Employees 3 and 5
PASSED
900
standard input
3 seconds
The first line contains integer n (1 ≤ n ≤ 2000) — the number of employees. The next n lines contain the integers pi (1 ≤ pi ≤ n or pi = -1). Every pi denotes the immediate manager for the i-th employee. If pi is -1, that means that the i-th employee does not have an immediate manager. It is guaranteed, that no employ...
["3"]
#include <stdio.h> int p[2001], rank[2001]; int dfs(int n) { rank[n] = 1 + (p[n] == -1 ? 0 : dfs(p[n])); return rank[n]; } int main() { int i, n, max; scanf("%d", &n); for (i = 1; i <= n; i++) scanf("%d", &p[i]); for (i = 1; i <= n; i++) dfs(i); max = 0; for (i = 1; i <= n; i++) if (max < rank[i]) ...
A company has n employees numbered from 1 to n. Each employee either has no immediate manager or exactly one immediate manager, who is another employee with a different number. An employee A is said to be the superior of another employee B if at least one of the following is true: Employee A is the immediate manager o...
Print a single integer denoting the minimum number of groups that will be formed in the party.
C
8d911f79dde31f2c6f62e73b925e6996
b5b396e6eb963ee16da8a2a440a6277b
GNU C
standard output
256 megabytes
train_002.jsonl
[ "dfs and similar", "trees", "graphs" ]
1316098800
["5\n-1\n1\n2\n1\n-1"]
NoteFor the first example, three groups are sufficient, for example: Employee 1 Employees 2 and 4 Employees 3 and 5
PASSED
900
standard input
3 seconds
The first line contains integer n (1 ≤ n ≤ 2000) — the number of employees. The next n lines contain the integers pi (1 ≤ pi ≤ n or pi = -1). Every pi denotes the immediate manager for the i-th employee. If pi is -1, that means that the i-th employee does not have an immediate manager. It is guaranteed, that no employ...
["3"]
#include <stdio.h> int p[2001], rank[2001]; int dfs(int n) { if (p[n] == -1) { rank[n] = 1; return 1; } else { rank[n] = dfs(p[n]) + 1; return rank[n]; } } int main() { int i, n, max; scanf("%d", &n); for (i = 1; i <= n; i++) scanf("%d", &p[i]); for (i = 1; i <= n; i++) dfs(i); max = 0; for (i ...
A company has n employees numbered from 1 to n. Each employee either has no immediate manager or exactly one immediate manager, who is another employee with a different number. An employee A is said to be the superior of another employee B if at least one of the following is true: Employee A is the immediate manager o...
Print a single integer denoting the minimum number of groups that will be formed in the party.
C
8d911f79dde31f2c6f62e73b925e6996
cecb42e989c22a52d6a5abb568e9a5fc
GNU C
standard output
256 megabytes
train_002.jsonl
[ "dfs and similar", "trees", "graphs" ]
1316098800
["5\n-1\n1\n2\n1\n-1"]
NoteFor the first example, three groups are sufficient, for example: Employee 1 Employees 2 and 4 Employees 3 and 5
PASSED
900
standard input
3 seconds
The first line contains integer n (1 ≤ n ≤ 2000) — the number of employees. The next n lines contain the integers pi (1 ≤ pi ≤ n or pi = -1). Every pi denotes the immediate manager for the i-th employee. If pi is -1, that means that the i-th employee does not have an immediate manager. It is guaranteed, that no employ...
["3"]
#include <stdio.h> int *list,max=0; void procode_v1585(int s,int len){ if(list[s]+1)procode_v1585(list[s],len+1); else if(max<len)max=len; return; } int main(){ int i,j,k,m; scanf("%d",&m); list=malloc((m+1)*sizeof(int)); for(i=1;i<=m;i++){ scanf("%d",&lis...
A company has n employees numbered from 1 to n. Each employee either has no immediate manager or exactly one immediate manager, who is another employee with a different number. An employee A is said to be the superior of another employee B if at least one of the following is true: Employee A is the immediate manager o...
Print a single integer denoting the minimum number of groups that will be formed in the party.
C
8d911f79dde31f2c6f62e73b925e6996
2ec13caec2d51f90f77577482222b95a
GNU C
standard output
256 megabytes
train_002.jsonl
[ "dfs and similar", "trees", "graphs" ]
1316098800
["5\n-1\n1\n2\n1\n-1"]
NoteFor the first example, three groups are sufficient, for example: Employee 1 Employees 2 and 4 Employees 3 and 5
PASSED
900
standard input
3 seconds
The first line contains integer n (1 ≤ n ≤ 2000) — the number of employees. The next n lines contain the integers pi (1 ≤ pi ≤ n or pi = -1). Every pi denotes the immediate manager for the i-th employee. If pi is -1, that means that the i-th employee does not have an immediate manager. It is guaranteed, that no employ...
["3"]
#include<stdio.h> #include<stdlib.h> //#include<string.h> int *list,*sup; int n; void calc(int x,int y); int main(void){ int i,j,max=0; scanf("%d",&n); list=(int *)calloc(n,sizeof(int)); sup=(int *)calloc(n,sizeof(int)); for(i=0;i<n;i++){ scanf("%d",&list[i]); //printf("%d %d\n",list[i],i); if(...
A company has n employees numbered from 1 to n. Each employee either has no immediate manager or exactly one immediate manager, who is another employee with a different number. An employee A is said to be the superior of another employee B if at least one of the following is true: Employee A is the immediate manager o...
Print a single integer denoting the minimum number of groups that will be formed in the party.
C
8d911f79dde31f2c6f62e73b925e6996
a21186ca5818dcedb491d77e1bca586d
GNU C
standard output
256 megabytes
train_002.jsonl
[ "dfs and similar", "trees", "graphs" ]
1316098800
["5\n-1\n1\n2\n1\n-1"]
NoteFor the first example, three groups are sufficient, for example: Employee 1 Employees 2 and 4 Employees 3 and 5
PASSED
900
standard input
3 seconds
The first line contains integer n (1 ≤ n ≤ 2000) — the number of employees. The next n lines contain the integers pi (1 ≤ pi ≤ n or pi = -1). Every pi denotes the immediate manager for the i-th employee. If pi is -1, that means that the i-th employee does not have an immediate manager. It is guaranteed, that no employ...
["3"]
#include <stdio.h> #include <stdlib.h> int m[2001],n,ans; int dfs(x){ if(m[x]) return dfs(m[x])+1; return 0; } main(){ int i; scanf("%d",&n); for(i=1;i<=n;i++) scanf("%d",m+i); for(i=1;i<=n;i++) {ans<dfs(i)?ans=dfs(i):0; //printf("%d\n",ans); } printf("%d\n",ans); return 0; }
A company has n employees numbered from 1 to n. Each employee either has no immediate manager or exactly one immediate manager, who is another employee with a different number. An employee A is said to be the superior of another employee B if at least one of the following is true: Employee A is the immediate manager o...
Print a single integer denoting the minimum number of groups that will be formed in the party.
C
8d911f79dde31f2c6f62e73b925e6996
d1cb1bb2a7f707acbe8afde82a841e33
GNU C
standard output
256 megabytes
train_002.jsonl
[ "dfs and similar", "trees", "graphs" ]
1316098800
["5\n-1\n1\n2\n1\n-1"]
NoteFor the first example, three groups are sufficient, for example: Employee 1 Employees 2 and 4 Employees 3 and 5
PASSED
900
standard input
3 seconds
The first line contains integer n (1 ≤ n ≤ 2000) — the number of employees. The next n lines contain the integers pi (1 ≤ pi ≤ n or pi = -1). Every pi denotes the immediate manager for the i-th employee. If pi is -1, that means that the i-th employee does not have an immediate manager. It is guaranteed, that no employ...
["3"]
#include <stdio.h> #include <stdlib.h> #include <math.h> #include <string.h> #define max(a,b) a>=b?a:b #define min(a,b) a<b?a:b #define inf 1000000000 struct nod { int val,d,par,finish_time,weight; char color; struct nod *next,*par_node; }; void init(int num_v,struct nod *p[num_v],struct nod *vr[num_v]){ ...
A company has n employees numbered from 1 to n. Each employee either has no immediate manager or exactly one immediate manager, who is another employee with a different number. An employee A is said to be the superior of another employee B if at least one of the following is true: Employee A is the immediate manager o...
Print a single integer denoting the minimum number of groups that will be formed in the party.
C
8d911f79dde31f2c6f62e73b925e6996
d71f69c543bf0f1e45ad0d477dc1fa90
GNU C
standard output
256 megabytes
train_002.jsonl
[ "dfs and similar", "trees", "graphs" ]
1316098800
["5\n-1\n1\n2\n1\n-1"]
NoteFor the first example, three groups are sufficient, for example: Employee 1 Employees 2 and 4 Employees 3 and 5
PASSED
900
standard input
3 seconds
The first line contains integer n (1 ≤ n ≤ 2000) — the number of employees. The next n lines contain the integers pi (1 ≤ pi ≤ n or pi = -1). Every pi denotes the immediate manager for the i-th employee. If pi is -1, that means that the i-th employee does not have an immediate manager. It is guaranteed, that no employ...
["3"]
#include <stdio.h> #include <stdlib.h> #include <stdbool.h> #include <math.h> int emp[2005][2005], level[2005], S[2005], max = 1; void solve(int ind) { int i; for (i = 1; i <= emp[ind][0]; i++) { level[emp[ind][i]] = level[ind] + 1; //printf("%d=>%d %d\n", emp[ind][i], level[emp[ind][i]], emp[...
A company has n employees numbered from 1 to n. Each employee either has no immediate manager or exactly one immediate manager, who is another employee with a different number. An employee A is said to be the superior of another employee B if at least one of the following is true: Employee A is the immediate manager o...
Print a single integer denoting the minimum number of groups that will be formed in the party.
C
8d911f79dde31f2c6f62e73b925e6996
599b6b71d3e870359a21ac1e2d2a5f20
GNU C
standard output
256 megabytes
train_002.jsonl
[ "dfs and similar", "trees", "graphs" ]
1316098800
["5\n-1\n1\n2\n1\n-1"]
NoteFor the first example, three groups are sufficient, for example: Employee 1 Employees 2 and 4 Employees 3 and 5
PASSED
900
standard input
3 seconds
The first line contains integer n (1 ≤ n ≤ 2000) — the number of employees. The next n lines contain the integers pi (1 ≤ pi ≤ n or pi = -1). Every pi denotes the immediate manager for the i-th employee. If pi is -1, that means that the i-th employee does not have an immediate manager. It is guaranteed, that no employ...
["3"]
#include<stdio.h> #include<malloc.h> #define maxV 2000 #define ROOTS 0 struct node { int points_to; struct node *next; } *z, *adj[maxV + 1]; int V; void adjlist() { int i, mgr; struct node *t; z = (struct node *) malloc(sizeof *z); z->next = z; scanf("%d", &V); for(i = 0;i <= V;++i) adj[i] = z; for(i ...
A company has n employees numbered from 1 to n. Each employee either has no immediate manager or exactly one immediate manager, who is another employee with a different number. An employee A is said to be the superior of another employee B if at least one of the following is true: Employee A is the immediate manager o...
Print a single integer denoting the minimum number of groups that will be formed in the party.
C
8d911f79dde31f2c6f62e73b925e6996
908c48786b5cc698f5a13551be322454
GNU C
standard output
256 megabytes
train_002.jsonl
[ "dfs and similar", "trees", "graphs" ]
1316098800
["5\n-1\n1\n2\n1\n-1"]
NoteFor the first example, three groups are sufficient, for example: Employee 1 Employees 2 and 4 Employees 3 and 5
PASSED
900
standard input
3 seconds
The first line contains integer n (1 ≤ n ≤ 2000) — the number of employees. The next n lines contain the integers pi (1 ≤ pi ≤ n or pi = -1). Every pi denotes the immediate manager for the i-th employee. If pi is -1, that means that the i-th employee does not have an immediate manager. It is guaranteed, that no employ...
["3"]
#include <stdio.h> int main() { int i, j, k, m, n, a[2000]; scanf("%d", &n); for (i = 0; i < n; ++i) scanf("%d", a + i); m = 0; for (i = 0; i < n; ++i) { k = 0; j = i; while (a[j] != -1) ++k, j = a[j] - 1; if (m < k) m = k; } printf("%d\n", m + 1); return 0; }
A company has n employees numbered from 1 to n. Each employee either has no immediate manager or exactly one immediate manager, who is another employee with a different number. An employee A is said to be the superior of another employee B if at least one of the following is true: Employee A is the immediate manager o...
Print a single integer denoting the minimum number of groups that will be formed in the party.
C
8d911f79dde31f2c6f62e73b925e6996
300c896429b852f782bd0041b1a7c02b
GNU C
standard output
256 megabytes
train_002.jsonl
[ "dfs and similar", "trees", "graphs" ]
1316098800
["5\n-1\n1\n2\n1\n-1"]
NoteFor the first example, three groups are sufficient, for example: Employee 1 Employees 2 and 4 Employees 3 and 5
PASSED
900
standard input
3 seconds
The first line contains integer n (1 ≤ n ≤ 2000) — the number of employees. The next n lines contain the integers pi (1 ≤ pi ≤ n or pi = -1). Every pi denotes the immediate manager for the i-th employee. If pi is -1, that means that the i-th employee does not have an immediate manager. It is guaranteed, that no employ...
["3"]
#include<stdio.h> #include<stdlib.h> #include<string.h> #include<stdint.h> int n; struct node { struct node *next; struct node *prev; int value; int dep; }*a[2000]; int ma() { int max=1; int i,k; struct node *aa; for(i=0;i<n;i++) { aa=a[i];k=0; while(aa) {k++;aa=...
A company has n employees numbered from 1 to n. Each employee either has no immediate manager or exactly one immediate manager, who is another employee with a different number. An employee A is said to be the superior of another employee B if at least one of the following is true: Employee A is the immediate manager o...
Print a single integer denoting the minimum number of groups that will be formed in the party.
C
8d911f79dde31f2c6f62e73b925e6996
b91e93c329baf96cd4c49f851a78fd66
GNU C
standard output
256 megabytes
train_002.jsonl
[ "dfs and similar", "trees", "graphs" ]
1316098800
["5\n-1\n1\n2\n1\n-1"]
NoteFor the first example, three groups are sufficient, for example: Employee 1 Employees 2 and 4 Employees 3 and 5
PASSED
900
standard input
3 seconds
The first line contains integer n (1 ≤ n ≤ 2000) — the number of employees. The next n lines contain the integers pi (1 ≤ pi ≤ n or pi = -1). Every pi denotes the immediate manager for the i-th employee. If pi is -1, that means that the i-th employee does not have an immediate manager. It is guaranteed, that no employ...
["3"]
#include <stdio.h> #define max(a, b) ((a > b) ? a : b) #define Rep(i, n) for((i) = 1; (i) <= (n); ++(i)) int p[2001]; int main() { int i, j, k, n, x, res = 0; scanf("%d", &n); Rep(i, n) scanf("%d", &p[i]); Rep(i, n) { for(j = i, k = 0; j != -1; j = p[j], k++); res = max(res, k); } printf("%d\n", res); ...
A company has n employees numbered from 1 to n. Each employee either has no immediate manager or exactly one immediate manager, who is another employee with a different number. An employee A is said to be the superior of another employee B if at least one of the following is true: Employee A is the immediate manager o...
Print a single integer denoting the minimum number of groups that will be formed in the party.
C
8d911f79dde31f2c6f62e73b925e6996
2ebb9f220a3e6e187d20b4dfd49cac9a
GNU C
standard output
256 megabytes
train_002.jsonl
[ "dfs and similar", "trees", "graphs" ]
1316098800
["5\n-1\n1\n2\n1\n-1"]
NoteFor the first example, three groups are sufficient, for example: Employee 1 Employees 2 and 4 Employees 3 and 5
PASSED
900
standard input
3 seconds
The first line contains integer n (1 ≤ n ≤ 2000) — the number of employees. The next n lines contain the integers pi (1 ≤ pi ≤ n or pi = -1). Every pi denotes the immediate manager for the i-th employee. If pi is -1, that means that the i-th employee does not have an immediate manager. It is guaranteed, that no employ...
["3"]
#include <stdio.h> int A[ 2002 ]; int mayor; int n; void cuenta( int pos, int cuantos ){ if( A[ pos ] == -1 ){ if( cuantos > mayor ) mayor = cuantos; return; } cuenta( A[ pos ], cuantos+1 ); } int main(){ int i; scanf("%d", &n ); for( i = 1; i<=n; i++ ) scanf("%d", &A[...
A company has n employees numbered from 1 to n. Each employee either has no immediate manager or exactly one immediate manager, who is another employee with a different number. An employee A is said to be the superior of another employee B if at least one of the following is true: Employee A is the immediate manager o...
Print a single integer denoting the minimum number of groups that will be formed in the party.
C
8d911f79dde31f2c6f62e73b925e6996
aded50f9ae31865deecce5ad814720c1
GNU C
standard output
256 megabytes
train_002.jsonl
[ "dfs and similar", "trees", "graphs" ]
1316098800
["5\n-1\n1\n2\n1\n-1"]
NoteFor the first example, three groups are sufficient, for example: Employee 1 Employees 2 and 4 Employees 3 and 5
PASSED
900
standard input
3 seconds
The first line contains integer n (1 ≤ n ≤ 2000) — the number of employees. The next n lines contain the integers pi (1 ≤ pi ≤ n or pi = -1). Every pi denotes the immediate manager for the i-th employee. If pi is -1, that means that the i-th employee does not have an immediate manager. It is guaranteed, that no employ...
["3"]
#include <stdio.h> #include <stdlib.h> int m[2001],l[2001],n,ans; int dfs(x){ if(l[x]) return x; if(m[x]) return dfs(m[x])+1; return 0; } main(){ int i; scanf("%d",&n); for(i=1;i<=n;i++) scanf("%d",m+i); for(i=1;i<=n;i++) ans<dfs(i)?ans=dfs(i):0; printf("%d\n",ans); return 0; }
A company has n employees numbered from 1 to n. Each employee either has no immediate manager or exactly one immediate manager, who is another employee with a different number. An employee A is said to be the superior of another employee B if at least one of the following is true: Employee A is the immediate manager o...
Print a single integer denoting the minimum number of groups that will be formed in the party.
C
8d911f79dde31f2c6f62e73b925e6996
904b9fd0dd50b97ef93c28e4028fabec
GNU C
standard output
256 megabytes
train_002.jsonl
[ "dfs and similar", "trees", "graphs" ]
1316098800
["5\n-1\n1\n2\n1\n-1"]
NoteFor the first example, three groups are sufficient, for example: Employee 1 Employees 2 and 4 Employees 3 and 5
PASSED
900
standard input
3 seconds
The first line contains integer n (1 ≤ n ≤ 2000) — the number of employees. The next n lines contain the integers pi (1 ≤ pi ≤ n or pi = -1). Every pi denotes the immediate manager for the i-th employee. If pi is -1, that means that the i-th employee does not have an immediate manager. It is guaranteed, that no employ...
["3"]
#include <stdio.h> int main() { int n,i; int otac[2000]={0}; int djece[2000]={0}; int max; scanf("%d",&n); for(i=0;i<n;i++) { scanf("%d",&otac[i]); otac[i]--; if (otac[i]>=0) djece[otac[i]]++; } max=0; for(i=0;i<n;i++) { int...
A company has n employees numbered from 1 to n. Each employee either has no immediate manager or exactly one immediate manager, who is another employee with a different number. An employee A is said to be the superior of another employee B if at least one of the following is true: Employee A is the immediate manager o...
Print a single integer denoting the minimum number of groups that will be formed in the party.
C
8d911f79dde31f2c6f62e73b925e6996
ba8ffaec47a90ca133903acf4f0a304b
GNU C
standard output
256 megabytes
train_002.jsonl
[ "dfs and similar", "trees", "graphs" ]
1316098800
["5\n-1\n1\n2\n1\n-1"]
NoteFor the first example, three groups are sufficient, for example: Employee 1 Employees 2 and 4 Employees 3 and 5
PASSED
900
standard input
3 seconds
The first line contains integer n (1 ≤ n ≤ 2000) — the number of employees. The next n lines contain the integers pi (1 ≤ pi ≤ n or pi = -1). Every pi denotes the immediate manager for the i-th employee. If pi is -1, that means that the i-th employee does not have an immediate manager. It is guaranteed, that no employ...
["3"]
#include<stdio.h> #include<stdlib.h> #include<string.h> #include<math.h> int b[2002]; int n, i,k,max=0; int a[2002],check[2002]; int dfs(int i) { if(check[i]==1) return b[i]; if(a[i]==-1) b[i]=1; else b[i]=1+dfs(a[i]); return b[i]; } int main() { scanf("%d",&n); for(i=1;i<=n;i++) { scanf("%d",&a[i]); } for(i...
A company has n employees numbered from 1 to n. Each employee either has no immediate manager or exactly one immediate manager, who is another employee with a different number. An employee A is said to be the superior of another employee B if at least one of the following is true: Employee A is the immediate manager o...
Print a single integer denoting the minimum number of groups that will be formed in the party.
C
8d911f79dde31f2c6f62e73b925e6996
809471e9332036ed0e4bea88304eb224
GNU C
standard output
256 megabytes
train_002.jsonl
[ "dfs and similar", "trees", "graphs" ]
1316098800
["5\n-1\n1\n2\n1\n-1"]
NoteFor the first example, three groups are sufficient, for example: Employee 1 Employees 2 and 4 Employees 3 and 5
PASSED
900
standard input
3 seconds
The first line contains integer n (1 ≤ n ≤ 2000) — the number of employees. The next n lines contain the integers pi (1 ≤ pi ≤ n or pi = -1). Every pi denotes the immediate manager for the i-th employee. If pi is -1, that means that the i-th employee does not have an immediate manager. It is guaranteed, that no employ...
["3"]
#include<stdio.h> int arr[2000]; int dfs(int i) { if(arr[i]==-1) { return 1; } return 1+dfs(arr[i]); } int main() { int n,i,temp,max=0; scanf("%d",&n); for(i=1;i<=n;i++) { scanf("%d",&arr[i]); } for(i=1;i<=n;i++) { temp=dfs(i); if(temp>max) { max=temp; } } printf("%d",max); ...
You are given a integer $$$n$$$ ($$$n &gt; 0$$$). Find any integer $$$s$$$ which satisfies these conditions, or report that there are no such numbers:In the decimal representation of $$$s$$$: $$$s &gt; 0$$$, $$$s$$$ consists of $$$n$$$ digits, no digit in $$$s$$$ equals $$$0$$$, $$$s$$$ is not divisible by any of ...
For each test case, print an integer $$$s$$$ which satisfies the conditions described above, or "-1" (without quotes), if no such number exists. If there are multiple possible solutions for $$$s$$$, print any solution.
C
43996d7e052aa628a46d03086f9c5436
1ad0efd2648dd833c86a21689905d873
GNU C11
standard output
256 megabytes
train_002.jsonl
[ "constructive algorithms", "number theory" ]
1584628500
["4\n1\n2\n3\n4"]
NoteIn the first test case, there are no possible solutions for $$$s$$$ consisting of one digit, because any such solution is divisible by itself.For the second test case, the possible solutions are: $$$23$$$, $$$27$$$, $$$29$$$, $$$34$$$, $$$37$$$, $$$38$$$, $$$43$$$, $$$46$$$, $$$47$$$, $$$49$$$, $$$53$$$, $$$54$$$, ...
PASSED
1,000
standard input
1 second
The input consists of multiple test cases. The first line of the input contains a single integer $$$t$$$ ($$$1 \leq t \leq 400$$$), the number of test cases. The next $$$t$$$ lines each describe a test case. Each test case contains one positive integer $$$n$$$ ($$$1 \leq n \leq 10^5$$$). It is guaranteed that the sum o...
["-1\n57\n239\n6789"]
#include <stdio.h> #include <math.h> int main(){ char buffer[100000]; int n,input[100000]; scanf("%d ", &n); for(int i = 0; i < n; i++){ scanf("%d", &input[i]); } for(int j = 0;j < n;j++){ if(input[j] == 1){ printf("-1\n"); }else if(input[j] > 1){ printf("2"); for(int i = 0; i <...
You are given a integer $$$n$$$ ($$$n &gt; 0$$$). Find any integer $$$s$$$ which satisfies these conditions, or report that there are no such numbers:In the decimal representation of $$$s$$$: $$$s &gt; 0$$$, $$$s$$$ consists of $$$n$$$ digits, no digit in $$$s$$$ equals $$$0$$$, $$$s$$$ is not divisible by any of ...
For each test case, print an integer $$$s$$$ which satisfies the conditions described above, or "-1" (without quotes), if no such number exists. If there are multiple possible solutions for $$$s$$$, print any solution.
C
43996d7e052aa628a46d03086f9c5436
6e458c800a2de0bbe2924e301d9edcf3
GNU C11
standard output
256 megabytes
train_002.jsonl
[ "constructive algorithms", "number theory" ]
1584628500
["4\n1\n2\n3\n4"]
NoteIn the first test case, there are no possible solutions for $$$s$$$ consisting of one digit, because any such solution is divisible by itself.For the second test case, the possible solutions are: $$$23$$$, $$$27$$$, $$$29$$$, $$$34$$$, $$$37$$$, $$$38$$$, $$$43$$$, $$$46$$$, $$$47$$$, $$$49$$$, $$$53$$$, $$$54$$$, ...
PASSED
1,000
standard input
1 second
The input consists of multiple test cases. The first line of the input contains a single integer $$$t$$$ ($$$1 \leq t \leq 400$$$), the number of test cases. The next $$$t$$$ lines each describe a test case. Each test case contains one positive integer $$$n$$$ ($$$1 \leq n \leq 10^5$$$). It is guaranteed that the sum o...
["-1\n57\n239\n6789"]
#include<stdio.h> #include<stdlib.h> int main() { int i,j,m,n,t; scanf("%d", &t); for(i=0;i<t;i++){ scanf("%d", &n); if(n==1)printf("-1\n"); else{ for(j=0;j<n-1;j++)printf("9"); printf("8"); } printf("\n"); } return 0; }
You are given a integer $$$n$$$ ($$$n &gt; 0$$$). Find any integer $$$s$$$ which satisfies these conditions, or report that there are no such numbers:In the decimal representation of $$$s$$$: $$$s &gt; 0$$$, $$$s$$$ consists of $$$n$$$ digits, no digit in $$$s$$$ equals $$$0$$$, $$$s$$$ is not divisible by any of ...
For each test case, print an integer $$$s$$$ which satisfies the conditions described above, or "-1" (without quotes), if no such number exists. If there are multiple possible solutions for $$$s$$$, print any solution.
C
43996d7e052aa628a46d03086f9c5436
1c23cc993a16a95f38add25f41bd5930
GNU C11
standard output
256 megabytes
train_002.jsonl
[ "constructive algorithms", "number theory" ]
1584628500
["4\n1\n2\n3\n4"]
NoteIn the first test case, there are no possible solutions for $$$s$$$ consisting of one digit, because any such solution is divisible by itself.For the second test case, the possible solutions are: $$$23$$$, $$$27$$$, $$$29$$$, $$$34$$$, $$$37$$$, $$$38$$$, $$$43$$$, $$$46$$$, $$$47$$$, $$$49$$$, $$$53$$$, $$$54$$$, ...
PASSED
1,000
standard input
1 second
The input consists of multiple test cases. The first line of the input contains a single integer $$$t$$$ ($$$1 \leq t \leq 400$$$), the number of test cases. The next $$$t$$$ lines each describe a test case. Each test case contains one positive integer $$$n$$$ ($$$1 \leq n \leq 10^5$$$). It is guaranteed that the sum o...
["-1\n57\n239\n6789"]
#include<stdio.h> #include<stdlib.h> int main() { int i,j,m,n,t; scanf("%d", &t); for(i=0;i<t;i++){ scanf("%d", &n); if(n==1)printf("-1\n"); else{ printf("2"); for(j=0;j<n-1;j++)printf("3"); } printf("\n"); } return 0; }
You are given a integer $$$n$$$ ($$$n &gt; 0$$$). Find any integer $$$s$$$ which satisfies these conditions, or report that there are no such numbers:In the decimal representation of $$$s$$$: $$$s &gt; 0$$$, $$$s$$$ consists of $$$n$$$ digits, no digit in $$$s$$$ equals $$$0$$$, $$$s$$$ is not divisible by any of ...
For each test case, print an integer $$$s$$$ which satisfies the conditions described above, or "-1" (without quotes), if no such number exists. If there are multiple possible solutions for $$$s$$$, print any solution.
C
43996d7e052aa628a46d03086f9c5436
dcb129addb034016617523d69a24b602
GNU C11
standard output
256 megabytes
train_002.jsonl
[ "constructive algorithms", "number theory" ]
1584628500
["4\n1\n2\n3\n4"]
NoteIn the first test case, there are no possible solutions for $$$s$$$ consisting of one digit, because any such solution is divisible by itself.For the second test case, the possible solutions are: $$$23$$$, $$$27$$$, $$$29$$$, $$$34$$$, $$$37$$$, $$$38$$$, $$$43$$$, $$$46$$$, $$$47$$$, $$$49$$$, $$$53$$$, $$$54$$$, ...
PASSED
1,000
standard input
1 second
The input consists of multiple test cases. The first line of the input contains a single integer $$$t$$$ ($$$1 \leq t \leq 400$$$), the number of test cases. The next $$$t$$$ lines each describe a test case. Each test case contains one positive integer $$$n$$$ ($$$1 \leq n \leq 10^5$$$). It is guaranteed that the sum o...
["-1\n57\n239\n6789"]
#include<stdio.h> int main() { int test; scanf("%d",&test); for(int i = 0;i<test;i++) { int n; scanf("%d",&n); if(n == 1) { printf("-1\n"); } else { int b[n]; b[0] = 8; for(int j = 1;j<n;j++) ...
You are given a integer $$$n$$$ ($$$n &gt; 0$$$). Find any integer $$$s$$$ which satisfies these conditions, or report that there are no such numbers:In the decimal representation of $$$s$$$: $$$s &gt; 0$$$, $$$s$$$ consists of $$$n$$$ digits, no digit in $$$s$$$ equals $$$0$$$, $$$s$$$ is not divisible by any of ...
For each test case, print an integer $$$s$$$ which satisfies the conditions described above, or "-1" (without quotes), if no such number exists. If there are multiple possible solutions for $$$s$$$, print any solution.
C
43996d7e052aa628a46d03086f9c5436
bdb4d07c37d63bdd5d52ee3a0a529beb
GNU C11
standard output
256 megabytes
train_002.jsonl
[ "constructive algorithms", "number theory" ]
1584628500
["4\n1\n2\n3\n4"]
NoteIn the first test case, there are no possible solutions for $$$s$$$ consisting of one digit, because any such solution is divisible by itself.For the second test case, the possible solutions are: $$$23$$$, $$$27$$$, $$$29$$$, $$$34$$$, $$$37$$$, $$$38$$$, $$$43$$$, $$$46$$$, $$$47$$$, $$$49$$$, $$$53$$$, $$$54$$$, ...
PASSED
1,000
standard input
1 second
The input consists of multiple test cases. The first line of the input contains a single integer $$$t$$$ ($$$1 \leq t \leq 400$$$), the number of test cases. The next $$$t$$$ lines each describe a test case. Each test case contains one positive integer $$$n$$$ ($$$1 \leq n \leq 10^5$$$). It is guaranteed that the sum o...
["-1\n57\n239\n6789"]
#include<stdio.h> int main() { long long n,sum,i,j,t,a[100000]; scanf("%lld",&t); for(j=0;j<t;j++) { scanf("%lld",&n); if(n==1) printf("-1\n"); else { printf("2"); for(i=1;i<n;i++) { printf("3"); } printf("\n"); } } re...
You are given a integer $$$n$$$ ($$$n &gt; 0$$$). Find any integer $$$s$$$ which satisfies these conditions, or report that there are no such numbers:In the decimal representation of $$$s$$$: $$$s &gt; 0$$$, $$$s$$$ consists of $$$n$$$ digits, no digit in $$$s$$$ equals $$$0$$$, $$$s$$$ is not divisible by any of ...
For each test case, print an integer $$$s$$$ which satisfies the conditions described above, or "-1" (without quotes), if no such number exists. If there are multiple possible solutions for $$$s$$$, print any solution.
C
43996d7e052aa628a46d03086f9c5436
7828565d4df2c973624955a580b80bc5
GNU C11
standard output
256 megabytes
train_002.jsonl
[ "constructive algorithms", "number theory" ]
1584628500
["4\n1\n2\n3\n4"]
NoteIn the first test case, there are no possible solutions for $$$s$$$ consisting of one digit, because any such solution is divisible by itself.For the second test case, the possible solutions are: $$$23$$$, $$$27$$$, $$$29$$$, $$$34$$$, $$$37$$$, $$$38$$$, $$$43$$$, $$$46$$$, $$$47$$$, $$$49$$$, $$$53$$$, $$$54$$$, ...
PASSED
1,000
standard input
1 second
The input consists of multiple test cases. The first line of the input contains a single integer $$$t$$$ ($$$1 \leq t \leq 400$$$), the number of test cases. The next $$$t$$$ lines each describe a test case. Each test case contains one positive integer $$$n$$$ ($$$1 \leq n \leq 10^5$$$). It is guaranteed that the sum o...
["-1\n57\n239\n6789"]
#include<stdio.h> int main(){ int n; scanf("%d",&n); for(int i=1;i<=n;i++){ int m; scanf("%d",&m); if(m==1) printf("%d\n",-1); else{ printf("%d",2); for(int i=1;i<=m-1;i++) printf("%d",9); printf("\n"); }...
You are given a integer $$$n$$$ ($$$n &gt; 0$$$). Find any integer $$$s$$$ which satisfies these conditions, or report that there are no such numbers:In the decimal representation of $$$s$$$: $$$s &gt; 0$$$, $$$s$$$ consists of $$$n$$$ digits, no digit in $$$s$$$ equals $$$0$$$, $$$s$$$ is not divisible by any of ...
For each test case, print an integer $$$s$$$ which satisfies the conditions described above, or "-1" (without quotes), if no such number exists. If there are multiple possible solutions for $$$s$$$, print any solution.
C
43996d7e052aa628a46d03086f9c5436
03f80396430c1864bf4e16cf6bed9ee9
GNU C11
standard output
256 megabytes
train_002.jsonl
[ "constructive algorithms", "number theory" ]
1584628500
["4\n1\n2\n3\n4"]
NoteIn the first test case, there are no possible solutions for $$$s$$$ consisting of one digit, because any such solution is divisible by itself.For the second test case, the possible solutions are: $$$23$$$, $$$27$$$, $$$29$$$, $$$34$$$, $$$37$$$, $$$38$$$, $$$43$$$, $$$46$$$, $$$47$$$, $$$49$$$, $$$53$$$, $$$54$$$, ...
PASSED
1,000
standard input
1 second
The input consists of multiple test cases. The first line of the input contains a single integer $$$t$$$ ($$$1 \leq t \leq 400$$$), the number of test cases. The next $$$t$$$ lines each describe a test case. Each test case contains one positive integer $$$n$$$ ($$$1 \leq n \leq 10^5$$$). It is guaranteed that the sum o...
["-1\n57\n239\n6789"]
//BISMILLAHIR RAHMANIR RAHIM //RHYTHM_086_NS_01 #include <stdio.h> int main() { int n,t; scanf("%d",&t); while(t--){ scanf("%d",&n); if(n==1){ printf("-1\n"); continue; } printf("2"); for(int i=1;i<n;i++){ printf("7"); } ...
You are given a integer $$$n$$$ ($$$n &gt; 0$$$). Find any integer $$$s$$$ which satisfies these conditions, or report that there are no such numbers:In the decimal representation of $$$s$$$: $$$s &gt; 0$$$, $$$s$$$ consists of $$$n$$$ digits, no digit in $$$s$$$ equals $$$0$$$, $$$s$$$ is not divisible by any of ...
For each test case, print an integer $$$s$$$ which satisfies the conditions described above, or "-1" (without quotes), if no such number exists. If there are multiple possible solutions for $$$s$$$, print any solution.
C
43996d7e052aa628a46d03086f9c5436
2fa9f73c4d72090b82ca22ba0f1173a1
GNU C11
standard output
256 megabytes
train_002.jsonl
[ "constructive algorithms", "number theory" ]
1584628500
["4\n1\n2\n3\n4"]
NoteIn the first test case, there are no possible solutions for $$$s$$$ consisting of one digit, because any such solution is divisible by itself.For the second test case, the possible solutions are: $$$23$$$, $$$27$$$, $$$29$$$, $$$34$$$, $$$37$$$, $$$38$$$, $$$43$$$, $$$46$$$, $$$47$$$, $$$49$$$, $$$53$$$, $$$54$$$, ...
PASSED
1,000
standard input
1 second
The input consists of multiple test cases. The first line of the input contains a single integer $$$t$$$ ($$$1 \leq t \leq 400$$$), the number of test cases. The next $$$t$$$ lines each describe a test case. Each test case contains one positive integer $$$n$$$ ($$$1 \leq n \leq 10^5$$$). It is guaranteed that the sum o...
["-1\n57\n239\n6789"]
//BISMILLAHIR RAHMANIR RAHIM //RHYTHM_086_NS_01 #include <stdio.h> int main() { int n,t; scanf("%d",&t); while(t--){ scanf("%d",&n); if(n==1){ printf("-1\n"); continue; } printf("2"); for(int i=1;i<n;i++){ printf("3"); } ...
You are given a integer $$$n$$$ ($$$n &gt; 0$$$). Find any integer $$$s$$$ which satisfies these conditions, or report that there are no such numbers:In the decimal representation of $$$s$$$: $$$s &gt; 0$$$, $$$s$$$ consists of $$$n$$$ digits, no digit in $$$s$$$ equals $$$0$$$, $$$s$$$ is not divisible by any of ...
For each test case, print an integer $$$s$$$ which satisfies the conditions described above, or "-1" (without quotes), if no such number exists. If there are multiple possible solutions for $$$s$$$, print any solution.
C
43996d7e052aa628a46d03086f9c5436
2eae4d048915ca48b7b1d4f96f299ea9
GNU C11
standard output
256 megabytes
train_002.jsonl
[ "constructive algorithms", "number theory" ]
1584628500
["4\n1\n2\n3\n4"]
NoteIn the first test case, there are no possible solutions for $$$s$$$ consisting of one digit, because any such solution is divisible by itself.For the second test case, the possible solutions are: $$$23$$$, $$$27$$$, $$$29$$$, $$$34$$$, $$$37$$$, $$$38$$$, $$$43$$$, $$$46$$$, $$$47$$$, $$$49$$$, $$$53$$$, $$$54$$$, ...
PASSED
1,000
standard input
1 second
The input consists of multiple test cases. The first line of the input contains a single integer $$$t$$$ ($$$1 \leq t \leq 400$$$), the number of test cases. The next $$$t$$$ lines each describe a test case. Each test case contains one positive integer $$$n$$$ ($$$1 \leq n \leq 10^5$$$). It is guaranteed that the sum o...
["-1\n57\n239\n6789"]
#include<stdio.h> #include<stdlib.h> int main() { long long int n1,n2; scanf("%lld",&n1); while(n1--) { scanf("%lld",&n2); if(n2==1) { printf("-1\n"); // break; } else { if(n2>=2) { printf("2")...
You are given a integer $$$n$$$ ($$$n &gt; 0$$$). Find any integer $$$s$$$ which satisfies these conditions, or report that there are no such numbers:In the decimal representation of $$$s$$$: $$$s &gt; 0$$$, $$$s$$$ consists of $$$n$$$ digits, no digit in $$$s$$$ equals $$$0$$$, $$$s$$$ is not divisible by any of ...
For each test case, print an integer $$$s$$$ which satisfies the conditions described above, or "-1" (without quotes), if no such number exists. If there are multiple possible solutions for $$$s$$$, print any solution.
C
43996d7e052aa628a46d03086f9c5436
349cafd00d2ed44f7b673fc7fe35ebd6
GNU C11
standard output
256 megabytes
train_002.jsonl
[ "constructive algorithms", "number theory" ]
1584628500
["4\n1\n2\n3\n4"]
NoteIn the first test case, there are no possible solutions for $$$s$$$ consisting of one digit, because any such solution is divisible by itself.For the second test case, the possible solutions are: $$$23$$$, $$$27$$$, $$$29$$$, $$$34$$$, $$$37$$$, $$$38$$$, $$$43$$$, $$$46$$$, $$$47$$$, $$$49$$$, $$$53$$$, $$$54$$$, ...
PASSED
1,000
standard input
1 second
The input consists of multiple test cases. The first line of the input contains a single integer $$$t$$$ ($$$1 \leq t \leq 400$$$), the number of test cases. The next $$$t$$$ lines each describe a test case. Each test case contains one positive integer $$$n$$$ ($$$1 \leq n \leq 10^5$$$). It is guaranteed that the sum o...
["-1\n57\n239\n6789"]
#include<stdio.h> int main() { int t; scanf("%d",&t); int n; while (t--) { scanf("%d",&n); if (n==1) printf("-1\n"); else if (n>1) { printf("2"); for (int i=1;i<n;i++) { if (i%2==1) ...
You are given a integer $$$n$$$ ($$$n &gt; 0$$$). Find any integer $$$s$$$ which satisfies these conditions, or report that there are no such numbers:In the decimal representation of $$$s$$$: $$$s &gt; 0$$$, $$$s$$$ consists of $$$n$$$ digits, no digit in $$$s$$$ equals $$$0$$$, $$$s$$$ is not divisible by any of ...
For each test case, print an integer $$$s$$$ which satisfies the conditions described above, or "-1" (without quotes), if no such number exists. If there are multiple possible solutions for $$$s$$$, print any solution.
C
43996d7e052aa628a46d03086f9c5436
36d5c3b72d200987b3f4804734eb1f8c
GNU C11
standard output
256 megabytes
train_002.jsonl
[ "constructive algorithms", "number theory" ]
1584628500
["4\n1\n2\n3\n4"]
NoteIn the first test case, there are no possible solutions for $$$s$$$ consisting of one digit, because any such solution is divisible by itself.For the second test case, the possible solutions are: $$$23$$$, $$$27$$$, $$$29$$$, $$$34$$$, $$$37$$$, $$$38$$$, $$$43$$$, $$$46$$$, $$$47$$$, $$$49$$$, $$$53$$$, $$$54$$$, ...
PASSED
1,000
standard input
1 second
The input consists of multiple test cases. The first line of the input contains a single integer $$$t$$$ ($$$1 \leq t \leq 400$$$), the number of test cases. The next $$$t$$$ lines each describe a test case. Each test case contains one positive integer $$$n$$$ ($$$1 \leq n \leq 10^5$$$). It is guaranteed that the sum o...
["-1\n57\n239\n6789"]
#include <stdio.h> void main() { int t; scanf("%d", &t); while(t--) { long n; scanf("%ld", &n); if (n == 1) printf("-1"); else { printf("2"); for (int i=1; i<n; i++) printf("3"); } printf("\n"); } }
You are given a integer $$$n$$$ ($$$n &gt; 0$$$). Find any integer $$$s$$$ which satisfies these conditions, or report that there are no such numbers:In the decimal representation of $$$s$$$: $$$s &gt; 0$$$, $$$s$$$ consists of $$$n$$$ digits, no digit in $$$s$$$ equals $$$0$$$, $$$s$$$ is not divisible by any of ...
For each test case, print an integer $$$s$$$ which satisfies the conditions described above, or "-1" (without quotes), if no such number exists. If there are multiple possible solutions for $$$s$$$, print any solution.
C
43996d7e052aa628a46d03086f9c5436
e812eb3171aae89edc0a368d56c50a9f
GNU C11
standard output
256 megabytes
train_002.jsonl
[ "constructive algorithms", "number theory" ]
1584628500
["4\n1\n2\n3\n4"]
NoteIn the first test case, there are no possible solutions for $$$s$$$ consisting of one digit, because any such solution is divisible by itself.For the second test case, the possible solutions are: $$$23$$$, $$$27$$$, $$$29$$$, $$$34$$$, $$$37$$$, $$$38$$$, $$$43$$$, $$$46$$$, $$$47$$$, $$$49$$$, $$$53$$$, $$$54$$$, ...
PASSED
1,000
standard input
1 second
The input consists of multiple test cases. The first line of the input contains a single integer $$$t$$$ ($$$1 \leq t \leq 400$$$), the number of test cases. The next $$$t$$$ lines each describe a test case. Each test case contains one positive integer $$$n$$$ ($$$1 \leq n \leq 10^5$$$). It is guaranteed that the sum o...
["-1\n57\n239\n6789"]
#include<stdio.h> #include<stdlib.h> #include<math.h> int main () { int t, n , p ; scanf("%d",&t); while(t--) { scanf("%d",&n); if(n==1) printf("-1\n"); else for(p=0;p<n;p++) printf("%c",p==0?'2':'3'); puts("\n"); } return 0; }
You are given a integer $$$n$$$ ($$$n &gt; 0$$$). Find any integer $$$s$$$ which satisfies these conditions, or report that there are no such numbers:In the decimal representation of $$$s$$$: $$$s &gt; 0$$$, $$$s$$$ consists of $$$n$$$ digits, no digit in $$$s$$$ equals $$$0$$$, $$$s$$$ is not divisible by any of ...
For each test case, print an integer $$$s$$$ which satisfies the conditions described above, or "-1" (without quotes), if no such number exists. If there are multiple possible solutions for $$$s$$$, print any solution.
C
43996d7e052aa628a46d03086f9c5436
44a973f247fc62c3b08da8764dfb58b0
GNU C11
standard output
256 megabytes
train_002.jsonl
[ "constructive algorithms", "number theory" ]
1584628500
["4\n1\n2\n3\n4"]
NoteIn the first test case, there are no possible solutions for $$$s$$$ consisting of one digit, because any such solution is divisible by itself.For the second test case, the possible solutions are: $$$23$$$, $$$27$$$, $$$29$$$, $$$34$$$, $$$37$$$, $$$38$$$, $$$43$$$, $$$46$$$, $$$47$$$, $$$49$$$, $$$53$$$, $$$54$$$, ...
PASSED
1,000
standard input
1 second
The input consists of multiple test cases. The first line of the input contains a single integer $$$t$$$ ($$$1 \leq t \leq 400$$$), the number of test cases. The next $$$t$$$ lines each describe a test case. Each test case contains one positive integer $$$n$$$ ($$$1 \leq n \leq 10^5$$$). It is guaranteed that the sum o...
["-1\n57\n239\n6789"]
#include<stdio.h> int main(){ int t,n,a[100001],i; scanf("%d",&t); while(t--){ i=0; scanf("%d",&n); if(n==1) printf("-1\n"); else{ printf("2"); while(--n) printf("3"); printf("\n"); } } }
You are given a integer $$$n$$$ ($$$n &gt; 0$$$). Find any integer $$$s$$$ which satisfies these conditions, or report that there are no such numbers:In the decimal representation of $$$s$$$: $$$s &gt; 0$$$, $$$s$$$ consists of $$$n$$$ digits, no digit in $$$s$$$ equals $$$0$$$, $$$s$$$ is not divisible by any of ...
For each test case, print an integer $$$s$$$ which satisfies the conditions described above, or "-1" (without quotes), if no such number exists. If there are multiple possible solutions for $$$s$$$, print any solution.
C
43996d7e052aa628a46d03086f9c5436
eab1f091462b2eca7ad78b6e820b6d74
GNU C11
standard output
256 megabytes
train_002.jsonl
[ "constructive algorithms", "number theory" ]
1584628500
["4\n1\n2\n3\n4"]
NoteIn the first test case, there are no possible solutions for $$$s$$$ consisting of one digit, because any such solution is divisible by itself.For the second test case, the possible solutions are: $$$23$$$, $$$27$$$, $$$29$$$, $$$34$$$, $$$37$$$, $$$38$$$, $$$43$$$, $$$46$$$, $$$47$$$, $$$49$$$, $$$53$$$, $$$54$$$, ...
PASSED
1,000
standard input
1 second
The input consists of multiple test cases. The first line of the input contains a single integer $$$t$$$ ($$$1 \leq t \leq 400$$$), the number of test cases. The next $$$t$$$ lines each describe a test case. Each test case contains one positive integer $$$n$$$ ($$$1 \leq n \leq 10^5$$$). It is guaranteed that the sum o...
["-1\n57\n239\n6789"]
#include<stdio.h> int main() { int n,t,i; scanf("%d",&t); while(t--) { scanf("%d",&n); int x[n]; if(n>=2) {printf("2"); for(i=1;i<n;i++) printf("3"); printf("\n"); } else printf("-1\n"); } }
You are given a integer $$$n$$$ ($$$n &gt; 0$$$). Find any integer $$$s$$$ which satisfies these conditions, or report that there are no such numbers:In the decimal representation of $$$s$$$: $$$s &gt; 0$$$, $$$s$$$ consists of $$$n$$$ digits, no digit in $$$s$$$ equals $$$0$$$, $$$s$$$ is not divisible by any of ...
For each test case, print an integer $$$s$$$ which satisfies the conditions described above, or "-1" (without quotes), if no such number exists. If there are multiple possible solutions for $$$s$$$, print any solution.
C
43996d7e052aa628a46d03086f9c5436
a35fd15728a352231aeb747c0f687ef7
GNU C11
standard output
256 megabytes
train_002.jsonl
[ "constructive algorithms", "number theory" ]
1584628500
["4\n1\n2\n3\n4"]
NoteIn the first test case, there are no possible solutions for $$$s$$$ consisting of one digit, because any such solution is divisible by itself.For the second test case, the possible solutions are: $$$23$$$, $$$27$$$, $$$29$$$, $$$34$$$, $$$37$$$, $$$38$$$, $$$43$$$, $$$46$$$, $$$47$$$, $$$49$$$, $$$53$$$, $$$54$$$, ...
PASSED
1,000
standard input
1 second
The input consists of multiple test cases. The first line of the input contains a single integer $$$t$$$ ($$$1 \leq t \leq 400$$$), the number of test cases. The next $$$t$$$ lines each describe a test case. Each test case contains one positive integer $$$n$$$ ($$$1 \leq n \leq 10^5$$$). It is guaranteed that the sum o...
["-1\n57\n239\n6789"]
#include<stdio.h> int main(){ unsigned int n,i,t; scanf("%u", &t); while(t--){ scanf("%u", &n); if(n<2) printf("-1\n"); else{ printf("2"); for(i=1;i<n;i++) printf("3"); printf("\n"); } } }
You are given a integer $$$n$$$ ($$$n &gt; 0$$$). Find any integer $$$s$$$ which satisfies these conditions, or report that there are no such numbers:In the decimal representation of $$$s$$$: $$$s &gt; 0$$$, $$$s$$$ consists of $$$n$$$ digits, no digit in $$$s$$$ equals $$$0$$$, $$$s$$$ is not divisible by any of ...
For each test case, print an integer $$$s$$$ which satisfies the conditions described above, or "-1" (without quotes), if no such number exists. If there are multiple possible solutions for $$$s$$$, print any solution.
C
43996d7e052aa628a46d03086f9c5436
73b595b23499414cfe40f19be5a0f12b
GNU C11
standard output
256 megabytes
train_002.jsonl
[ "constructive algorithms", "number theory" ]
1584628500
["4\n1\n2\n3\n4"]
NoteIn the first test case, there are no possible solutions for $$$s$$$ consisting of one digit, because any such solution is divisible by itself.For the second test case, the possible solutions are: $$$23$$$, $$$27$$$, $$$29$$$, $$$34$$$, $$$37$$$, $$$38$$$, $$$43$$$, $$$46$$$, $$$47$$$, $$$49$$$, $$$53$$$, $$$54$$$, ...
PASSED
1,000
standard input
1 second
The input consists of multiple test cases. The first line of the input contains a single integer $$$t$$$ ($$$1 \leq t \leq 400$$$), the number of test cases. The next $$$t$$$ lines each describe a test case. Each test case contains one positive integer $$$n$$$ ($$$1 \leq n \leq 10^5$$$). It is guaranteed that the sum o...
["-1\n57\n239\n6789"]
#include <stdio.h> #include <stdlib.h> int main() { int t; scanf("%d", &t); while(t--) { int n; scanf("%d", &n); if(n <= 1) printf("-1"); else { printf("2"); for(int i = 0; i < n - 1; ++i) printf("3"); } printf("\n"); ...
You are given a integer $$$n$$$ ($$$n &gt; 0$$$). Find any integer $$$s$$$ which satisfies these conditions, or report that there are no such numbers:In the decimal representation of $$$s$$$: $$$s &gt; 0$$$, $$$s$$$ consists of $$$n$$$ digits, no digit in $$$s$$$ equals $$$0$$$, $$$s$$$ is not divisible by any of ...
For each test case, print an integer $$$s$$$ which satisfies the conditions described above, or "-1" (without quotes), if no such number exists. If there are multiple possible solutions for $$$s$$$, print any solution.
C
43996d7e052aa628a46d03086f9c5436
a5905126843be2154fb6f54df65272b4
GNU C11
standard output
256 megabytes
train_002.jsonl
[ "constructive algorithms", "number theory" ]
1584628500
["4\n1\n2\n3\n4"]
NoteIn the first test case, there are no possible solutions for $$$s$$$ consisting of one digit, because any such solution is divisible by itself.For the second test case, the possible solutions are: $$$23$$$, $$$27$$$, $$$29$$$, $$$34$$$, $$$37$$$, $$$38$$$, $$$43$$$, $$$46$$$, $$$47$$$, $$$49$$$, $$$53$$$, $$$54$$$, ...
PASSED
1,000
standard input
1 second
The input consists of multiple test cases. The first line of the input contains a single integer $$$t$$$ ($$$1 \leq t \leq 400$$$), the number of test cases. The next $$$t$$$ lines each describe a test case. Each test case contains one positive integer $$$n$$$ ($$$1 \leq n \leq 10^5$$$). It is guaranteed that the sum o...
["-1\n57\n239\n6789"]
#include <stdio.h> #include <stdlib.h> #include <string.h> int main(void) { int k; scanf("%d", &k); for (int i = 0; i < k; ++i) { int x; scanf("%d", &x); if (x == 1) { printf("-1\n"); continue; } char *fin = malloc(x+1); memset(fin, '9', x + 1); fin[0] = '2'; fin[x] = '\0'; printf("%s\n",...
You are given a integer $$$n$$$ ($$$n &gt; 0$$$). Find any integer $$$s$$$ which satisfies these conditions, or report that there are no such numbers:In the decimal representation of $$$s$$$: $$$s &gt; 0$$$, $$$s$$$ consists of $$$n$$$ digits, no digit in $$$s$$$ equals $$$0$$$, $$$s$$$ is not divisible by any of ...
For each test case, print an integer $$$s$$$ which satisfies the conditions described above, or "-1" (without quotes), if no such number exists. If there are multiple possible solutions for $$$s$$$, print any solution.
C
43996d7e052aa628a46d03086f9c5436
500d106b73846e32932ec02bd13dd8ee
GNU C11
standard output
256 megabytes
train_002.jsonl
[ "constructive algorithms", "number theory" ]
1584628500
["4\n1\n2\n3\n4"]
NoteIn the first test case, there are no possible solutions for $$$s$$$ consisting of one digit, because any such solution is divisible by itself.For the second test case, the possible solutions are: $$$23$$$, $$$27$$$, $$$29$$$, $$$34$$$, $$$37$$$, $$$38$$$, $$$43$$$, $$$46$$$, $$$47$$$, $$$49$$$, $$$53$$$, $$$54$$$, ...
PASSED
1,000
standard input
1 second
The input consists of multiple test cases. The first line of the input contains a single integer $$$t$$$ ($$$1 \leq t \leq 400$$$), the number of test cases. The next $$$t$$$ lines each describe a test case. Each test case contains one positive integer $$$n$$$ ($$$1 \leq n \leq 10^5$$$). It is guaranteed that the sum o...
["-1\n57\n239\n6789"]
#include <stdio.h> int main() { int t; scanf("%d", &t); while(t--) { int n; scanf("%d", &n); if(n == 1) { printf("-1\n"); } else { printf("2"); for(int i = 1; i < n; ++i) { printf("3"); } pu...
You are given a integer $$$n$$$ ($$$n &gt; 0$$$). Find any integer $$$s$$$ which satisfies these conditions, or report that there are no such numbers:In the decimal representation of $$$s$$$: $$$s &gt; 0$$$, $$$s$$$ consists of $$$n$$$ digits, no digit in $$$s$$$ equals $$$0$$$, $$$s$$$ is not divisible by any of ...
For each test case, print an integer $$$s$$$ which satisfies the conditions described above, or "-1" (without quotes), if no such number exists. If there are multiple possible solutions for $$$s$$$, print any solution.
C
43996d7e052aa628a46d03086f9c5436
7bb23886f2d870004591b4d6ff837df2
GNU C11
standard output
256 megabytes
train_002.jsonl
[ "constructive algorithms", "number theory" ]
1584628500
["4\n1\n2\n3\n4"]
NoteIn the first test case, there are no possible solutions for $$$s$$$ consisting of one digit, because any such solution is divisible by itself.For the second test case, the possible solutions are: $$$23$$$, $$$27$$$, $$$29$$$, $$$34$$$, $$$37$$$, $$$38$$$, $$$43$$$, $$$46$$$, $$$47$$$, $$$49$$$, $$$53$$$, $$$54$$$, ...
PASSED
1,000
standard input
1 second
The input consists of multiple test cases. The first line of the input contains a single integer $$$t$$$ ($$$1 \leq t \leq 400$$$), the number of test cases. The next $$$t$$$ lines each describe a test case. Each test case contains one positive integer $$$n$$$ ($$$1 \leq n \leq 10^5$$$). It is guaranteed that the sum o...
["-1\n57\n239\n6789"]
#include <stdio.h> int main() { int t; scanf("%d", &t); while(t--) { int n; scanf("%d", &n); if(n == 1) { printf("-1\n"); } else { printf("2"); for(int i = 1; i < n; ++i) { printf("3"); } puts(""); } } return 0; }
You are given a integer $$$n$$$ ($$$n &gt; 0$$$). Find any integer $$$s$$$ which satisfies these conditions, or report that there are no such numbers:In the decimal representation of $$$s$$$: $$$s &gt; 0$$$, $$$s$$$ consists of $$$n$$$ digits, no digit in $$$s$$$ equals $$$0$$$, $$$s$$$ is not divisible by any of ...
For each test case, print an integer $$$s$$$ which satisfies the conditions described above, or "-1" (without quotes), if no such number exists. If there are multiple possible solutions for $$$s$$$, print any solution.
C
43996d7e052aa628a46d03086f9c5436
505dbdd9c8276a5ddfc68d5a8db9f1a0
GNU C11
standard output
256 megabytes
train_002.jsonl
[ "constructive algorithms", "number theory" ]
1584628500
["4\n1\n2\n3\n4"]
NoteIn the first test case, there are no possible solutions for $$$s$$$ consisting of one digit, because any such solution is divisible by itself.For the second test case, the possible solutions are: $$$23$$$, $$$27$$$, $$$29$$$, $$$34$$$, $$$37$$$, $$$38$$$, $$$43$$$, $$$46$$$, $$$47$$$, $$$49$$$, $$$53$$$, $$$54$$$, ...
PASSED
1,000
standard input
1 second
The input consists of multiple test cases. The first line of the input contains a single integer $$$t$$$ ($$$1 \leq t \leq 400$$$), the number of test cases. The next $$$t$$$ lines each describe a test case. Each test case contains one positive integer $$$n$$$ ($$$1 \leq n \leq 10^5$$$). It is guaranteed that the sum o...
["-1\n57\n239\n6789"]
#include<stdio.h> int main() { int t,n,i,j; scanf("%d",&t); for (i=1;i<=t;i++){ scanf("%d",&n); if (n==1){ printf("-1\n"); } else { printf("2"); for (j=1;j<n;j++){ printf("3"); } printf("\n"); ...
You are given a integer $$$n$$$ ($$$n &gt; 0$$$). Find any integer $$$s$$$ which satisfies these conditions, or report that there are no such numbers:In the decimal representation of $$$s$$$: $$$s &gt; 0$$$, $$$s$$$ consists of $$$n$$$ digits, no digit in $$$s$$$ equals $$$0$$$, $$$s$$$ is not divisible by any of ...
For each test case, print an integer $$$s$$$ which satisfies the conditions described above, or "-1" (without quotes), if no such number exists. If there are multiple possible solutions for $$$s$$$, print any solution.
C
43996d7e052aa628a46d03086f9c5436
4f593b2dba873b5dc1ffae09a4795cc3
GNU C11
standard output
256 megabytes
train_002.jsonl
[ "constructive algorithms", "number theory" ]
1584628500
["4\n1\n2\n3\n4"]
NoteIn the first test case, there are no possible solutions for $$$s$$$ consisting of one digit, because any such solution is divisible by itself.For the second test case, the possible solutions are: $$$23$$$, $$$27$$$, $$$29$$$, $$$34$$$, $$$37$$$, $$$38$$$, $$$43$$$, $$$46$$$, $$$47$$$, $$$49$$$, $$$53$$$, $$$54$$$, ...
PASSED
1,000
standard input
1 second
The input consists of multiple test cases. The first line of the input contains a single integer $$$t$$$ ($$$1 \leq t \leq 400$$$), the number of test cases. The next $$$t$$$ lines each describe a test case. Each test case contains one positive integer $$$n$$$ ($$$1 \leq n \leq 10^5$$$). It is guaranteed that the sum o...
["-1\n57\n239\n6789"]
#include <stdio.h> int main() { int x=100000, n; char a[100001]; while(x--)a[x]='5'; a[100001]='\0'; scanf("%d", &n); while(n--) { scanf("%d", &x); if(x==1)printf("-1\n"); else { x--, x=100000-x; printf("%s", &a[x]); printf...
You are given a integer $$$n$$$ ($$$n &gt; 0$$$). Find any integer $$$s$$$ which satisfies these conditions, or report that there are no such numbers:In the decimal representation of $$$s$$$: $$$s &gt; 0$$$, $$$s$$$ consists of $$$n$$$ digits, no digit in $$$s$$$ equals $$$0$$$, $$$s$$$ is not divisible by any of ...
For each test case, print an integer $$$s$$$ which satisfies the conditions described above, or "-1" (without quotes), if no such number exists. If there are multiple possible solutions for $$$s$$$, print any solution.
C
43996d7e052aa628a46d03086f9c5436
262da21355871e40b0a6d5212a19ec8f
GNU C11
standard output
256 megabytes
train_002.jsonl
[ "constructive algorithms", "number theory" ]
1584628500
["4\n1\n2\n3\n4"]
NoteIn the first test case, there are no possible solutions for $$$s$$$ consisting of one digit, because any such solution is divisible by itself.For the second test case, the possible solutions are: $$$23$$$, $$$27$$$, $$$29$$$, $$$34$$$, $$$37$$$, $$$38$$$, $$$43$$$, $$$46$$$, $$$47$$$, $$$49$$$, $$$53$$$, $$$54$$$, ...
PASSED
1,000
standard input
1 second
The input consists of multiple test cases. The first line of the input contains a single integer $$$t$$$ ($$$1 \leq t \leq 400$$$), the number of test cases. The next $$$t$$$ lines each describe a test case. Each test case contains one positive integer $$$n$$$ ($$$1 \leq n \leq 10^5$$$). It is guaranteed that the sum o...
["-1\n57\n239\n6789"]
#include <stdio.h> int main() { int x, y, n; scanf("%d", &n); while(n--) { scanf("%d", &x); if(x==1)printf("-1\n"); else { x--, y=x%1000, x=(x-y)/1000; while(y--)printf("5"); while(x--)printf("555555555555555555555555555555555555555555...
You are given a integer $$$n$$$ ($$$n &gt; 0$$$). Find any integer $$$s$$$ which satisfies these conditions, or report that there are no such numbers:In the decimal representation of $$$s$$$: $$$s &gt; 0$$$, $$$s$$$ consists of $$$n$$$ digits, no digit in $$$s$$$ equals $$$0$$$, $$$s$$$ is not divisible by any of ...
For each test case, print an integer $$$s$$$ which satisfies the conditions described above, or "-1" (without quotes), if no such number exists. If there are multiple possible solutions for $$$s$$$, print any solution.
C
43996d7e052aa628a46d03086f9c5436
d3b24f3bf7bbbea142a2838fec112355
GNU C11
standard output
256 megabytes
train_002.jsonl
[ "constructive algorithms", "number theory" ]
1584628500
["4\n1\n2\n3\n4"]
NoteIn the first test case, there are no possible solutions for $$$s$$$ consisting of one digit, because any such solution is divisible by itself.For the second test case, the possible solutions are: $$$23$$$, $$$27$$$, $$$29$$$, $$$34$$$, $$$37$$$, $$$38$$$, $$$43$$$, $$$46$$$, $$$47$$$, $$$49$$$, $$$53$$$, $$$54$$$, ...
PASSED
1,000
standard input
1 second
The input consists of multiple test cases. The first line of the input contains a single integer $$$t$$$ ($$$1 \leq t \leq 400$$$), the number of test cases. The next $$$t$$$ lines each describe a test case. Each test case contains one positive integer $$$n$$$ ($$$1 \leq n \leq 10^5$$$). It is guaranteed that the sum o...
["-1\n57\n239\n6789"]
#include <stdio.h> int main() { int x, n; scanf("%d", &n); while(n--) { scanf("%d", &x); if(x==1)printf("-1\n"); else { x--; while(x--)printf("5"); printf("8\n"); } } }
You are given a integer $$$n$$$ ($$$n &gt; 0$$$). Find any integer $$$s$$$ which satisfies these conditions, or report that there are no such numbers:In the decimal representation of $$$s$$$: $$$s &gt; 0$$$, $$$s$$$ consists of $$$n$$$ digits, no digit in $$$s$$$ equals $$$0$$$, $$$s$$$ is not divisible by any of ...
For each test case, print an integer $$$s$$$ which satisfies the conditions described above, or "-1" (without quotes), if no such number exists. If there are multiple possible solutions for $$$s$$$, print any solution.
C
43996d7e052aa628a46d03086f9c5436
aa772abfc5dc725ee26b378e04a10b40
GNU C11
standard output
256 megabytes
train_002.jsonl
[ "constructive algorithms", "number theory" ]
1584628500
["4\n1\n2\n3\n4"]
NoteIn the first test case, there are no possible solutions for $$$s$$$ consisting of one digit, because any such solution is divisible by itself.For the second test case, the possible solutions are: $$$23$$$, $$$27$$$, $$$29$$$, $$$34$$$, $$$37$$$, $$$38$$$, $$$43$$$, $$$46$$$, $$$47$$$, $$$49$$$, $$$53$$$, $$$54$$$, ...
PASSED
1,000
standard input
1 second
The input consists of multiple test cases. The first line of the input contains a single integer $$$t$$$ ($$$1 \leq t \leq 400$$$), the number of test cases. The next $$$t$$$ lines each describe a test case. Each test case contains one positive integer $$$n$$$ ($$$1 \leq n \leq 10^5$$$). It is guaranteed that the sum o...
["-1\n57\n239\n6789"]
#include<stdio.h> int main() { int t; scanf("%d",&t); while(t--) { int n,i; scanf("%d",&n); if(n==1) { printf("-1\n"); } else { for(i=0;i<n-1;i++) { printf("5"); } printf("4\n"); } } return 0; }
You are given a integer $$$n$$$ ($$$n &gt; 0$$$). Find any integer $$$s$$$ which satisfies these conditions, or report that there are no such numbers:In the decimal representation of $$$s$$$: $$$s &gt; 0$$$, $$$s$$$ consists of $$$n$$$ digits, no digit in $$$s$$$ equals $$$0$$$, $$$s$$$ is not divisible by any of ...
For each test case, print an integer $$$s$$$ which satisfies the conditions described above, or "-1" (without quotes), if no such number exists. If there are multiple possible solutions for $$$s$$$, print any solution.
C
43996d7e052aa628a46d03086f9c5436
d2967e0bf8e9e1a9f7bdb914adc4ecce
GNU C11
standard output
256 megabytes
train_002.jsonl
[ "constructive algorithms", "number theory" ]
1584628500
["4\n1\n2\n3\n4"]
NoteIn the first test case, there are no possible solutions for $$$s$$$ consisting of one digit, because any such solution is divisible by itself.For the second test case, the possible solutions are: $$$23$$$, $$$27$$$, $$$29$$$, $$$34$$$, $$$37$$$, $$$38$$$, $$$43$$$, $$$46$$$, $$$47$$$, $$$49$$$, $$$53$$$, $$$54$$$, ...
PASSED
1,000
standard input
1 second
The input consists of multiple test cases. The first line of the input contains a single integer $$$t$$$ ($$$1 \leq t \leq 400$$$), the number of test cases. The next $$$t$$$ lines each describe a test case. Each test case contains one positive integer $$$n$$$ ($$$1 \leq n \leq 10^5$$$). It is guaranteed that the sum o...
["-1\n57\n239\n6789"]
#include<stdio.h> int main() { int a,t,i,j; scanf("%d",&t); for(i=1;i<=t;i++){ scanf("%d",&a); if(a==1) printf("-1\n"); else{ a--; printf("2"); for(j=1;j<=a;j++){ printf("3...
You are given a integer $$$n$$$ ($$$n &gt; 0$$$). Find any integer $$$s$$$ which satisfies these conditions, or report that there are no such numbers:In the decimal representation of $$$s$$$: $$$s &gt; 0$$$, $$$s$$$ consists of $$$n$$$ digits, no digit in $$$s$$$ equals $$$0$$$, $$$s$$$ is not divisible by any of ...
For each test case, print an integer $$$s$$$ which satisfies the conditions described above, or "-1" (without quotes), if no such number exists. If there are multiple possible solutions for $$$s$$$, print any solution.
C
43996d7e052aa628a46d03086f9c5436
299106a32b85669219f6d67f16e2fc72
GNU C11
standard output
256 megabytes
train_002.jsonl
[ "constructive algorithms", "number theory" ]
1584628500
["4\n1\n2\n3\n4"]
NoteIn the first test case, there are no possible solutions for $$$s$$$ consisting of one digit, because any such solution is divisible by itself.For the second test case, the possible solutions are: $$$23$$$, $$$27$$$, $$$29$$$, $$$34$$$, $$$37$$$, $$$38$$$, $$$43$$$, $$$46$$$, $$$47$$$, $$$49$$$, $$$53$$$, $$$54$$$, ...
PASSED
1,000
standard input
1 second
The input consists of multiple test cases. The first line of the input contains a single integer $$$t$$$ ($$$1 \leq t \leq 400$$$), the number of test cases. The next $$$t$$$ lines each describe a test case. Each test case contains one positive integer $$$n$$$ ($$$1 \leq n \leq 10^5$$$). It is guaranteed that the sum o...
["-1\n57\n239\n6789"]
#include<stdio.h> int main() { int t; long long i,j,n; scanf("%d",&t); for(i=0; i<t; i++) { scanf("%I64d",&n); if(n==1) { printf("-1\n"); } else { for(j=0; j<n-1; j++) { printf("3"); } ...
You are given a integer $$$n$$$ ($$$n &gt; 0$$$). Find any integer $$$s$$$ which satisfies these conditions, or report that there are no such numbers:In the decimal representation of $$$s$$$: $$$s &gt; 0$$$, $$$s$$$ consists of $$$n$$$ digits, no digit in $$$s$$$ equals $$$0$$$, $$$s$$$ is not divisible by any of ...
For each test case, print an integer $$$s$$$ which satisfies the conditions described above, or "-1" (without quotes), if no such number exists. If there are multiple possible solutions for $$$s$$$, print any solution.
C
43996d7e052aa628a46d03086f9c5436
f4fc885a0cb376c74dd1ec81f7081e84
GNU C11
standard output
256 megabytes
train_002.jsonl
[ "constructive algorithms", "number theory" ]
1584628500
["4\n1\n2\n3\n4"]
NoteIn the first test case, there are no possible solutions for $$$s$$$ consisting of one digit, because any such solution is divisible by itself.For the second test case, the possible solutions are: $$$23$$$, $$$27$$$, $$$29$$$, $$$34$$$, $$$37$$$, $$$38$$$, $$$43$$$, $$$46$$$, $$$47$$$, $$$49$$$, $$$53$$$, $$$54$$$, ...
PASSED
1,000
standard input
1 second
The input consists of multiple test cases. The first line of the input contains a single integer $$$t$$$ ($$$1 \leq t \leq 400$$$), the number of test cases. The next $$$t$$$ lines each describe a test case. Each test case contains one positive integer $$$n$$$ ($$$1 \leq n \leq 10^5$$$). It is guaranteed that the sum o...
["-1\n57\n239\n6789"]
#include<stdio.h> int main() { int n,i,x,j; scanf("%d",&x); for(j=0;j<x;j++){ scanf("%d",&n); if(n==1){ printf("-1\n"); } else{ printf("2"); for(i=2;i<=n;i++){ printf("7"); } printf("\n"); } } return 0; }
You are given a integer $$$n$$$ ($$$n &gt; 0$$$). Find any integer $$$s$$$ which satisfies these conditions, or report that there are no such numbers:In the decimal representation of $$$s$$$: $$$s &gt; 0$$$, $$$s$$$ consists of $$$n$$$ digits, no digit in $$$s$$$ equals $$$0$$$, $$$s$$$ is not divisible by any of ...
For each test case, print an integer $$$s$$$ which satisfies the conditions described above, or "-1" (without quotes), if no such number exists. If there are multiple possible solutions for $$$s$$$, print any solution.
C
43996d7e052aa628a46d03086f9c5436
83cce3aabf459550f1df6f98bde7fb30
GNU C11
standard output
256 megabytes
train_002.jsonl
[ "constructive algorithms", "number theory" ]
1584628500
["4\n1\n2\n3\n4"]
NoteIn the first test case, there are no possible solutions for $$$s$$$ consisting of one digit, because any such solution is divisible by itself.For the second test case, the possible solutions are: $$$23$$$, $$$27$$$, $$$29$$$, $$$34$$$, $$$37$$$, $$$38$$$, $$$43$$$, $$$46$$$, $$$47$$$, $$$49$$$, $$$53$$$, $$$54$$$, ...
PASSED
1,000
standard input
1 second
The input consists of multiple test cases. The first line of the input contains a single integer $$$t$$$ ($$$1 \leq t \leq 400$$$), the number of test cases. The next $$$t$$$ lines each describe a test case. Each test case contains one positive integer $$$n$$$ ($$$1 \leq n \leq 10^5$$$). It is guaranteed that the sum o...
["-1\n57\n239\n6789"]
#include<stdio.h> int main() { int n,i,x,j; scanf("%d",&x); for(j=0;j<x;j++){ scanf("%d",&n); if(n==1){ printf("-1\n"); } else{ printf("2"); for(i=2;i<=n;i++){ printf("3"); } printf("\n"); } } return 0; }
You are given a integer $$$n$$$ ($$$n &gt; 0$$$). Find any integer $$$s$$$ which satisfies these conditions, or report that there are no such numbers:In the decimal representation of $$$s$$$: $$$s &gt; 0$$$, $$$s$$$ consists of $$$n$$$ digits, no digit in $$$s$$$ equals $$$0$$$, $$$s$$$ is not divisible by any of ...
For each test case, print an integer $$$s$$$ which satisfies the conditions described above, or "-1" (without quotes), if no such number exists. If there are multiple possible solutions for $$$s$$$, print any solution.
C
43996d7e052aa628a46d03086f9c5436
d66b3b3f5ab85744340921c61d237ea6
GNU C11
standard output
256 megabytes
train_002.jsonl
[ "constructive algorithms", "number theory" ]
1584628500
["4\n1\n2\n3\n4"]
NoteIn the first test case, there are no possible solutions for $$$s$$$ consisting of one digit, because any such solution is divisible by itself.For the second test case, the possible solutions are: $$$23$$$, $$$27$$$, $$$29$$$, $$$34$$$, $$$37$$$, $$$38$$$, $$$43$$$, $$$46$$$, $$$47$$$, $$$49$$$, $$$53$$$, $$$54$$$, ...
PASSED
1,000
standard input
1 second
The input consists of multiple test cases. The first line of the input contains a single integer $$$t$$$ ($$$1 \leq t \leq 400$$$), the number of test cases. The next $$$t$$$ lines each describe a test case. Each test case contains one positive integer $$$n$$$ ($$$1 \leq n \leq 10^5$$$). It is guaranteed that the sum o...
["-1\n57\n239\n6789"]
#include<stdio.h> int main() { int n,i,x,j; scanf("%d",&x); for(j=0;j<x;j++){ scanf("%d",&n); if(n==1){ printf("-1\n"); } else{ printf("2"); for(i=2;i<=n;i++){ printf("3"); } printf("\n"); } } return 0; }
You are given a integer $$$n$$$ ($$$n &gt; 0$$$). Find any integer $$$s$$$ which satisfies these conditions, or report that there are no such numbers:In the decimal representation of $$$s$$$: $$$s &gt; 0$$$, $$$s$$$ consists of $$$n$$$ digits, no digit in $$$s$$$ equals $$$0$$$, $$$s$$$ is not divisible by any of ...
For each test case, print an integer $$$s$$$ which satisfies the conditions described above, or "-1" (without quotes), if no such number exists. If there are multiple possible solutions for $$$s$$$, print any solution.
C
43996d7e052aa628a46d03086f9c5436
e4f0f5e26e59abf9d22f7f48632d331e
GNU C11
standard output
256 megabytes
train_002.jsonl
[ "constructive algorithms", "number theory" ]
1584628500
["4\n1\n2\n3\n4"]
NoteIn the first test case, there are no possible solutions for $$$s$$$ consisting of one digit, because any such solution is divisible by itself.For the second test case, the possible solutions are: $$$23$$$, $$$27$$$, $$$29$$$, $$$34$$$, $$$37$$$, $$$38$$$, $$$43$$$, $$$46$$$, $$$47$$$, $$$49$$$, $$$53$$$, $$$54$$$, ...
PASSED
1,000
standard input
1 second
The input consists of multiple test cases. The first line of the input contains a single integer $$$t$$$ ($$$1 \leq t \leq 400$$$), the number of test cases. The next $$$t$$$ lines each describe a test case. Each test case contains one positive integer $$$n$$$ ($$$1 \leq n \leq 10^5$$$). It is guaranteed that the sum o...
["-1\n57\n239\n6789"]
#include <stdio.h> int main() { int t,n; scanf("%d",&t); while(t--) { scanf("%d",&n); if(n==1) printf("-1\n"); else { printf("2"); for(int i=0;i<n-1;i++) printf("3"); puts(""); } } return 0; }
You are given a integer $$$n$$$ ($$$n &gt; 0$$$). Find any integer $$$s$$$ which satisfies these conditions, or report that there are no such numbers:In the decimal representation of $$$s$$$: $$$s &gt; 0$$$, $$$s$$$ consists of $$$n$$$ digits, no digit in $$$s$$$ equals $$$0$$$, $$$s$$$ is not divisible by any of ...
For each test case, print an integer $$$s$$$ which satisfies the conditions described above, or "-1" (without quotes), if no such number exists. If there are multiple possible solutions for $$$s$$$, print any solution.
C
43996d7e052aa628a46d03086f9c5436
3b352edd4aa62a2b7e976fa1692bdb31
GNU C11
standard output
256 megabytes
train_002.jsonl
[ "constructive algorithms", "number theory" ]
1584628500
["4\n1\n2\n3\n4"]
NoteIn the first test case, there are no possible solutions for $$$s$$$ consisting of one digit, because any such solution is divisible by itself.For the second test case, the possible solutions are: $$$23$$$, $$$27$$$, $$$29$$$, $$$34$$$, $$$37$$$, $$$38$$$, $$$43$$$, $$$46$$$, $$$47$$$, $$$49$$$, $$$53$$$, $$$54$$$, ...
PASSED
1,000
standard input
1 second
The input consists of multiple test cases. The first line of the input contains a single integer $$$t$$$ ($$$1 \leq t \leq 400$$$), the number of test cases. The next $$$t$$$ lines each describe a test case. Each test case contains one positive integer $$$n$$$ ($$$1 \leq n \leq 10^5$$$). It is guaranteed that the sum o...
["-1\n57\n239\n6789"]
#include <stdio.h> int main() { int t,n,i; scanf("%d",&t); while(t--) { scanf("%d",&n); if(n==1) printf("-1\n"); else { printf("2"); for(i=0;i<n-1;i++) printf("3"); puts(""); } } return 0; }
You are given a integer $$$n$$$ ($$$n &gt; 0$$$). Find any integer $$$s$$$ which satisfies these conditions, or report that there are no such numbers:In the decimal representation of $$$s$$$: $$$s &gt; 0$$$, $$$s$$$ consists of $$$n$$$ digits, no digit in $$$s$$$ equals $$$0$$$, $$$s$$$ is not divisible by any of ...
For each test case, print an integer $$$s$$$ which satisfies the conditions described above, or "-1" (without quotes), if no such number exists. If there are multiple possible solutions for $$$s$$$, print any solution.
C
43996d7e052aa628a46d03086f9c5436
eb974a9b1074e37bded3f30b66394188
GNU C11
standard output
256 megabytes
train_002.jsonl
[ "constructive algorithms", "number theory" ]
1584628500
["4\n1\n2\n3\n4"]
NoteIn the first test case, there are no possible solutions for $$$s$$$ consisting of one digit, because any such solution is divisible by itself.For the second test case, the possible solutions are: $$$23$$$, $$$27$$$, $$$29$$$, $$$34$$$, $$$37$$$, $$$38$$$, $$$43$$$, $$$46$$$, $$$47$$$, $$$49$$$, $$$53$$$, $$$54$$$, ...
PASSED
1,000
standard input
1 second
The input consists of multiple test cases. The first line of the input contains a single integer $$$t$$$ ($$$1 \leq t \leq 400$$$), the number of test cases. The next $$$t$$$ lines each describe a test case. Each test case contains one positive integer $$$n$$$ ($$$1 \leq n \leq 10^5$$$). It is guaranteed that the sum o...
["-1\n57\n239\n6789"]
#include<stdio.h> int main() { int t,n,i,x,k,m; scanf("%d",&t); while(t--) { scanf("%d",&n); if(n==1) printf("-1\n"); else { n=n-1; printf("2"); while(n--) printf("3"); printf("\n"); } ...
You are given a integer $$$n$$$ ($$$n &gt; 0$$$). Find any integer $$$s$$$ which satisfies these conditions, or report that there are no such numbers:In the decimal representation of $$$s$$$: $$$s &gt; 0$$$, $$$s$$$ consists of $$$n$$$ digits, no digit in $$$s$$$ equals $$$0$$$, $$$s$$$ is not divisible by any of ...
For each test case, print an integer $$$s$$$ which satisfies the conditions described above, or "-1" (without quotes), if no such number exists. If there are multiple possible solutions for $$$s$$$, print any solution.
C
43996d7e052aa628a46d03086f9c5436
ed60151bba0a35a73312f53756c62ba5
GNU C11
standard output
256 megabytes
train_002.jsonl
[ "constructive algorithms", "number theory" ]
1584628500
["4\n1\n2\n3\n4"]
NoteIn the first test case, there are no possible solutions for $$$s$$$ consisting of one digit, because any such solution is divisible by itself.For the second test case, the possible solutions are: $$$23$$$, $$$27$$$, $$$29$$$, $$$34$$$, $$$37$$$, $$$38$$$, $$$43$$$, $$$46$$$, $$$47$$$, $$$49$$$, $$$53$$$, $$$54$$$, ...
PASSED
1,000
standard input
1 second
The input consists of multiple test cases. The first line of the input contains a single integer $$$t$$$ ($$$1 \leq t \leq 400$$$), the number of test cases. The next $$$t$$$ lines each describe a test case. Each test case contains one positive integer $$$n$$$ ($$$1 \leq n \leq 10^5$$$). It is guaranteed that the sum o...
["-1\n57\n239\n6789"]
/*23, 27, 29, 34, 37, 38, 43, 46, 47, 49, 53, 54, 56, 57, 58, 59, 67, 68, 69, 73, 74, 76, 78, 79, 83, 86, 87, 89, 94, 97, and 98. 4 1 2 3 4 -1 57 239 6789*/ #include<stdio.h> int main() { int t; scanf("%d",&t); while(t--) { int n,count=0,i; scanf("%d",&n); if(n==1) pr...
You are given a integer $$$n$$$ ($$$n &gt; 0$$$). Find any integer $$$s$$$ which satisfies these conditions, or report that there are no such numbers:In the decimal representation of $$$s$$$: $$$s &gt; 0$$$, $$$s$$$ consists of $$$n$$$ digits, no digit in $$$s$$$ equals $$$0$$$, $$$s$$$ is not divisible by any of ...
For each test case, print an integer $$$s$$$ which satisfies the conditions described above, or "-1" (without quotes), if no such number exists. If there are multiple possible solutions for $$$s$$$, print any solution.
C
43996d7e052aa628a46d03086f9c5436
3a8f6020155f0110b6f18ba2bb7dec73
GNU C11
standard output
256 megabytes
train_002.jsonl
[ "constructive algorithms", "number theory" ]
1584628500
["4\n1\n2\n3\n4"]
NoteIn the first test case, there are no possible solutions for $$$s$$$ consisting of one digit, because any such solution is divisible by itself.For the second test case, the possible solutions are: $$$23$$$, $$$27$$$, $$$29$$$, $$$34$$$, $$$37$$$, $$$38$$$, $$$43$$$, $$$46$$$, $$$47$$$, $$$49$$$, $$$53$$$, $$$54$$$, ...
PASSED
1,000
standard input
1 second
The input consists of multiple test cases. The first line of the input contains a single integer $$$t$$$ ($$$1 \leq t \leq 400$$$), the number of test cases. The next $$$t$$$ lines each describe a test case. Each test case contains one positive integer $$$n$$$ ($$$1 \leq n \leq 10^5$$$). It is guaranteed that the sum o...
["-1\n57\n239\n6789"]
#include<stdio.h> int main() { int t; scanf("%d",&t); while(t--) { int n,i; scanf("%d",&n); if(n==0||n==1) printf("-1\n"); else { printf("2"); for(i=0; i<n-1; i++) { printf("3"); } ...
You are given a integer $$$n$$$ ($$$n &gt; 0$$$). Find any integer $$$s$$$ which satisfies these conditions, or report that there are no such numbers:In the decimal representation of $$$s$$$: $$$s &gt; 0$$$, $$$s$$$ consists of $$$n$$$ digits, no digit in $$$s$$$ equals $$$0$$$, $$$s$$$ is not divisible by any of ...
For each test case, print an integer $$$s$$$ which satisfies the conditions described above, or "-1" (without quotes), if no such number exists. If there are multiple possible solutions for $$$s$$$, print any solution.
C
43996d7e052aa628a46d03086f9c5436
f99f22f677c236bf544533f4258d0cf5
GNU C11
standard output
256 megabytes
train_002.jsonl
[ "constructive algorithms", "number theory" ]
1584628500
["4\n1\n2\n3\n4"]
NoteIn the first test case, there are no possible solutions for $$$s$$$ consisting of one digit, because any such solution is divisible by itself.For the second test case, the possible solutions are: $$$23$$$, $$$27$$$, $$$29$$$, $$$34$$$, $$$37$$$, $$$38$$$, $$$43$$$, $$$46$$$, $$$47$$$, $$$49$$$, $$$53$$$, $$$54$$$, ...
PASSED
1,000
standard input
1 second
The input consists of multiple test cases. The first line of the input contains a single integer $$$t$$$ ($$$1 \leq t \leq 400$$$), the number of test cases. The next $$$t$$$ lines each describe a test case. Each test case contains one positive integer $$$n$$$ ($$$1 \leq n \leq 10^5$$$). It is guaranteed that the sum o...
["-1\n57\n239\n6789"]
#include<stdio.h> int main() { int t,n,i,j; scanf("%d",&t); for(i=0;i<t;i++) { scanf("%d",&n); if(n==1) { printf("-1\n"); } else { printf("2"); for(j=1;j<n;j++) { ...
You are given a integer $$$n$$$ ($$$n &gt; 0$$$). Find any integer $$$s$$$ which satisfies these conditions, or report that there are no such numbers:In the decimal representation of $$$s$$$: $$$s &gt; 0$$$, $$$s$$$ consists of $$$n$$$ digits, no digit in $$$s$$$ equals $$$0$$$, $$$s$$$ is not divisible by any of ...
For each test case, print an integer $$$s$$$ which satisfies the conditions described above, or "-1" (without quotes), if no such number exists. If there are multiple possible solutions for $$$s$$$, print any solution.
C
43996d7e052aa628a46d03086f9c5436
78a7d2a9e48bfbe4b9cda1deb5cf5064
GNU C11
standard output
256 megabytes
train_002.jsonl
[ "constructive algorithms", "number theory" ]
1584628500
["4\n1\n2\n3\n4"]
NoteIn the first test case, there are no possible solutions for $$$s$$$ consisting of one digit, because any such solution is divisible by itself.For the second test case, the possible solutions are: $$$23$$$, $$$27$$$, $$$29$$$, $$$34$$$, $$$37$$$, $$$38$$$, $$$43$$$, $$$46$$$, $$$47$$$, $$$49$$$, $$$53$$$, $$$54$$$, ...
PASSED
1,000
standard input
1 second
The input consists of multiple test cases. The first line of the input contains a single integer $$$t$$$ ($$$1 \leq t \leq 400$$$), the number of test cases. The next $$$t$$$ lines each describe a test case. Each test case contains one positive integer $$$n$$$ ($$$1 \leq n \leq 10^5$$$). It is guaranteed that the sum o...
["-1\n57\n239\n6789"]
#include<stdio.h> #include<math.h> int comp(const void*a,const void*b) { return *(int*)a-*(int*)b; } #define min(x,y) x<y?x:y #define max(x,y) x>y?x:y int main() { /* int t; scanf("%d",&t); int o; for(o=0;o<t;o++){ char line[50000]; char answer[50000]; scanf("%s",line)...
You are given a integer $$$n$$$ ($$$n &gt; 0$$$). Find any integer $$$s$$$ which satisfies these conditions, or report that there are no such numbers:In the decimal representation of $$$s$$$: $$$s &gt; 0$$$, $$$s$$$ consists of $$$n$$$ digits, no digit in $$$s$$$ equals $$$0$$$, $$$s$$$ is not divisible by any of ...
For each test case, print an integer $$$s$$$ which satisfies the conditions described above, or "-1" (without quotes), if no such number exists. If there are multiple possible solutions for $$$s$$$, print any solution.
C
43996d7e052aa628a46d03086f9c5436
24c42adaa06d128efa2b04b902fa798a
GNU C11
standard output
256 megabytes
train_002.jsonl
[ "constructive algorithms", "number theory" ]
1584628500
["4\n1\n2\n3\n4"]
NoteIn the first test case, there are no possible solutions for $$$s$$$ consisting of one digit, because any such solution is divisible by itself.For the second test case, the possible solutions are: $$$23$$$, $$$27$$$, $$$29$$$, $$$34$$$, $$$37$$$, $$$38$$$, $$$43$$$, $$$46$$$, $$$47$$$, $$$49$$$, $$$53$$$, $$$54$$$, ...
PASSED
1,000
standard input
1 second
The input consists of multiple test cases. The first line of the input contains a single integer $$$t$$$ ($$$1 \leq t \leq 400$$$), the number of test cases. The next $$$t$$$ lines each describe a test case. Each test case contains one positive integer $$$n$$$ ($$$1 \leq n \leq 10^5$$$). It is guaranteed that the sum o...
["-1\n57\n239\n6789"]
#include <stdio.h> #include <math.h> int main() { int t; scanf("%d",&t); while(t--){ int n;scanf("%d",&n); if(n==1)printf("%d\n",-1); else { if((2*n-2)%3==0){ int i;for(i=1;i<=n-2;i++)printf("%d",2);printf("%d\n",43); } else{int i;for(i=1;i<=n-1;i++)printf("%d",2);printf("%d\n",3); } } }...
You are given a integer $$$n$$$ ($$$n &gt; 0$$$). Find any integer $$$s$$$ which satisfies these conditions, or report that there are no such numbers:In the decimal representation of $$$s$$$: $$$s &gt; 0$$$, $$$s$$$ consists of $$$n$$$ digits, no digit in $$$s$$$ equals $$$0$$$, $$$s$$$ is not divisible by any of ...
For each test case, print an integer $$$s$$$ which satisfies the conditions described above, or "-1" (without quotes), if no such number exists. If there are multiple possible solutions for $$$s$$$, print any solution.
C
43996d7e052aa628a46d03086f9c5436
a63b7ea15c3669fe10ba585ba39f6945
GNU C11
standard output
256 megabytes
train_002.jsonl
[ "constructive algorithms", "number theory" ]
1584628500
["4\n1\n2\n3\n4"]
NoteIn the first test case, there are no possible solutions for $$$s$$$ consisting of one digit, because any such solution is divisible by itself.For the second test case, the possible solutions are: $$$23$$$, $$$27$$$, $$$29$$$, $$$34$$$, $$$37$$$, $$$38$$$, $$$43$$$, $$$46$$$, $$$47$$$, $$$49$$$, $$$53$$$, $$$54$$$, ...
PASSED
1,000
standard input
1 second
The input consists of multiple test cases. The first line of the input contains a single integer $$$t$$$ ($$$1 \leq t \leq 400$$$), the number of test cases. The next $$$t$$$ lines each describe a test case. Each test case contains one positive integer $$$n$$$ ($$$1 \leq n \leq 10^5$$$). It is guaranteed that the sum o...
["-1\n57\n239\n6789"]
#include <stdio.h> #include <stdlib.h> /*The idea is just forming a prime number with first number distinct*/ int main(){ int t,n; scanf("%d",&t); while(t--){ scanf("%d",&n); if(n==1) printf("%d\n",-1); else{ printf("%d",2); for(int i=0;i<n-1;i++...
Jamie has recently found undirected weighted graphs with the following properties very interesting: The graph is connected and contains exactly n vertices and m edges. All edge weights are integers and are in range [1, 109] inclusive. The length of shortest path from 1 to n is a prime number. The sum of edges' weig...
In the first line output 2 integers sp, mstw (1 ≤ sp, mstw ≤ 1014) — the length of the shortest path and the sum of edges' weights in the minimum spanning tree. In the next m lines output the edges of the graph. In each line output 3 integers u, v, w (1 ≤ u, v ≤ n, 1 ≤ w ≤ 109) describing the edge connecting u and v an...
C
c0eec5938787a63fce3052b7e209eda3
704b3959f050822b6bf92179f2c4eec0
GNU C11
standard output
256 megabytes
train_002.jsonl
[ "constructive algorithms", "graphs", "shortest paths" ]
1516372500
["4 4", "5 4"]
NoteThe graph of sample 1: Shortest path sequence: {1, 2, 3, 4}. MST edges are marked with an asterisk (*).Definition of terms used in the problem statement:A shortest path in an undirected graph is a sequence of vertices (v1, v2, ... , vk) such that vi is adjacent to vi + 1 1 ≤ i &lt; k and the sum of weight is mini...
PASSED
1,600
standard input
2 seconds
First line of input contains 2 integers n, m  — the required number of vertices and edges.
["7 7\n1 2 3\n2 3 2\n3 4 2\n2 4 4", "7 13\n1 2 2\n1 3 4\n1 4 3\n4 5 4"]
#include <stdio.h> #include <string.h> #include <math.h> #define LL long long int isPrime(int x) { for (int i = 2; i * i <= x; ++i) { if (x % i == 0) return 0; } return 1; } int main() { int n, m; scanf("%d%d", &n, &m); int x = 2 * (n - 1); while (1) { if (!isP...
You are given an integer $$$n$$$. In one move, you can either multiply $$$n$$$ by two or divide $$$n$$$ by $$$6$$$ (if it is divisible by $$$6$$$ without the remainder).Your task is to find the minimum number of moves needed to obtain $$$1$$$ from $$$n$$$ or determine if it's impossible to do that.You have to answer $$...
For each test case, print the answer — the minimum number of moves needed to obtain $$$1$$$ from $$$n$$$ if it's possible to do that or -1 if it's impossible to obtain $$$1$$$ from $$$n$$$.
C
3ae468c425c7b156983414372fd35ab8
8fde073a171f486f5bb4539ddd243e44
GNU C11
standard output
256 megabytes
train_002.jsonl
[ "math" ]
1593354900
["7\n1\n2\n3\n12\n12345\n15116544\n387420489"]
NoteConsider the sixth test case of the example. The answer can be obtained by the following sequence of moves from the given integer $$$15116544$$$: Divide by $$$6$$$ and get $$$2519424$$$; divide by $$$6$$$ and get $$$419904$$$; divide by $$$6$$$ and get $$$69984$$$; divide by $$$6$$$ and get $$$11664$$$; multip...
PASSED
900
standard input
1 second
The first line of the input contains one integer $$$t$$$ ($$$1 \le t \le 2 \cdot 10^4$$$) — the number of test cases. Then $$$t$$$ test cases follow. The only line of the test case contains one integer $$$n$$$ ($$$1 \le n \le 10^9$$$).
["0\n-1\n2\n-1\n-1\n12\n36"]
#include<stdio.h> int main() { int t; scanf("%d",&t); while(t--) { int n,t=0,c=0; scanf("%d",&n); while(n>1) { if(n%6==0) { n/=6; t=0; } else if(t==0) { n*=2; ...
You are given an integer $$$n$$$. In one move, you can either multiply $$$n$$$ by two or divide $$$n$$$ by $$$6$$$ (if it is divisible by $$$6$$$ without the remainder).Your task is to find the minimum number of moves needed to obtain $$$1$$$ from $$$n$$$ or determine if it's impossible to do that.You have to answer $$...
For each test case, print the answer — the minimum number of moves needed to obtain $$$1$$$ from $$$n$$$ if it's possible to do that or -1 if it's impossible to obtain $$$1$$$ from $$$n$$$.
C
3ae468c425c7b156983414372fd35ab8
a51a837564369e2311d74267e55815e1
GNU C11
standard output
256 megabytes
train_002.jsonl
[ "math" ]
1593354900
["7\n1\n2\n3\n12\n12345\n15116544\n387420489"]
NoteConsider the sixth test case of the example. The answer can be obtained by the following sequence of moves from the given integer $$$15116544$$$: Divide by $$$6$$$ and get $$$2519424$$$; divide by $$$6$$$ and get $$$419904$$$; divide by $$$6$$$ and get $$$69984$$$; divide by $$$6$$$ and get $$$11664$$$; multip...
PASSED
900
standard input
1 second
The first line of the input contains one integer $$$t$$$ ($$$1 \le t \le 2 \cdot 10^4$$$) — the number of test cases. Then $$$t$$$ test cases follow. The only line of the test case contains one integer $$$n$$$ ($$$1 \le n \le 10^9$$$).
["0\n-1\n2\n-1\n-1\n12\n36"]
/****************************************************************************** Online C Compiler. Code, Compile, Run and Debug C program online. Write your code in this editor and press "Run" button to compile and execute it. ***********************************************...
You are given an integer $$$n$$$. In one move, you can either multiply $$$n$$$ by two or divide $$$n$$$ by $$$6$$$ (if it is divisible by $$$6$$$ without the remainder).Your task is to find the minimum number of moves needed to obtain $$$1$$$ from $$$n$$$ or determine if it's impossible to do that.You have to answer $$...
For each test case, print the answer — the minimum number of moves needed to obtain $$$1$$$ from $$$n$$$ if it's possible to do that or -1 if it's impossible to obtain $$$1$$$ from $$$n$$$.
C
3ae468c425c7b156983414372fd35ab8
38e1bcf0ed7dc95324b0d19f6fcad269
GNU C11
standard output
256 megabytes
train_002.jsonl
[ "math" ]
1593354900
["7\n1\n2\n3\n12\n12345\n15116544\n387420489"]
NoteConsider the sixth test case of the example. The answer can be obtained by the following sequence of moves from the given integer $$$15116544$$$: Divide by $$$6$$$ and get $$$2519424$$$; divide by $$$6$$$ and get $$$419904$$$; divide by $$$6$$$ and get $$$69984$$$; divide by $$$6$$$ and get $$$11664$$$; multip...
PASSED
900
standard input
1 second
The first line of the input contains one integer $$$t$$$ ($$$1 \le t \le 2 \cdot 10^4$$$) — the number of test cases. Then $$$t$$$ test cases follow. The only line of the test case contains one integer $$$n$$$ ($$$1 \le n \le 10^9$$$).
["0\n-1\n2\n-1\n-1\n12\n36"]
#include <stdio.h> #include <limits.h> long long int z = 0; int main() { int t ; scanf("%d",&t); while(t--){ long long int r; scanf("%lld",&r); z = 0; while(r!=1){ if(r%6==0) {r = r/6;z++; }else {r = r*2;z++;} if(z>=800){printf("-1\n");break;} } ...
You are given an integer $$$n$$$. In one move, you can either multiply $$$n$$$ by two or divide $$$n$$$ by $$$6$$$ (if it is divisible by $$$6$$$ without the remainder).Your task is to find the minimum number of moves needed to obtain $$$1$$$ from $$$n$$$ or determine if it's impossible to do that.You have to answer $$...
For each test case, print the answer — the minimum number of moves needed to obtain $$$1$$$ from $$$n$$$ if it's possible to do that or -1 if it's impossible to obtain $$$1$$$ from $$$n$$$.
C
3ae468c425c7b156983414372fd35ab8
18f929d2753c205f01bc4e6376d9d4b0
GNU C11
standard output
256 megabytes
train_002.jsonl
[ "math" ]
1593354900
["7\n1\n2\n3\n12\n12345\n15116544\n387420489"]
NoteConsider the sixth test case of the example. The answer can be obtained by the following sequence of moves from the given integer $$$15116544$$$: Divide by $$$6$$$ and get $$$2519424$$$; divide by $$$6$$$ and get $$$419904$$$; divide by $$$6$$$ and get $$$69984$$$; divide by $$$6$$$ and get $$$11664$$$; multip...
PASSED
900
standard input
1 second
The first line of the input contains one integer $$$t$$$ ($$$1 \le t \le 2 \cdot 10^4$$$) — the number of test cases. Then $$$t$$$ test cases follow. The only line of the test case contains one integer $$$n$$$ ($$$1 \le n \le 10^9$$$).
["0\n-1\n2\n-1\n-1\n12\n36"]
#include<stdio.h> int main(){long long int t,i,n,k,a1,a2,a3; scanf("%lld",&t); for(i=0;i<t;i++) { scanf("%lld",&n); k=n; a2=0; a3=0; a1=0; while(k%2==0) { k=k/2; a2++; } while(k>1) { if(k%3=...
You are given an integer $$$n$$$. In one move, you can either multiply $$$n$$$ by two or divide $$$n$$$ by $$$6$$$ (if it is divisible by $$$6$$$ without the remainder).Your task is to find the minimum number of moves needed to obtain $$$1$$$ from $$$n$$$ or determine if it's impossible to do that.You have to answer $$...
For each test case, print the answer — the minimum number of moves needed to obtain $$$1$$$ from $$$n$$$ if it's possible to do that or -1 if it's impossible to obtain $$$1$$$ from $$$n$$$.
C
3ae468c425c7b156983414372fd35ab8
605c82cfcf6dafc5bcb6ada1dd3f7ab0
GNU C11
standard output
256 megabytes
train_002.jsonl
[ "math" ]
1593354900
["7\n1\n2\n3\n12\n12345\n15116544\n387420489"]
NoteConsider the sixth test case of the example. The answer can be obtained by the following sequence of moves from the given integer $$$15116544$$$: Divide by $$$6$$$ and get $$$2519424$$$; divide by $$$6$$$ and get $$$419904$$$; divide by $$$6$$$ and get $$$69984$$$; divide by $$$6$$$ and get $$$11664$$$; multip...
PASSED
900
standard input
1 second
The first line of the input contains one integer $$$t$$$ ($$$1 \le t \le 2 \cdot 10^4$$$) — the number of test cases. Then $$$t$$$ test cases follow. The only line of the test case contains one integer $$$n$$$ ($$$1 \le n \le 10^9$$$).
["0\n-1\n2\n-1\n-1\n12\n36"]
#include<stdio.h> #include<stdlib.h> int main() { int t; scanf("%d",&t); while(t--) { int count=0,n,flag=0; scanf("%d",&n); if(n==1) printf("0\n"); else { if(n%3!=0) printf("-1\n"); else { while(n%3==0)...
You are given an integer $$$n$$$. In one move, you can either multiply $$$n$$$ by two or divide $$$n$$$ by $$$6$$$ (if it is divisible by $$$6$$$ without the remainder).Your task is to find the minimum number of moves needed to obtain $$$1$$$ from $$$n$$$ or determine if it's impossible to do that.You have to answer $$...
For each test case, print the answer — the minimum number of moves needed to obtain $$$1$$$ from $$$n$$$ if it's possible to do that or -1 if it's impossible to obtain $$$1$$$ from $$$n$$$.
C
3ae468c425c7b156983414372fd35ab8
b57ce6fd77cdacc513cd3b4797c41bce
GNU C11
standard output
256 megabytes
train_002.jsonl
[ "math" ]
1593354900
["7\n1\n2\n3\n12\n12345\n15116544\n387420489"]
NoteConsider the sixth test case of the example. The answer can be obtained by the following sequence of moves from the given integer $$$15116544$$$: Divide by $$$6$$$ and get $$$2519424$$$; divide by $$$6$$$ and get $$$419904$$$; divide by $$$6$$$ and get $$$69984$$$; divide by $$$6$$$ and get $$$11664$$$; multip...
PASSED
900
standard input
1 second
The first line of the input contains one integer $$$t$$$ ($$$1 \le t \le 2 \cdot 10^4$$$) — the number of test cases. Then $$$t$$$ test cases follow. The only line of the test case contains one integer $$$n$$$ ($$$1 \le n \le 10^9$$$).
["0\n-1\n2\n-1\n-1\n12\n36"]
#include <assert.h> #include <ctype.h> #include <limits.h> #include <math.h> #include <stdbool.h> #include <stddef.h> #include <stdint.h> #include <stdio.h> #include <stdlib.h> #include <string.h> #include<strings.h> int main() { long int n,i=0,t; scanf("%ld",&t); while(t>0) { i=0; scanf("%ld",&n); while(n!=1)...
You are given an integer $$$n$$$. In one move, you can either multiply $$$n$$$ by two or divide $$$n$$$ by $$$6$$$ (if it is divisible by $$$6$$$ without the remainder).Your task is to find the minimum number of moves needed to obtain $$$1$$$ from $$$n$$$ or determine if it's impossible to do that.You have to answer $$...
For each test case, print the answer — the minimum number of moves needed to obtain $$$1$$$ from $$$n$$$ if it's possible to do that or -1 if it's impossible to obtain $$$1$$$ from $$$n$$$.
C
3ae468c425c7b156983414372fd35ab8
fa261624066c2e57d0d14e4575f01cac
GNU C11
standard output
256 megabytes
train_002.jsonl
[ "math" ]
1593354900
["7\n1\n2\n3\n12\n12345\n15116544\n387420489"]
NoteConsider the sixth test case of the example. The answer can be obtained by the following sequence of moves from the given integer $$$15116544$$$: Divide by $$$6$$$ and get $$$2519424$$$; divide by $$$6$$$ and get $$$419904$$$; divide by $$$6$$$ and get $$$69984$$$; divide by $$$6$$$ and get $$$11664$$$; multip...
PASSED
900
standard input
1 second
The first line of the input contains one integer $$$t$$$ ($$$1 \le t \le 2 \cdot 10^4$$$) — the number of test cases. Then $$$t$$$ test cases follow. The only line of the test case contains one integer $$$n$$$ ($$$1 \le n \le 10^9$$$).
["0\n-1\n2\n-1\n-1\n12\n36"]
#include <stdio.h> int ctr; int func(int n); void main(){ int t,n; scanf("%d",&t); while (t>0){ t--; ctr = 0; scanf("%d",&n); printf("%d\n",func(n)); } } int func(int n){ if (n<6){ if (n==1 ){ return ctr; } else if (n==3){ ...
You are given an integer $$$n$$$. In one move, you can either multiply $$$n$$$ by two or divide $$$n$$$ by $$$6$$$ (if it is divisible by $$$6$$$ without the remainder).Your task is to find the minimum number of moves needed to obtain $$$1$$$ from $$$n$$$ or determine if it's impossible to do that.You have to answer $$...
For each test case, print the answer — the minimum number of moves needed to obtain $$$1$$$ from $$$n$$$ if it's possible to do that or -1 if it's impossible to obtain $$$1$$$ from $$$n$$$.
C
3ae468c425c7b156983414372fd35ab8
da57fbab24f8419bfd0ffb97828f922b
GNU C11
standard output
256 megabytes
train_002.jsonl
[ "math" ]
1593354900
["7\n1\n2\n3\n12\n12345\n15116544\n387420489"]
NoteConsider the sixth test case of the example. The answer can be obtained by the following sequence of moves from the given integer $$$15116544$$$: Divide by $$$6$$$ and get $$$2519424$$$; divide by $$$6$$$ and get $$$419904$$$; divide by $$$6$$$ and get $$$69984$$$; divide by $$$6$$$ and get $$$11664$$$; multip...
PASSED
900
standard input
1 second
The first line of the input contains one integer $$$t$$$ ($$$1 \le t \le 2 \cdot 10^4$$$) — the number of test cases. Then $$$t$$$ test cases follow. The only line of the test case contains one integer $$$n$$$ ($$$1 \le n \le 10^9$$$).
["0\n-1\n2\n-1\n-1\n12\n36"]
#include <stdio.h> #include<math.h> void mergeinc(long int arr[],long int l,long int m,long int r) { long int i, j, k; long int n1 = m - l + 1; long int n2 = r - m; /* create temp arrays */ long int L[n1], R[n2]; /* Copy data to temp arrays L[] and R[] */ for (i = 0; i < n1; i...
You are given an integer $$$n$$$. In one move, you can either multiply $$$n$$$ by two or divide $$$n$$$ by $$$6$$$ (if it is divisible by $$$6$$$ without the remainder).Your task is to find the minimum number of moves needed to obtain $$$1$$$ from $$$n$$$ or determine if it's impossible to do that.You have to answer $$...
For each test case, print the answer — the minimum number of moves needed to obtain $$$1$$$ from $$$n$$$ if it's possible to do that or -1 if it's impossible to obtain $$$1$$$ from $$$n$$$.
C
3ae468c425c7b156983414372fd35ab8
300b837eec73d9d5b1a41c7c481cb866
GNU C11
standard output
256 megabytes
train_002.jsonl
[ "math" ]
1593354900
["7\n1\n2\n3\n12\n12345\n15116544\n387420489"]
NoteConsider the sixth test case of the example. The answer can be obtained by the following sequence of moves from the given integer $$$15116544$$$: Divide by $$$6$$$ and get $$$2519424$$$; divide by $$$6$$$ and get $$$419904$$$; divide by $$$6$$$ and get $$$69984$$$; divide by $$$6$$$ and get $$$11664$$$; multip...
PASSED
900
standard input
1 second
The first line of the input contains one integer $$$t$$$ ($$$1 \le t \le 2 \cdot 10^4$$$) — the number of test cases. Then $$$t$$$ test cases follow. The only line of the test case contains one integer $$$n$$$ ($$$1 \le n \le 10^9$$$).
["0\n-1\n2\n-1\n-1\n12\n36"]
#include<stdio.h> int main() { int t; scanf("%d",&t); long long int n; int i,j,k; for(i=0; i<t; i++){ scanf("%lld",&n); int val=0; int cal=0; int huda=0; if(n==1){ printf("0\n"); } else{ for(j=0; j<=100 ;j++){ if...