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 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
According to the regulations of Berland's army, a reconnaissance unit should consist of exactly two soldiers. Since these two soldiers shouldn't differ much, their heights can differ by at most d centimeters. Captain Bob has n soldiers in his detachment. Their heights are a1, a2, ..., an centimeters. Some soldiers are ... | Output one number — amount of ways to form a reconnaissance unit of two soldiers, whose height difference doesn't exceed d. | C | d7381f73ee29c9b89671f21cafee12e7 | 47bd8b52dd8be952dc26290394717328 | GNU C11 | standard output | 256 megabytes | train_002.jsonl | [
"brute force"
] | 1286002800 | ["5 10\n10 20 50 60 65", "5 1\n55 30 29 31 55"] | null | PASSED | 800 | standard input | 2 seconds | The first line contains two integers n and d (1 ≤ n ≤ 1000, 1 ≤ d ≤ 109) — amount of soldiers in Bob's detachment and the maximum allowed height difference respectively. The second line contains n space-separated integers — heights of all the soldiers in Bob's detachment. These numbers don't exceed 109. | ["6", "6"] | #include <stdio.h>
#include <math.h>
int a[1001],n,i,j, count, d;
int main()
{
scanf("%d %d", &n, &d);
for (i = 1; i <= n; i++)
scanf("%d", &a[i]);
for (i = 1; i < n; i++)
for (j = 1 + i; j <= n; j++)
if (abs(a[j] - a[i]) <= d) count+=2;
printf("%d", count);
} | |
According to the regulations of Berland's army, a reconnaissance unit should consist of exactly two soldiers. Since these two soldiers shouldn't differ much, their heights can differ by at most d centimeters. Captain Bob has n soldiers in his detachment. Their heights are a1, a2, ..., an centimeters. Some soldiers are ... | Output one number — amount of ways to form a reconnaissance unit of two soldiers, whose height difference doesn't exceed d. | C | d7381f73ee29c9b89671f21cafee12e7 | b12dddbf25be9e20bb8072a8f52be4cb | GNU C11 | standard output | 256 megabytes | train_002.jsonl | [
"brute force"
] | 1286002800 | ["5 10\n10 20 50 60 65", "5 1\n55 30 29 31 55"] | null | PASSED | 800 | standard input | 2 seconds | The first line contains two integers n and d (1 ≤ n ≤ 1000, 1 ≤ d ≤ 109) — amount of soldiers in Bob's detachment and the maximum allowed height difference respectively. The second line contains n space-separated integers — heights of all the soldiers in Bob's detachment. These numbers don't exceed 109. | ["6", "6"] | #include<stdio.h>
int main()
{
long long n,d,i;
scanf("%lld%lld",&n,&d);
long long a[n];
for(i=0;i<n;i++)
scanf("%lld",&a[i]);
long long j,c=0;
for(i=0;i<n;i++)
{
for(j=i+1;j<n;j++)
{
if(a[i]>a[j])
{
if(a[i]-a[j]<=d)
... | |
According to the regulations of Berland's army, a reconnaissance unit should consist of exactly two soldiers. Since these two soldiers shouldn't differ much, their heights can differ by at most d centimeters. Captain Bob has n soldiers in his detachment. Their heights are a1, a2, ..., an centimeters. Some soldiers are ... | Output one number — amount of ways to form a reconnaissance unit of two soldiers, whose height difference doesn't exceed d. | C | d7381f73ee29c9b89671f21cafee12e7 | 76823f8ca7a4891ccf8697c653e5b5d2 | GNU C11 | standard output | 256 megabytes | train_002.jsonl | [
"brute force"
] | 1286002800 | ["5 10\n10 20 50 60 65", "5 1\n55 30 29 31 55"] | null | PASSED | 800 | standard input | 2 seconds | The first line contains two integers n and d (1 ≤ n ≤ 1000, 1 ≤ d ≤ 109) — amount of soldiers in Bob's detachment and the maximum allowed height difference respectively. The second line contains n space-separated integers — heights of all the soldiers in Bob's detachment. These numbers don't exceed 109. | ["6", "6"] | #include<stdio.h>
long d;
int n,diff,ctd=0;
int main()
{
scanf("%d %ld",&n,&d);
int a[n];
for(int i=0;i<n;i++)
{
scanf(" %d",&a[i]);
}
for(int i=0;i<n;i++)
{
for(int j=0;j<n;j++)
{
diff=(a[i]-a[j])>0?(a[i]-a[j]):(a[j]-a[i]);
if((i!=j)&&(diff<=d))
{
ctd++;
}
}
}
printf("%d",ctd);
}
| |
According to the regulations of Berland's army, a reconnaissance unit should consist of exactly two soldiers. Since these two soldiers shouldn't differ much, their heights can differ by at most d centimeters. Captain Bob has n soldiers in his detachment. Their heights are a1, a2, ..., an centimeters. Some soldiers are ... | Output one number — amount of ways to form a reconnaissance unit of two soldiers, whose height difference doesn't exceed d. | C | d7381f73ee29c9b89671f21cafee12e7 | a6ef0fb74c9009d583560da2df5b337c | GNU C11 | standard output | 256 megabytes | train_002.jsonl | [
"brute force"
] | 1286002800 | ["5 10\n10 20 50 60 65", "5 1\n55 30 29 31 55"] | null | PASSED | 800 | standard input | 2 seconds | The first line contains two integers n and d (1 ≤ n ≤ 1000, 1 ≤ d ≤ 109) — amount of soldiers in Bob's detachment and the maximum allowed height difference respectively. The second line contains n space-separated integers — heights of all the soldiers in Bob's detachment. These numbers don't exceed 109. | ["6", "6"] | #include<stdio.h>
int rec_for(int a[],int,int);
int main()
{
int n;long d;
scanf("%d%lu",&n,&d);
int a[n];
for(int i=0;i<n;i++){
scanf("%d",&a[i]);
}
int c=rec_for(a,n,d);
printf("%d",c);
return 0;
}
int rec_for(int a[],int n,int d){
int f=0;
for(int i=0;i<n;i++){
for(int j=i+1;j<n;j++){
if(a[j]-a[i]... | |
According to the regulations of Berland's army, a reconnaissance unit should consist of exactly two soldiers. Since these two soldiers shouldn't differ much, their heights can differ by at most d centimeters. Captain Bob has n soldiers in his detachment. Their heights are a1, a2, ..., an centimeters. Some soldiers are ... | Output one number — amount of ways to form a reconnaissance unit of two soldiers, whose height difference doesn't exceed d. | C | d7381f73ee29c9b89671f21cafee12e7 | 9043ccb801d094e56c91c5a7d0bf616b | GNU C11 | standard output | 256 megabytes | train_002.jsonl | [
"brute force"
] | 1286002800 | ["5 10\n10 20 50 60 65", "5 1\n55 30 29 31 55"] | null | PASSED | 800 | standard input | 2 seconds | The first line contains two integers n and d (1 ≤ n ≤ 1000, 1 ≤ d ≤ 109) — amount of soldiers in Bob's detachment and the maximum allowed height difference respectively. The second line contains n space-separated integers — heights of all the soldiers in Bob's detachment. These numbers don't exceed 109. | ["6", "6"] | #include<stdio.h>
int main()
{
int n,d,a[1001],i,j,c=0;
scanf("%d%d",&n,&d);
for(i=0;i<n;i++)scanf("%d",&a[ i ]);
for(i=0;i<n;i++)
{
for(j=i+1;j<n;j++)
{
if(abs(a[ i ]-a[ j ]) <= d)c++;
}
}
printf("%d",c+c);
}
| |
According to the regulations of Berland's army, a reconnaissance unit should consist of exactly two soldiers. Since these two soldiers shouldn't differ much, their heights can differ by at most d centimeters. Captain Bob has n soldiers in his detachment. Their heights are a1, a2, ..., an centimeters. Some soldiers are ... | Output one number — amount of ways to form a reconnaissance unit of two soldiers, whose height difference doesn't exceed d. | C | d7381f73ee29c9b89671f21cafee12e7 | b31015d36f9cba2b66726e67c4da5653 | GNU C11 | standard output | 256 megabytes | train_002.jsonl | [
"brute force"
] | 1286002800 | ["5 10\n10 20 50 60 65", "5 1\n55 30 29 31 55"] | null | PASSED | 800 | standard input | 2 seconds | The first line contains two integers n and d (1 ≤ n ≤ 1000, 1 ≤ d ≤ 109) — amount of soldiers in Bob's detachment and the maximum allowed height difference respectively. The second line contains n space-separated integers — heights of all the soldiers in Bob's detachment. These numbers don't exceed 109. | ["6", "6"] | #include <stdio.h>
int main()
{
int n,m,i,j,x=0;
scanf("%d%d",&n,&m);
int a[n];
for(i=0;i<n;i++)
scanf("%d",&a[i]);
for(i=0;i<n;i++)
{
for(j=0;j<n;j++)
{
if(i!=j)
{
if(a[i]>=a[j]&&a[i]-a[j]<=m)
x++;
... | |
According to the regulations of Berland's army, a reconnaissance unit should consist of exactly two soldiers. Since these two soldiers shouldn't differ much, their heights can differ by at most d centimeters. Captain Bob has n soldiers in his detachment. Their heights are a1, a2, ..., an centimeters. Some soldiers are ... | Output one number — amount of ways to form a reconnaissance unit of two soldiers, whose height difference doesn't exceed d. | C | d7381f73ee29c9b89671f21cafee12e7 | 6e75e471cda14a6cd1853143297bfbb5 | GNU C11 | standard output | 256 megabytes | train_002.jsonl | [
"brute force"
] | 1286002800 | ["5 10\n10 20 50 60 65", "5 1\n55 30 29 31 55"] | null | PASSED | 800 | standard input | 2 seconds | The first line contains two integers n and d (1 ≤ n ≤ 1000, 1 ≤ d ≤ 109) — amount of soldiers in Bob's detachment and the maximum allowed height difference respectively. The second line contains n space-separated integers — heights of all the soldiers in Bob's detachment. These numbers don't exceed 109. | ["6", "6"] | #include<stdio.h>
int main()
{int n,i,j,temp,count=0;
long long int d;
scanf("%d%lld",&n,&d);
int a[n];
for(i=0;i<n;i++)
{scanf("%d",&a[i]);
}
for(i=0;i<n;i++)
{for(j=0;j<n;j++)
{ if(i!=j)
{if((a[i]-a[j])<=d&&(a[i]-a[j])>=(-d))
count++;
}
}
}
printf("%d... | |
According to the regulations of Berland's army, a reconnaissance unit should consist of exactly two soldiers. Since these two soldiers shouldn't differ much, their heights can differ by at most d centimeters. Captain Bob has n soldiers in his detachment. Their heights are a1, a2, ..., an centimeters. Some soldiers are ... | Output one number — amount of ways to form a reconnaissance unit of two soldiers, whose height difference doesn't exceed d. | C | d7381f73ee29c9b89671f21cafee12e7 | 8814399ce99842b352c402fa2cb729d0 | GNU C11 | standard output | 256 megabytes | train_002.jsonl | [
"brute force"
] | 1286002800 | ["5 10\n10 20 50 60 65", "5 1\n55 30 29 31 55"] | null | PASSED | 800 | standard input | 2 seconds | The first line contains two integers n and d (1 ≤ n ≤ 1000, 1 ≤ d ≤ 109) — amount of soldiers in Bob's detachment and the maximum allowed height difference respectively. The second line contains n space-separated integers — heights of all the soldiers in Bob's detachment. These numbers don't exceed 109. | ["6", "6"] | #include<stdio.h>
int main()
{int n,i,j,temp,count=0;
long long int d;
scanf("%d%lld",&n,&d);
int a[n];
for(i=0;i<n;i++)
{scanf("%d",&a[i]);
}
for(i=0;i<n;i++)
{for(j=0;j<n;j++)
{ if(i!=j)
{if((a[i]-a[j])<=d&&(a[i]-a[j])>=(-d))
count++;
}
}
}
printf("%d... | |
According to the regulations of Berland's army, a reconnaissance unit should consist of exactly two soldiers. Since these two soldiers shouldn't differ much, their heights can differ by at most d centimeters. Captain Bob has n soldiers in his detachment. Their heights are a1, a2, ..., an centimeters. Some soldiers are ... | Output one number — amount of ways to form a reconnaissance unit of two soldiers, whose height difference doesn't exceed d. | C | d7381f73ee29c9b89671f21cafee12e7 | 8769df52fda8ad52dabe25ec7c165997 | GNU C11 | standard output | 256 megabytes | train_002.jsonl | [
"brute force"
] | 1286002800 | ["5 10\n10 20 50 60 65", "5 1\n55 30 29 31 55"] | null | PASSED | 800 | standard input | 2 seconds | The first line contains two integers n and d (1 ≤ n ≤ 1000, 1 ≤ d ≤ 109) — amount of soldiers in Bob's detachment and the maximum allowed height difference respectively. The second line contains n space-separated integers — heights of all the soldiers in Bob's detachment. These numbers don't exceed 109. | ["6", "6"] | #include <stdio.h>
#include <math.h>
int main()
{
int n, d, i, j, t=0, a[10001];
scanf("%d %d", &n, &d);
for(i=0; i<n; i++)
{
scanf("%d", &a[i]);
}
for(i=0; i<n; i++)
{
for(j=0; j<n; j++)
{
if((abs(a[i] - a[j])) <= d)
t++;
}
}... | |
According to the regulations of Berland's army, a reconnaissance unit should consist of exactly two soldiers. Since these two soldiers shouldn't differ much, their heights can differ by at most d centimeters. Captain Bob has n soldiers in his detachment. Their heights are a1, a2, ..., an centimeters. Some soldiers are ... | Output one number — amount of ways to form a reconnaissance unit of two soldiers, whose height difference doesn't exceed d. | C | d7381f73ee29c9b89671f21cafee12e7 | c8c473c3ada54a16fc8a0ac806a82cb9 | GNU C11 | standard output | 256 megabytes | train_002.jsonl | [
"brute force"
] | 1286002800 | ["5 10\n10 20 50 60 65", "5 1\n55 30 29 31 55"] | null | PASSED | 800 | standard input | 2 seconds | The first line contains two integers n and d (1 ≤ n ≤ 1000, 1 ≤ d ≤ 109) — amount of soldiers in Bob's detachment and the maximum allowed height difference respectively. The second line contains n space-separated integers — heights of all the soldiers in Bob's detachment. These numbers don't exceed 109. | ["6", "6"] | #include<stdio.h>
#include<string.h>
int main(){
int n,d,i,j,c=0;
scanf("%d%d",&n,&d);
int a[n+1];
for(i=0;i<n;i++){
scanf("%d",&a[i]);
}
for(i=0;i<n-1;i++){
for(j=i+1;j<n;j++){
if(abs(a[i]-a[j])<=d){
c+=2;
}
}
}
printf("%d"... | |
According to the regulations of Berland's army, a reconnaissance unit should consist of exactly two soldiers. Since these two soldiers shouldn't differ much, their heights can differ by at most d centimeters. Captain Bob has n soldiers in his detachment. Their heights are a1, a2, ..., an centimeters. Some soldiers are ... | Output one number — amount of ways to form a reconnaissance unit of two soldiers, whose height difference doesn't exceed d. | C | d7381f73ee29c9b89671f21cafee12e7 | 04ef0769d955d80c19d433085decc3b5 | GNU C11 | standard output | 256 megabytes | train_002.jsonl | [
"brute force"
] | 1286002800 | ["5 10\n10 20 50 60 65", "5 1\n55 30 29 31 55"] | null | PASSED | 800 | standard input | 2 seconds | The first line contains two integers n and d (1 ≤ n ≤ 1000, 1 ≤ d ≤ 109) — amount of soldiers in Bob's detachment and the maximum allowed height difference respectively. The second line contains n space-separated integers — heights of all the soldiers in Bob's detachment. These numbers don't exceed 109. | ["6", "6"] | #include<stdio.h>
int main()
{
int n,d,i,j,s=0;
scanf("%d %d",&n,&d);
int arr[n];
for(i=0;i<n;i++)
scanf("%d",&arr[i]);
for(i=0;i<n-1;i++)
{
for(j=i+1;j<n;j++)
{
if(arr[i]-arr[j]<=d && arr[i]-arr[j]>=-d)
s=s+2;
}
}
prin... | |
According to the regulations of Berland's army, a reconnaissance unit should consist of exactly two soldiers. Since these two soldiers shouldn't differ much, their heights can differ by at most d centimeters. Captain Bob has n soldiers in his detachment. Their heights are a1, a2, ..., an centimeters. Some soldiers are ... | Output one number — amount of ways to form a reconnaissance unit of two soldiers, whose height difference doesn't exceed d. | C | d7381f73ee29c9b89671f21cafee12e7 | c216cb6653756ceedd900bbdfe682650 | GNU C11 | standard output | 256 megabytes | train_002.jsonl | [
"brute force"
] | 1286002800 | ["5 10\n10 20 50 60 65", "5 1\n55 30 29 31 55"] | null | PASSED | 800 | standard input | 2 seconds | The first line contains two integers n and d (1 ≤ n ≤ 1000, 1 ≤ d ≤ 109) — amount of soldiers in Bob's detachment and the maximum allowed height difference respectively. The second line contains n space-separated integers — heights of all the soldiers in Bob's detachment. These numbers don't exceed 109. | ["6", "6"] | #include<stdio.h>
int mod(int);
int main()
{
int n,diff,i,j,count=0,temp;
scanf("%d%d",&n,&diff);
int a[n];
for(i=0;i<n;i++)
{
scanf("%d",&a[i]);
}
for(i=0;i<n;i++)
{
for(j=0;j<n,i!=j;j++)
{
temp=mod(a[i]-a[j]);
if(temp<=diff)
{
count++;
}
}
}
printf("%d",2*count);
return 0;
}
int mo... | |
According to the regulations of Berland's army, a reconnaissance unit should consist of exactly two soldiers. Since these two soldiers shouldn't differ much, their heights can differ by at most d centimeters. Captain Bob has n soldiers in his detachment. Their heights are a1, a2, ..., an centimeters. Some soldiers are ... | Output one number — amount of ways to form a reconnaissance unit of two soldiers, whose height difference doesn't exceed d. | C | d7381f73ee29c9b89671f21cafee12e7 | ccb9024ab36162b39b5010b465928fe4 | GNU C11 | standard output | 256 megabytes | train_002.jsonl | [
"brute force"
] | 1286002800 | ["5 10\n10 20 50 60 65", "5 1\n55 30 29 31 55"] | null | PASSED | 800 | standard input | 2 seconds | The first line contains two integers n and d (1 ≤ n ≤ 1000, 1 ≤ d ≤ 109) — amount of soldiers in Bob's detachment and the maximum allowed height difference respectively. The second line contains n space-separated integers — heights of all the soldiers in Bob's detachment. These numbers don't exceed 109. | ["6", "6"] | #include<stdio.h>
#include<math.h>
int soldiers[1000];
int main()
{
int n, d, units = 0;
scanf("%d %d", &n, &d);
for(int i = 0; i < n; i++)
scanf("%d", &soldiers[i]);
for(int i = 0; i < n; i++)
{
for(int j = 0; j < n; j++)
{
if(i == j) ;
else if(abs(so... | |
According to the regulations of Berland's army, a reconnaissance unit should consist of exactly two soldiers. Since these two soldiers shouldn't differ much, their heights can differ by at most d centimeters. Captain Bob has n soldiers in his detachment. Their heights are a1, a2, ..., an centimeters. Some soldiers are ... | Output one number — amount of ways to form a reconnaissance unit of two soldiers, whose height difference doesn't exceed d. | C | d7381f73ee29c9b89671f21cafee12e7 | 4d9e6d72714f662dc306d86a3f70c709 | GNU C11 | standard output | 256 megabytes | train_002.jsonl | [
"brute force"
] | 1286002800 | ["5 10\n10 20 50 60 65", "5 1\n55 30 29 31 55"] | null | PASSED | 800 | standard input | 2 seconds | The first line contains two integers n and d (1 ≤ n ≤ 1000, 1 ≤ d ≤ 109) — amount of soldiers in Bob's detachment and the maximum allowed height difference respectively. The second line contains n space-separated integers — heights of all the soldiers in Bob's detachment. These numbers don't exceed 109. | ["6", "6"] | #include <stdio.h>
#define MAX 1000
#define F(i,a,b) for(int i=a;i<b;i++)
#define ll long long int
#define sf(i) scanf("%d",&A[i])
int main() {
int n,d,A[MAX],x;
ll ans=0;
scanf("%d %d",&n,&d);
F(i,0,n) {
sf(i);
}
F(i,0,n-1) {
F(j,i+1,n) {
x = abs(A[j... | |
According to the regulations of Berland's army, a reconnaissance unit should consist of exactly two soldiers. Since these two soldiers shouldn't differ much, their heights can differ by at most d centimeters. Captain Bob has n soldiers in his detachment. Their heights are a1, a2, ..., an centimeters. Some soldiers are ... | Output one number — amount of ways to form a reconnaissance unit of two soldiers, whose height difference doesn't exceed d. | C | d7381f73ee29c9b89671f21cafee12e7 | ed9eaa19875abde15b98a598934e2e02 | GNU C11 | standard output | 256 megabytes | train_002.jsonl | [
"brute force"
] | 1286002800 | ["5 10\n10 20 50 60 65", "5 1\n55 30 29 31 55"] | null | PASSED | 800 | standard input | 2 seconds | The first line contains two integers n and d (1 ≤ n ≤ 1000, 1 ≤ d ≤ 109) — amount of soldiers in Bob's detachment and the maximum allowed height difference respectively. The second line contains n space-separated integers — heights of all the soldiers in Bob's detachment. These numbers don't exceed 109. | ["6", "6"] | #include<stdio.h>
int main()
{
long long int n,d,i,j,k,a[1001],t=0;
scanf("%I64d %I64d",&n,&d);
for(i=0;i<n;i++){
scanf("%I64d",&a[i]);
}
for(i=0;i<n;i++){
for(j=0;j<n;j++){
if(i!=j){
if(abs(a[i]-a[j])<=d){
t++;
}
... | |
According to the regulations of Berland's army, a reconnaissance unit should consist of exactly two soldiers. Since these two soldiers shouldn't differ much, their heights can differ by at most d centimeters. Captain Bob has n soldiers in his detachment. Their heights are a1, a2, ..., an centimeters. Some soldiers are ... | Output one number — amount of ways to form a reconnaissance unit of two soldiers, whose height difference doesn't exceed d. | C | d7381f73ee29c9b89671f21cafee12e7 | 0b58b3ed9192f3ce97f7fb419129e815 | GNU C11 | standard output | 256 megabytes | train_002.jsonl | [
"brute force"
] | 1286002800 | ["5 10\n10 20 50 60 65", "5 1\n55 30 29 31 55"] | null | PASSED | 800 | standard input | 2 seconds | The first line contains two integers n and d (1 ≤ n ≤ 1000, 1 ≤ d ≤ 109) — amount of soldiers in Bob's detachment and the maximum allowed height difference respectively. The second line contains n space-separated integers — heights of all the soldiers in Bob's detachment. These numbers don't exceed 109. | ["6", "6"] | #include<stdio.h>
int main()
{
int n,d,c=0;
int a[1000];
scanf("%d%d",&n,&d);
for(int i=0;i<n;i++)
scanf("%d",&a[i]);
for(int l=0;l<n-1;l++)
{
for(int i=l+1;i<n;i++)
{
if(abs(a[i]-a[l])<=d)
c++;
}
}
c=c*2;
printf("%d",c);
}
| |
According to the regulations of Berland's army, a reconnaissance unit should consist of exactly two soldiers. Since these two soldiers shouldn't differ much, their heights can differ by at most d centimeters. Captain Bob has n soldiers in his detachment. Their heights are a1, a2, ..., an centimeters. Some soldiers are ... | Output one number — amount of ways to form a reconnaissance unit of two soldiers, whose height difference doesn't exceed d. | C | d7381f73ee29c9b89671f21cafee12e7 | c8a915cafc068e640ca76e59bb7875ae | GNU C11 | standard output | 256 megabytes | train_002.jsonl | [
"brute force"
] | 1286002800 | ["5 10\n10 20 50 60 65", "5 1\n55 30 29 31 55"] | null | PASSED | 800 | standard input | 2 seconds | The first line contains two integers n and d (1 ≤ n ≤ 1000, 1 ≤ d ≤ 109) — amount of soldiers in Bob's detachment and the maximum allowed height difference respectively. The second line contains n space-separated integers — heights of all the soldiers in Bob's detachment. These numbers don't exceed 109. | ["6", "6"] | #include<stdio.h>
int mode(int* a,int* b){
int d;
if((*a)<(*b)) d= *b - *a;
else d= *a - *b;
return d;
}
int main(){
int n,d;
int m;
scanf("%d %d\n",&n,&d);
int arr[n],i,j,count=0;
for(i=0;i<n;i++){
scanf("%d ",&arr[i]);
}
for(i=0;i<n;i++){
for(j=i+1;j<n;j++){... | |
According to the regulations of Berland's army, a reconnaissance unit should consist of exactly two soldiers. Since these two soldiers shouldn't differ much, their heights can differ by at most d centimeters. Captain Bob has n soldiers in his detachment. Their heights are a1, a2, ..., an centimeters. Some soldiers are ... | Output one number — amount of ways to form a reconnaissance unit of two soldiers, whose height difference doesn't exceed d. | C | d7381f73ee29c9b89671f21cafee12e7 | 1a4f6ee94ff6435fdd56ae23c766c447 | GNU C11 | standard output | 256 megabytes | train_002.jsonl | [
"brute force"
] | 1286002800 | ["5 10\n10 20 50 60 65", "5 1\n55 30 29 31 55"] | null | PASSED | 800 | standard input | 2 seconds | The first line contains two integers n and d (1 ≤ n ≤ 1000, 1 ≤ d ≤ 109) — amount of soldiers in Bob's detachment and the maximum allowed height difference respectively. The second line contains n space-separated integers — heights of all the soldiers in Bob's detachment. These numbers don't exceed 109. | ["6", "6"] | #include <stdio.h>
#include <stdlib.h>
int main()
{
long x[1100], n, d, i, j, g;
scanf("%d %d", &n, &d);
for(i=0; i<n; i++)
{
scanf("%d", &x[i]);
}
g = 0;
for(i=0; i<n-1; i++)
{
for(j=i+1; j<n; j++)
{
if(labs(x[i]-x[j])<=d)
g = g+2;... | |
According to the regulations of Berland's army, a reconnaissance unit should consist of exactly two soldiers. Since these two soldiers shouldn't differ much, their heights can differ by at most d centimeters. Captain Bob has n soldiers in his detachment. Their heights are a1, a2, ..., an centimeters. Some soldiers are ... | Output one number — amount of ways to form a reconnaissance unit of two soldiers, whose height difference doesn't exceed d. | C | d7381f73ee29c9b89671f21cafee12e7 | 30c6953bc2e55019d38b3b49030ee47a | GNU C11 | standard output | 256 megabytes | train_002.jsonl | [
"brute force"
] | 1286002800 | ["5 10\n10 20 50 60 65", "5 1\n55 30 29 31 55"] | null | PASSED | 800 | standard input | 2 seconds | The first line contains two integers n and d (1 ≤ n ≤ 1000, 1 ≤ d ≤ 109) — amount of soldiers in Bob's detachment and the maximum allowed height difference respectively. The second line contains n space-separated integers — heights of all the soldiers in Bob's detachment. These numbers don't exceed 109. | ["6", "6"] | #include <stdio.h>
#include <math.h>
int recon(long long *arr, long long d, int length) {
int count=0;
for (int i=0; i<length-1; i++) {
for (int j=i+1; j<length; j++) {
if (abs(arr[i]-arr[j])<=d) {
count+=2;
}
}
}
return count;
}
int main() {
i... | |
According to the regulations of Berland's army, a reconnaissance unit should consist of exactly two soldiers. Since these two soldiers shouldn't differ much, their heights can differ by at most d centimeters. Captain Bob has n soldiers in his detachment. Their heights are a1, a2, ..., an centimeters. Some soldiers are ... | Output one number — amount of ways to form a reconnaissance unit of two soldiers, whose height difference doesn't exceed d. | C | d7381f73ee29c9b89671f21cafee12e7 | 33c2e7e2679088d7b7a3da57580ad0a2 | GNU C11 | standard output | 256 megabytes | train_002.jsonl | [
"brute force"
] | 1286002800 | ["5 10\n10 20 50 60 65", "5 1\n55 30 29 31 55"] | null | PASSED | 800 | standard input | 2 seconds | The first line contains two integers n and d (1 ≤ n ≤ 1000, 1 ≤ d ≤ 109) — amount of soldiers in Bob's detachment and the maximum allowed height difference respectively. The second line contains n space-separated integers — heights of all the soldiers in Bob's detachment. These numbers don't exceed 109. | ["6", "6"] | #include<stdio.h>
int main()
{
int n,d,i,j,count=0,a[1000];
scanf("%d%d",&n,&d);
for(i=0;i<n;i++)
{
scanf("%d",&a[i]);
}
for(i=0;i<n;i++)
{
j=i+1;
while(j<n)
{
if((a[i]<=a[j]) && ((a[j]-a[i])<=d))
count++;
if((a[i]>a[j]... | |
According to the regulations of Berland's army, a reconnaissance unit should consist of exactly two soldiers. Since these two soldiers shouldn't differ much, their heights can differ by at most d centimeters. Captain Bob has n soldiers in his detachment. Their heights are a1, a2, ..., an centimeters. Some soldiers are ... | Output one number — amount of ways to form a reconnaissance unit of two soldiers, whose height difference doesn't exceed d. | C | d7381f73ee29c9b89671f21cafee12e7 | 7b3335235775376e2078fec27c6c4f4b | GNU C11 | standard output | 256 megabytes | train_002.jsonl | [
"brute force"
] | 1286002800 | ["5 10\n10 20 50 60 65", "5 1\n55 30 29 31 55"] | null | PASSED | 800 | standard input | 2 seconds | The first line contains two integers n and d (1 ≤ n ≤ 1000, 1 ≤ d ≤ 109) — amount of soldiers in Bob's detachment and the maximum allowed height difference respectively. The second line contains n space-separated integers — heights of all the soldiers in Bob's detachment. These numbers don't exceed 109. | ["6", "6"] | #include<stdio.h>
#include<math.h>
int main(){
long int a,d;
scanf("%ld%ld",&a,&d);
long int ar[a];
for(int i=0;i<=a-1;i++){
scanf("%ld",&ar[i]);
}
long int c=0;
for (int i=0;i<=a-1;i++){
for(int j=0;j<=a-1;j++){
if(i!=j){
if (abs(ar[i]-ar[j])<=d){
c++;
}
... | |
According to the regulations of Berland's army, a reconnaissance unit should consist of exactly two soldiers. Since these two soldiers shouldn't differ much, their heights can differ by at most d centimeters. Captain Bob has n soldiers in his detachment. Their heights are a1, a2, ..., an centimeters. Some soldiers are ... | Output one number — amount of ways to form a reconnaissance unit of two soldiers, whose height difference doesn't exceed d. | C | d7381f73ee29c9b89671f21cafee12e7 | 51112585d67b0570e32a78d7c847e022 | GNU C11 | standard output | 256 megabytes | train_002.jsonl | [
"brute force"
] | 1286002800 | ["5 10\n10 20 50 60 65", "5 1\n55 30 29 31 55"] | null | PASSED | 800 | standard input | 2 seconds | The first line contains two integers n and d (1 ≤ n ≤ 1000, 1 ≤ d ≤ 109) — amount of soldiers in Bob's detachment and the maximum allowed height difference respectively. The second line contains n space-separated integers — heights of all the soldiers in Bob's detachment. These numbers don't exceed 109. | ["6", "6"] | #include <stdio.h>
int main()
{long long int n,d;
scanf("%lld%lld",&n,&d);
long long int a[n+3],i,j,sum=0;
for(i=0;i<n;i++)
{scanf("%lld",&a[i]);}
for(i=0;i<n;i++)
{for(j=0;j<n;j++)
{if(a[i]-a[j]<=d && a[i]-a[j]>=(-d) && i!=j)
sum=sum+1;}}
printf("%lld",sum);
} | |
According to the regulations of Berland's army, a reconnaissance unit should consist of exactly two soldiers. Since these two soldiers shouldn't differ much, their heights can differ by at most d centimeters. Captain Bob has n soldiers in his detachment. Their heights are a1, a2, ..., an centimeters. Some soldiers are ... | Output one number — amount of ways to form a reconnaissance unit of two soldiers, whose height difference doesn't exceed d. | C | d7381f73ee29c9b89671f21cafee12e7 | e89f5995f6c2fead9ee1515b6cab6824 | GNU C11 | standard output | 256 megabytes | train_002.jsonl | [
"brute force"
] | 1286002800 | ["5 10\n10 20 50 60 65", "5 1\n55 30 29 31 55"] | null | PASSED | 800 | standard input | 2 seconds | The first line contains two integers n and d (1 ≤ n ≤ 1000, 1 ≤ d ≤ 109) — amount of soldiers in Bob's detachment and the maximum allowed height difference respectively. The second line contains n space-separated integers — heights of all the soldiers in Bob's detachment. These numbers don't exceed 109. | ["6", "6"] | #include<stdio.h>
int main()
{
int n,m,a[100000],s=0,j,c,i;
scanf("%d%d",&n,&m);
for(i=0;i<n;i++)
{
scanf("%d",&a[i]);
}
for(i=0;i<n-1;i++)
{
for(j=i+1;j<n;j++)
{
if(a[i]>a[j]){c=a[i];a[i]=a[j];a[j]=c; }
}
}
for(i=0;i<n-1;i++)
{
for(j=i+1;j<n;j++)
... | |
According to the regulations of Berland's army, a reconnaissance unit should consist of exactly two soldiers. Since these two soldiers shouldn't differ much, their heights can differ by at most d centimeters. Captain Bob has n soldiers in his detachment. Their heights are a1, a2, ..., an centimeters. Some soldiers are ... | Output one number — amount of ways to form a reconnaissance unit of two soldiers, whose height difference doesn't exceed d. | C | d7381f73ee29c9b89671f21cafee12e7 | a36b352a3c4d77bf6da71520a92f2df1 | GNU C11 | standard output | 256 megabytes | train_002.jsonl | [
"brute force"
] | 1286002800 | ["5 10\n10 20 50 60 65", "5 1\n55 30 29 31 55"] | null | PASSED | 800 | standard input | 2 seconds | The first line contains two integers n and d (1 ≤ n ≤ 1000, 1 ≤ d ≤ 109) — amount of soldiers in Bob's detachment and the maximum allowed height difference respectively. The second line contains n space-separated integers — heights of all the soldiers in Bob's detachment. These numbers don't exceed 109. | ["6", "6"] | #include <stdio.h>
int main()
{long long int n,d;
scanf("%lld%lld",&n,&d);
long long int a[n+3],i,j,sum=0;
for(i=0;i<n;i++)
{scanf("%lld",&a[i]);}
for(i=0;i<n;i++)
{for(j=0;j<n;j++)
{if(a[i]-a[j]<=d && a[i]-a[j]>=(-d) && i!=j)
sum=sum+1;}}
printf("%lld",sum);
} | |
According to the regulations of Berland's army, a reconnaissance unit should consist of exactly two soldiers. Since these two soldiers shouldn't differ much, their heights can differ by at most d centimeters. Captain Bob has n soldiers in his detachment. Their heights are a1, a2, ..., an centimeters. Some soldiers are ... | Output one number — amount of ways to form a reconnaissance unit of two soldiers, whose height difference doesn't exceed d. | C | d7381f73ee29c9b89671f21cafee12e7 | 0f49d8fb73e428a3e2cfbfd8663da47c | GNU C11 | standard output | 256 megabytes | train_002.jsonl | [
"brute force"
] | 1286002800 | ["5 10\n10 20 50 60 65", "5 1\n55 30 29 31 55"] | null | PASSED | 800 | standard input | 2 seconds | The first line contains two integers n and d (1 ≤ n ≤ 1000, 1 ≤ d ≤ 109) — amount of soldiers in Bob's detachment and the maximum allowed height difference respectively. The second line contains n space-separated integers — heights of all the soldiers in Bob's detachment. These numbers don't exceed 109. | ["6", "6"] | #include<stdio.h>
#include<string.h>
int main()
{
int n,m,a[10000],i,b=0,j;
scanf("%d %d",&n,&m);
for(i=0; i<n; i++)
scanf("%d",&a[i]);
for(i=0; i<n; i++)
{
for(j=i+1; j<n; j++)
{
if((a[i]-a[j]<=m && a[i]-a[j]>=0)||(a[j]-a[i]<=m && a[j]-a[i]>=0))
b+=2;... | |
According to the regulations of Berland's army, a reconnaissance unit should consist of exactly two soldiers. Since these two soldiers shouldn't differ much, their heights can differ by at most d centimeters. Captain Bob has n soldiers in his detachment. Their heights are a1, a2, ..., an centimeters. Some soldiers are ... | Output one number — amount of ways to form a reconnaissance unit of two soldiers, whose height difference doesn't exceed d. | C | d7381f73ee29c9b89671f21cafee12e7 | 8eac923be6a9abca38f5f3f4625d3ef1 | GNU C11 | standard output | 256 megabytes | train_002.jsonl | [
"brute force"
] | 1286002800 | ["5 10\n10 20 50 60 65", "5 1\n55 30 29 31 55"] | null | PASSED | 800 | standard input | 2 seconds | The first line contains two integers n and d (1 ≤ n ≤ 1000, 1 ≤ d ≤ 109) — amount of soldiers in Bob's detachment and the maximum allowed height difference respectively. The second line contains n space-separated integers — heights of all the soldiers in Bob's detachment. These numbers don't exceed 109. | ["6", "6"] | /******************************************************************************
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.
***********************************************... | |
According to the regulations of Berland's army, a reconnaissance unit should consist of exactly two soldiers. Since these two soldiers shouldn't differ much, their heights can differ by at most d centimeters. Captain Bob has n soldiers in his detachment. Their heights are a1, a2, ..., an centimeters. Some soldiers are ... | Output one number — amount of ways to form a reconnaissance unit of two soldiers, whose height difference doesn't exceed d. | C | d7381f73ee29c9b89671f21cafee12e7 | e26ff727f6db85b0c0a541ddbfdc297d | GNU C11 | standard output | 256 megabytes | train_002.jsonl | [
"brute force"
] | 1286002800 | ["5 10\n10 20 50 60 65", "5 1\n55 30 29 31 55"] | null | PASSED | 800 | standard input | 2 seconds | The first line contains two integers n and d (1 ≤ n ≤ 1000, 1 ≤ d ≤ 109) — amount of soldiers in Bob's detachment and the maximum allowed height difference respectively. The second line contains n space-separated integers — heights of all the soldiers in Bob's detachment. These numbers don't exceed 109. | ["6", "6"] | #include <stdio.h>
int main()
{long long int n,d;
scanf("%lld%lld",&n,&d);
long long int a[n+3],i,j,sum=0;
for(i=0;i<n;i++)
{scanf("%lld",&a[i]);}
for(i=0;i<n;i++)
{for(j=0;j<n;j++)
{if(a[i]-a[j]<=d && a[i]-a[j]>=(-d) && i!=j)
sum=sum+1;}}
printf("%lld",sum);
} | |
According to the regulations of Berland's army, a reconnaissance unit should consist of exactly two soldiers. Since these two soldiers shouldn't differ much, their heights can differ by at most d centimeters. Captain Bob has n soldiers in his detachment. Their heights are a1, a2, ..., an centimeters. Some soldiers are ... | Output one number — amount of ways to form a reconnaissance unit of two soldiers, whose height difference doesn't exceed d. | C | d7381f73ee29c9b89671f21cafee12e7 | 2e560da3ea4b75776fdbdbe8ed8e3219 | GNU C11 | standard output | 256 megabytes | train_002.jsonl | [
"brute force"
] | 1286002800 | ["5 10\n10 20 50 60 65", "5 1\n55 30 29 31 55"] | null | PASSED | 800 | standard input | 2 seconds | The first line contains two integers n and d (1 ≤ n ≤ 1000, 1 ≤ d ≤ 109) — amount of soldiers in Bob's detachment and the maximum allowed height difference respectively. The second line contains n space-separated integers — heights of all the soldiers in Bob's detachment. These numbers don't exceed 109. | ["6", "6"] | #include<stdio.h>
int main()
{
int n,d,i,j,x,result=0;
scanf("%d %d",&n,&d);
int a[n];
for(i=0; i<n; i=i+1)
{
scanf("%d",&a[i]);
}
for(i=0; i<n; i=i+1)
{
for(j=0; j<n; j=j+1)
{
if(i!=j)
{
x=abs (a[i]-a[j]);
i... | |
According to the regulations of Berland's army, a reconnaissance unit should consist of exactly two soldiers. Since these two soldiers shouldn't differ much, their heights can differ by at most d centimeters. Captain Bob has n soldiers in his detachment. Their heights are a1, a2, ..., an centimeters. Some soldiers are ... | Output one number — amount of ways to form a reconnaissance unit of two soldiers, whose height difference doesn't exceed d. | C | d7381f73ee29c9b89671f21cafee12e7 | 425eb6b3d6741fbe3ffa56fd798d9bde | GNU C11 | standard output | 256 megabytes | train_002.jsonl | [
"brute force"
] | 1286002800 | ["5 10\n10 20 50 60 65", "5 1\n55 30 29 31 55"] | null | PASSED | 800 | standard input | 2 seconds | The first line contains two integers n and d (1 ≤ n ≤ 1000, 1 ≤ d ≤ 109) — amount of soldiers in Bob's detachment and the maximum allowed height difference respectively. The second line contains n space-separated integers — heights of all the soldiers in Bob's detachment. These numbers don't exceed 109. | ["6", "6"] | #include<stdio.h>
#include<stdlib.h>
int main()
{
int n,*a,d;
scanf("%d%d",&n,&d);
a = (int*)malloc(sizeof(int)*n);
int i,j,s,count = 0;
for(i=0; i<n; i++)
{
scanf("%d",&a[i]);
}
for(i=0; i<n-1; i++)
{
for(j=i+1; j<n; j++)
{
s = a[i]-a[j];
... | |
According to the regulations of Berland's army, a reconnaissance unit should consist of exactly two soldiers. Since these two soldiers shouldn't differ much, their heights can differ by at most d centimeters. Captain Bob has n soldiers in his detachment. Their heights are a1, a2, ..., an centimeters. Some soldiers are ... | Output one number — amount of ways to form a reconnaissance unit of two soldiers, whose height difference doesn't exceed d. | C | d7381f73ee29c9b89671f21cafee12e7 | 7068602a76effe484109d51302712793 | GNU C11 | standard output | 256 megabytes | train_002.jsonl | [
"brute force"
] | 1286002800 | ["5 10\n10 20 50 60 65", "5 1\n55 30 29 31 55"] | null | PASSED | 800 | standard input | 2 seconds | The first line contains two integers n and d (1 ≤ n ≤ 1000, 1 ≤ d ≤ 109) — amount of soldiers in Bob's detachment and the maximum allowed height difference respectively. The second line contains n space-separated integers — heights of all the soldiers in Bob's detachment. These numbers don't exceed 109. | ["6", "6"] | #include <stdio.h>
#include <stdlib.h>
int main () {
long long int n, i, d, j, count = 0;
scanf("%lld %lld", &n , &d);
long long int arr[n];
for (i = 0; i < n; i++){
scanf("%lld", &arr[i]);
}
for (i = 0; i < n; i++){
for(j = 0; j < n; j++){
if ( i != j && abs(a... | |
According to the regulations of Berland's army, a reconnaissance unit should consist of exactly two soldiers. Since these two soldiers shouldn't differ much, their heights can differ by at most d centimeters. Captain Bob has n soldiers in his detachment. Their heights are a1, a2, ..., an centimeters. Some soldiers are ... | Output one number — amount of ways to form a reconnaissance unit of two soldiers, whose height difference doesn't exceed d. | C | d7381f73ee29c9b89671f21cafee12e7 | 6f1e9af9fbc284660356df886fc8c8c0 | GNU C11 | standard output | 256 megabytes | train_002.jsonl | [
"brute force"
] | 1286002800 | ["5 10\n10 20 50 60 65", "5 1\n55 30 29 31 55"] | null | PASSED | 800 | standard input | 2 seconds | The first line contains two integers n and d (1 ≤ n ≤ 1000, 1 ≤ d ≤ 109) — amount of soldiers in Bob's detachment and the maximum allowed height difference respectively. The second line contains n space-separated integers — heights of all the soldiers in Bob's detachment. These numbers don't exceed 109. | ["6", "6"] | #include<stdio.h>
int main()
{
int sum,n,d,arr[1000],i,j,k,l,m;
scanf("%d %d",&n,&d);
for(i=0; i<n; i++)
{
scanf("%d",&arr[i]);
}
sum=0;
for(i=0; i<n; i++)
{
for(j=i+1; j<n; j++)
{
l=arr[i]-arr[j];
if(l<0)
l*=-1;
... | |
According to the regulations of Berland's army, a reconnaissance unit should consist of exactly two soldiers. Since these two soldiers shouldn't differ much, their heights can differ by at most d centimeters. Captain Bob has n soldiers in his detachment. Their heights are a1, a2, ..., an centimeters. Some soldiers are ... | Output one number — amount of ways to form a reconnaissance unit of two soldiers, whose height difference doesn't exceed d. | C | d7381f73ee29c9b89671f21cafee12e7 | 02be0a2bea8ca088d208f74c4e5f6bf3 | GNU C11 | standard output | 256 megabytes | train_002.jsonl | [
"brute force"
] | 1286002800 | ["5 10\n10 20 50 60 65", "5 1\n55 30 29 31 55"] | null | PASSED | 800 | standard input | 2 seconds | The first line contains two integers n and d (1 ≤ n ≤ 1000, 1 ≤ d ≤ 109) — amount of soldiers in Bob's detachment and the maximum allowed height difference respectively. The second line contains n space-separated integers — heights of all the soldiers in Bob's detachment. These numbers don't exceed 109. | ["6", "6"] | #include<stdio.h>
#include<math.h>
#define lli long long int
int main(){
lli i, j, n, d, ways=0;
scanf("%lld %lld", &n, &d);
lli arr[n+1];
for(i=0; i<n; i++){
scanf("%lld", &arr[i]);
}
for(i=0; i<n; i++){
for(j=i+1; j<n; j++){
if(abs(arr[i]-arr[j])<=d){
... | |
According to the regulations of Berland's army, a reconnaissance unit should consist of exactly two soldiers. Since these two soldiers shouldn't differ much, their heights can differ by at most d centimeters. Captain Bob has n soldiers in his detachment. Their heights are a1, a2, ..., an centimeters. Some soldiers are ... | Output one number — amount of ways to form a reconnaissance unit of two soldiers, whose height difference doesn't exceed d. | C | d7381f73ee29c9b89671f21cafee12e7 | 9ce02547bb0084292e488ab02a24f9eb | GNU C11 | standard output | 256 megabytes | train_002.jsonl | [
"brute force"
] | 1286002800 | ["5 10\n10 20 50 60 65", "5 1\n55 30 29 31 55"] | null | PASSED | 800 | standard input | 2 seconds | The first line contains two integers n and d (1 ≤ n ≤ 1000, 1 ≤ d ≤ 109) — amount of soldiers in Bob's detachment and the maximum allowed height difference respectively. The second line contains n space-separated integers — heights of all the soldiers in Bob's detachment. These numbers don't exceed 109. | ["6", "6"] | #include<stdio.h>
int main(void)
{
unsigned long long int n,count=0,i,j,temp=0;
unsigned long long d,a[1001];
scanf("%llu %llu",&n,&d);
for(i=0;i<n;i++)
{
scanf("%llu",&a[i]);
}
for(i=0;i<n-1;i++)
{
for(j=i+1;j<n;j++)
{
if(a[i]>=a[j])
{... | |
According to the regulations of Berland's army, a reconnaissance unit should consist of exactly two soldiers. Since these two soldiers shouldn't differ much, their heights can differ by at most d centimeters. Captain Bob has n soldiers in his detachment. Their heights are a1, a2, ..., an centimeters. Some soldiers are ... | Output one number — amount of ways to form a reconnaissance unit of two soldiers, whose height difference doesn't exceed d. | C | d7381f73ee29c9b89671f21cafee12e7 | 80d5e3319f6cdfdc770d195b1c813cdf | GNU C11 | standard output | 256 megabytes | train_002.jsonl | [
"brute force"
] | 1286002800 | ["5 10\n10 20 50 60 65", "5 1\n55 30 29 31 55"] | null | PASSED | 800 | standard input | 2 seconds | The first line contains two integers n and d (1 ≤ n ≤ 1000, 1 ≤ d ≤ 109) — amount of soldiers in Bob's detachment and the maximum allowed height difference respectively. The second line contains n space-separated integers — heights of all the soldiers in Bob's detachment. These numbers don't exceed 109. | ["6", "6"] | #include <stdio.h>
int main()
{
int n, d, j, i, c = 0, t, a[1001];
scanf("%d%d", &n, &d);
for (i = 0; i < n; i++)
scanf("%d", &a[i]);
for (j = 1; j < n; j++)
for (i = 0; i < n - 1; i++)
if (a[i] < a[i + 1])
t = a[i], a[i] = a[i + 1], a[i + 1] = t;
for (i = 0; i < n - 1; i++)
for (j = i + 1; j < n; j++... | |
According to the regulations of Berland's army, a reconnaissance unit should consist of exactly two soldiers. Since these two soldiers shouldn't differ much, their heights can differ by at most d centimeters. Captain Bob has n soldiers in his detachment. Their heights are a1, a2, ..., an centimeters. Some soldiers are ... | Output one number — amount of ways to form a reconnaissance unit of two soldiers, whose height difference doesn't exceed d. | C | d7381f73ee29c9b89671f21cafee12e7 | 3efdecd4d35b189c3119ec5e640f6a00 | GNU C11 | standard output | 256 megabytes | train_002.jsonl | [
"brute force"
] | 1286002800 | ["5 10\n10 20 50 60 65", "5 1\n55 30 29 31 55"] | null | PASSED | 800 | standard input | 2 seconds | The first line contains two integers n and d (1 ≤ n ≤ 1000, 1 ≤ d ≤ 109) — amount of soldiers in Bob's detachment and the maximum allowed height difference respectively. The second line contains n space-separated integers — heights of all the soldiers in Bob's detachment. These numbers don't exceed 109. | ["6", "6"] | #include<stdio.h> //AA06( 07/ 04/ 20) If u see my code, Have a Good Day!
#include<math.h>
int main()
{
long long int n, d, i, j, A[10000], x = 0;
scanf("%lld%lld", &n, &d);
for(i = 0; i < n; i++) {
scanf("%lld", &A[i]);
}
for(i = 0; i < n; i++) {
for(j = i + 1; j < n; j++) {
... | |
According to the regulations of Berland's army, a reconnaissance unit should consist of exactly two soldiers. Since these two soldiers shouldn't differ much, their heights can differ by at most d centimeters. Captain Bob has n soldiers in his detachment. Their heights are a1, a2, ..., an centimeters. Some soldiers are ... | Output one number — amount of ways to form a reconnaissance unit of two soldiers, whose height difference doesn't exceed d. | C | d7381f73ee29c9b89671f21cafee12e7 | 3a273851eac35ef6e4ed61a577616036 | GNU C11 | standard output | 256 megabytes | train_002.jsonl | [
"brute force"
] | 1286002800 | ["5 10\n10 20 50 60 65", "5 1\n55 30 29 31 55"] | null | PASSED | 800 | standard input | 2 seconds | The first line contains two integers n and d (1 ≤ n ≤ 1000, 1 ≤ d ≤ 109) — amount of soldiers in Bob's detachment and the maximum allowed height difference respectively. The second line contains n space-separated integers — heights of all the soldiers in Bob's detachment. These numbers don't exceed 109. | ["6", "6"] | #include<stdio.h>
int main()
{
int n,ct=0;
long d;
scanf("%d %I64ld",&n,&d);
int H[n];
for(int i=0;i<n;i++)
{
scanf("%d",&H[i]);
}
for(int i=0;i<n;i++)
{
for(int j=0;j<n;j++)
{
if(H[i]>H[j])
{
if((H[i]-H[j])<=d)
{
ct=ct+1;
}
}
else
{
if((H[j]-H[i])<=d)
{
ct=ct+1;
}
}
}
}
printf("%d",ct-n);
}
| |
According to the regulations of Berland's army, a reconnaissance unit should consist of exactly two soldiers. Since these two soldiers shouldn't differ much, their heights can differ by at most d centimeters. Captain Bob has n soldiers in his detachment. Their heights are a1, a2, ..., an centimeters. Some soldiers are ... | Output one number — amount of ways to form a reconnaissance unit of two soldiers, whose height difference doesn't exceed d. | C | d7381f73ee29c9b89671f21cafee12e7 | c26e91bdd72537cf856e4ecb851954e1 | GNU C11 | standard output | 256 megabytes | train_002.jsonl | [
"brute force"
] | 1286002800 | ["5 10\n10 20 50 60 65", "5 1\n55 30 29 31 55"] | null | PASSED | 800 | standard input | 2 seconds | The first line contains two integers n and d (1 ≤ n ≤ 1000, 1 ≤ d ≤ 109) — amount of soldiers in Bob's detachment and the maximum allowed height difference respectively. The second line contains n space-separated integers — heights of all the soldiers in Bob's detachment. These numbers don't exceed 109. | ["6", "6"] | #include <stdio.h>
#include <stdlib.h>
int main()
{
int num[1000],i,n,d,t,j,count=0;
scanf("%d%d",&n,&d);
for(i=0;i<n;i++)
{
scanf("%d",&num[i]);
}
for(i=0;i<n;i++)
{
for(j=0;j<n;j++)
{
t=abs(num[j]-num[i]);
if((i!=j)&&(t<=d))
{
... | |
According to the regulations of Berland's army, a reconnaissance unit should consist of exactly two soldiers. Since these two soldiers shouldn't differ much, their heights can differ by at most d centimeters. Captain Bob has n soldiers in his detachment. Their heights are a1, a2, ..., an centimeters. Some soldiers are ... | Output one number — amount of ways to form a reconnaissance unit of two soldiers, whose height difference doesn't exceed d. | C | d7381f73ee29c9b89671f21cafee12e7 | 2dc72b239eb670d730e5c77fd63b4b0a | GNU C11 | standard output | 256 megabytes | train_002.jsonl | [
"brute force"
] | 1286002800 | ["5 10\n10 20 50 60 65", "5 1\n55 30 29 31 55"] | null | PASSED | 800 | standard input | 2 seconds | The first line contains two integers n and d (1 ≤ n ≤ 1000, 1 ≤ d ≤ 109) — amount of soldiers in Bob's detachment and the maximum allowed height difference respectively. The second line contains n space-separated integers — heights of all the soldiers in Bob's detachment. These numbers don't exceed 109. | ["6", "6"] | #include<stdio.h>
#include<stdlib.h>
#include<math.h>
int main()
{
int n,m;
scanf("%d %d",&n,&m);
int a[n],i,x=0,j;
for(i=0;i<n;i++)
{
scanf("%d",&a[i]);
}
for(i=0;i<n;i++)
{
for(j=0;j<n;j++)
{
if(j==i)
continue;
if(abs(a[i]... | |
According to the regulations of Berland's army, a reconnaissance unit should consist of exactly two soldiers. Since these two soldiers shouldn't differ much, their heights can differ by at most d centimeters. Captain Bob has n soldiers in his detachment. Their heights are a1, a2, ..., an centimeters. Some soldiers are ... | Output one number — amount of ways to form a reconnaissance unit of two soldiers, whose height difference doesn't exceed d. | C | d7381f73ee29c9b89671f21cafee12e7 | 5ef66d99bed343a8ce847f3fc3adf490 | GNU C11 | standard output | 256 megabytes | train_002.jsonl | [
"brute force"
] | 1286002800 | ["5 10\n10 20 50 60 65", "5 1\n55 30 29 31 55"] | null | PASSED | 800 | standard input | 2 seconds | The first line contains two integers n and d (1 ≤ n ≤ 1000, 1 ≤ d ≤ 109) — amount of soldiers in Bob's detachment and the maximum allowed height difference respectively. The second line contains n space-separated integers — heights of all the soldiers in Bob's detachment. These numbers don't exceed 109. | ["6", "6"] | #include<stdio.h>
#include<math.h>
int main()
{
int n,d,i,j;
scanf("%d%d",&n,&d);
int a[n];
for(i=0;i<n;i++)
{
scanf("%d",&a[i]);
}
int x=0;
for(i=0;i<n;i++)
{
for(j=0;j<n;j++)
{
if(i!=j&&abs(a[i]-a[j])<=d)
{
x++;
... | |
According to the regulations of Berland's army, a reconnaissance unit should consist of exactly two soldiers. Since these two soldiers shouldn't differ much, their heights can differ by at most d centimeters. Captain Bob has n soldiers in his detachment. Their heights are a1, a2, ..., an centimeters. Some soldiers are ... | Output one number — amount of ways to form a reconnaissance unit of two soldiers, whose height difference doesn't exceed d. | C | d7381f73ee29c9b89671f21cafee12e7 | 0e3f6580a2816529b320396ec730472f | GNU C11 | standard output | 256 megabytes | train_002.jsonl | [
"brute force"
] | 1286002800 | ["5 10\n10 20 50 60 65", "5 1\n55 30 29 31 55"] | null | PASSED | 800 | standard input | 2 seconds | The first line contains two integers n and d (1 ≤ n ≤ 1000, 1 ≤ d ≤ 109) — amount of soldiers in Bob's detachment and the maximum allowed height difference respectively. The second line contains n space-separated integers — heights of all the soldiers in Bob's detachment. These numbers don't exceed 109. | ["6", "6"] | #include <stdio.h>
int main()
{
int n,d,i,j,count=0;
scanf("%d %d",&n,&d);
int ara[n];
for(i=0;i<n;i++)
{
scanf("%d",&ara[i]);
}
for(i=0;i<n;i++)
{
for(j=i+1;j<n;j++)
{
if(ara[i]==ara[j])
{
count++;
}
... | |
According to the regulations of Berland's army, a reconnaissance unit should consist of exactly two soldiers. Since these two soldiers shouldn't differ much, their heights can differ by at most d centimeters. Captain Bob has n soldiers in his detachment. Their heights are a1, a2, ..., an centimeters. Some soldiers are ... | Output one number — amount of ways to form a reconnaissance unit of two soldiers, whose height difference doesn't exceed d. | C | d7381f73ee29c9b89671f21cafee12e7 | 0d3c714f55fdfb6d11a755d01ab48b6d | GNU C11 | standard output | 256 megabytes | train_002.jsonl | [
"brute force"
] | 1286002800 | ["5 10\n10 20 50 60 65", "5 1\n55 30 29 31 55"] | null | PASSED | 800 | standard input | 2 seconds | The first line contains two integers n and d (1 ≤ n ≤ 1000, 1 ≤ d ≤ 109) — amount of soldiers in Bob's detachment and the maximum allowed height difference respectively. The second line contains n space-separated integers — heights of all the soldiers in Bob's detachment. These numbers don't exceed 109. | ["6", "6"] | int comparetor (const void * a, const void * b)
{
return ( *(int*)a - *(int*)b );
}
int main()
{
int n,d;
scanf("%d %d",&n,&d);
int a[2000]={};
for(int i=0;i<n;i++)
{
scanf("%d",&a[i]);
}
qsort (a, n, sizeof(int), comparetor );
int j=0,k=1,c=0,count=0;
while(j<n)
{
... | |
According to the regulations of Berland's army, a reconnaissance unit should consist of exactly two soldiers. Since these two soldiers shouldn't differ much, their heights can differ by at most d centimeters. Captain Bob has n soldiers in his detachment. Their heights are a1, a2, ..., an centimeters. Some soldiers are ... | Output one number — amount of ways to form a reconnaissance unit of two soldiers, whose height difference doesn't exceed d. | C | d7381f73ee29c9b89671f21cafee12e7 | f99c523aef40d65435076668527b5971 | GNU C11 | standard output | 256 megabytes | train_002.jsonl | [
"brute force"
] | 1286002800 | ["5 10\n10 20 50 60 65", "5 1\n55 30 29 31 55"] | null | PASSED | 800 | standard input | 2 seconds | The first line contains two integers n and d (1 ≤ n ≤ 1000, 1 ≤ d ≤ 109) — amount of soldiers in Bob's detachment and the maximum allowed height difference respectively. The second line contains n space-separated integers — heights of all the soldiers in Bob's detachment. These numbers don't exceed 109. | ["6", "6"] | #include<stdio.h>
int main()
{int n,i,j,temp,count=0;
long long int d;
scanf("%d%lld",&n,&d);
int a[n];
for(i=0;i<n;i++)
{scanf("%d",&a[i]);
}
for(i=0;i<n;i++)
{for(j=0;j<n;j++)
{ if(i!=j)
{if((a[i]-a[j])<=d&&(a[i]-a[j])>=(-d))
count++;
}
}
}
printf("%d... | |
According to the regulations of Berland's army, a reconnaissance unit should consist of exactly two soldiers. Since these two soldiers shouldn't differ much, their heights can differ by at most d centimeters. Captain Bob has n soldiers in his detachment. Their heights are a1, a2, ..., an centimeters. Some soldiers are ... | Output one number — amount of ways to form a reconnaissance unit of two soldiers, whose height difference doesn't exceed d. | C | d7381f73ee29c9b89671f21cafee12e7 | b82174a6c5fe41d8e6da80d4ef45d032 | GNU C11 | standard output | 256 megabytes | train_002.jsonl | [
"brute force"
] | 1286002800 | ["5 10\n10 20 50 60 65", "5 1\n55 30 29 31 55"] | null | PASSED | 800 | standard input | 2 seconds | The first line contains two integers n and d (1 ≤ n ≤ 1000, 1 ≤ d ≤ 109) — amount of soldiers in Bob's detachment and the maximum allowed height difference respectively. The second line contains n space-separated integers — heights of all the soldiers in Bob's detachment. These numbers don't exceed 109. | ["6", "6"] | #include<stdio.h>
int main()
{
int n,i=0,j,count=0;
long int d;
scanf("%d",&n);
scanf("%ld",&d);
int a[n];
for(i=0;i<n;i++)
scanf("%d",&a[i]);
for(i=0;i<n;i++)
{
for(j=i+1;j<n;j++)
{
if((a[i]-a[j])<=d&&(a[i]-a[j])>0)
count+=2... | |
According to the regulations of Berland's army, a reconnaissance unit should consist of exactly two soldiers. Since these two soldiers shouldn't differ much, their heights can differ by at most d centimeters. Captain Bob has n soldiers in his detachment. Their heights are a1, a2, ..., an centimeters. Some soldiers are ... | Output one number — amount of ways to form a reconnaissance unit of two soldiers, whose height difference doesn't exceed d. | C | d7381f73ee29c9b89671f21cafee12e7 | 09d75b18a8ca23bfe72d80494d55702f | GNU C11 | standard output | 256 megabytes | train_002.jsonl | [
"brute force"
] | 1286002800 | ["5 10\n10 20 50 60 65", "5 1\n55 30 29 31 55"] | null | PASSED | 800 | standard input | 2 seconds | The first line contains two integers n and d (1 ≤ n ≤ 1000, 1 ≤ d ≤ 109) — amount of soldiers in Bob's detachment and the maximum allowed height difference respectively. The second line contains n space-separated integers — heights of all the soldiers in Bob's detachment. These numbers don't exceed 109. | ["6", "6"] | #include <stdio.h>
int main()
{long long int n,d;
scanf("%lld%lld",&n,&d);
long long int a[n+3],i,j,sum=0;
for(i=0;i<n;i++)
{scanf("%lld",&a[i]);}
for(i=0;i<n;i++)
{for(j=0;j<n;j++)
{if(a[i]-a[j]<=d && a[i]-a[j]>=(-d) && i!=j)
sum=sum+1;}}
printf("%lld",sum);
} | |
Vasya is writing an operating system shell, and it should have commands for working with directories. To begin with, he decided to go with just two commands: cd (change the current directory) and pwd (display the current directory).Directories in Vasya's operating system form a traditional hierarchical tree structure. ... | For each command pwd you should print the full absolute path of the given directory, ending with a slash. It should start with a slash and contain the list of slash-separated directories in the order of being nested from the root to the current folder. It should contain no dots. | C | 494ac937ba939db1dbc4081e518ab54c | b7e91a49cb10dca7f0019454b1305928 | GNU C | standard output | 256 megabytes | train_002.jsonl | [
"data structures",
"implementation",
"*special"
] | 1330804800 | ["7\npwd\ncd /home/vasya\npwd\ncd ..\npwd\ncd vasya/../petya\npwd", "4\ncd /a/b\npwd\ncd ../a/b\npwd"] | null | PASSED | 1,400 | standard input | 3 seconds | The first line of the input data contains the single integer n (1 ≤ n ≤ 50) — the number of commands. Then follow n lines, each contains one command. Each of these lines contains either command pwd, or command cd, followed by a space-separated non-empty parameter. The command parameter cd only contains lower case Latin... | ["/\n/home/vasya/\n/home/\n/home/petya/", "/a/b/\n/a/a/b/"] | #include<stdio.h>
#include<string.h>
char dir[20001]={"/"};
int top=1;
void make(char *s)
{
int i;
if(strcmp(s,"/")==0)
{
if(top>1)
{
dir[0]='/';
dir[1]='\0';
top=1;
}
}
else if(strcmp(s,"../")==0)
{
if(top>1)
{
dir[to... | |
Vasya is writing an operating system shell, and it should have commands for working with directories. To begin with, he decided to go with just two commands: cd (change the current directory) and pwd (display the current directory).Directories in Vasya's operating system form a traditional hierarchical tree structure. ... | For each command pwd you should print the full absolute path of the given directory, ending with a slash. It should start with a slash and contain the list of slash-separated directories in the order of being nested from the root to the current folder. It should contain no dots. | C | 494ac937ba939db1dbc4081e518ab54c | 7f8b6026f2d59b836d1d8b60e5366a6f | GNU C | standard output | 256 megabytes | train_002.jsonl | [
"data structures",
"implementation",
"*special"
] | 1330804800 | ["7\npwd\ncd /home/vasya\npwd\ncd ..\npwd\ncd vasya/../petya\npwd", "4\ncd /a/b\npwd\ncd ../a/b\npwd"] | null | PASSED | 1,400 | standard input | 3 seconds | The first line of the input data contains the single integer n (1 ≤ n ≤ 50) — the number of commands. Then follow n lines, each contains one command. Each of these lines contains either command pwd, or command cd, followed by a space-separated non-empty parameter. The command parameter cd only contains lower case Latin... | ["/\n/home/vasya/\n/home/\n/home/petya/", "/a/b/\n/a/a/b/"] | #include<stdio.h>
#include<string.h>
char pwd[20000];
int pwdlen=1;
char option[400];
void parse()
{
int cur;
for (cur=0;option[cur]!=0;cur++)
{
if (option[cur]=='.')
{
cur+=2;
if (option[cur]==0) { cur--; }
pwdlen--;
while (pwd[pwdlen-1]!='/') { pwdlen--; }
continue;
}
pwd[pwdlen++]=option... | |
Vasya is writing an operating system shell, and it should have commands for working with directories. To begin with, he decided to go with just two commands: cd (change the current directory) and pwd (display the current directory).Directories in Vasya's operating system form a traditional hierarchical tree structure. ... | For each command pwd you should print the full absolute path of the given directory, ending with a slash. It should start with a slash and contain the list of slash-separated directories in the order of being nested from the root to the current folder. It should contain no dots. | C | 494ac937ba939db1dbc4081e518ab54c | ef7ca76816f02ec5eb442259850c0364 | GNU C | standard output | 256 megabytes | train_002.jsonl | [
"data structures",
"implementation",
"*special"
] | 1330804800 | ["7\npwd\ncd /home/vasya\npwd\ncd ..\npwd\ncd vasya/../petya\npwd", "4\ncd /a/b\npwd\ncd ../a/b\npwd"] | null | PASSED | 1,400 | standard input | 3 seconds | The first line of the input data contains the single integer n (1 ≤ n ≤ 50) — the number of commands. Then follow n lines, each contains one command. Each of these lines contains either command pwd, or command cd, followed by a space-separated non-empty parameter. The command parameter cd only contains lower case Latin... | ["/\n/home/vasya/\n/home/\n/home/petya/", "/a/b/\n/a/a/b/"] | #include <stdio.h>
#include <stdlib.h>
#include <string.h>
char cwd[105020]={'/'}, cmd[20200], *s;
int c=1,n,i;
int main(void) {
scanf("%d\n", &n);
for (i=0; i<n; ++i) {
s=fgets(cmd, 20200, stdin);
if (!strncmp(cmd, "pwd", 3)) {
printf("%s\n", cwd);
} else {
s+=3;
if (*s=='/') {
c=1;
memset(c... | |
Vasya is writing an operating system shell, and it should have commands for working with directories. To begin with, he decided to go with just two commands: cd (change the current directory) and pwd (display the current directory).Directories in Vasya's operating system form a traditional hierarchical tree structure. ... | For each command pwd you should print the full absolute path of the given directory, ending with a slash. It should start with a slash and contain the list of slash-separated directories in the order of being nested from the root to the current folder. It should contain no dots. | C | 494ac937ba939db1dbc4081e518ab54c | ab732e83cb282f50cbf62c9234cf900c | GNU C | standard output | 256 megabytes | train_002.jsonl | [
"data structures",
"implementation",
"*special"
] | 1330804800 | ["7\npwd\ncd /home/vasya\npwd\ncd ..\npwd\ncd vasya/../petya\npwd", "4\ncd /a/b\npwd\ncd ../a/b\npwd"] | null | PASSED | 1,400 | standard input | 3 seconds | The first line of the input data contains the single integer n (1 ≤ n ≤ 50) — the number of commands. Then follow n lines, each contains one command. Each of these lines contains either command pwd, or command cd, followed by a space-separated non-empty parameter. The command parameter cd only contains lower case Latin... | ["/\n/home/vasya/\n/home/\n/home/petya/", "/a/b/\n/a/a/b/"] | #include<stdio.h>
char* stack[100000];
int top=0;
void print_stack()
{
int i;
//if(top!=0)
printf("/");
for(i=1;i<=top;i++)
{
//if(stack[i]!='\0')
printf("%s/",stack[i]);
}
printf("\n");
}
void change_stack(char temp... | |
Vasya is writing an operating system shell, and it should have commands for working with directories. To begin with, he decided to go with just two commands: cd (change the current directory) and pwd (display the current directory).Directories in Vasya's operating system form a traditional hierarchical tree structure. ... | For each command pwd you should print the full absolute path of the given directory, ending with a slash. It should start with a slash and contain the list of slash-separated directories in the order of being nested from the root to the current folder. It should contain no dots. | C | 494ac937ba939db1dbc4081e518ab54c | c4b2d53ce125bf8b22fcd4902a9fcfa2 | GNU C | standard output | 256 megabytes | train_002.jsonl | [
"data structures",
"implementation",
"*special"
] | 1330804800 | ["7\npwd\ncd /home/vasya\npwd\ncd ..\npwd\ncd vasya/../petya\npwd", "4\ncd /a/b\npwd\ncd ../a/b\npwd"] | null | PASSED | 1,400 | standard input | 3 seconds | The first line of the input data contains the single integer n (1 ≤ n ≤ 50) — the number of commands. Then follow n lines, each contains one command. Each of these lines contains either command pwd, or command cd, followed by a space-separated non-empty parameter. The command parameter cd only contains lower case Latin... | ["/\n/home/vasya/\n/home/\n/home/petya/", "/a/b/\n/a/a/b/"] | #include <stdio.h>
#include <stdint.h>
#include <inttypes.h>
#include <string.h>
#include <stdbool.h>
#include <stdlib.h>
char **split(char s[], char delim, uint32_t *n) {
uint32_t len = 0, slen = 0; {
bool was_delim = true;
uint32_t i;
for(i = 0; s[i] != '\0'; i++) {
slen++;
if(s[i] == delim... | |
Vasya is writing an operating system shell, and it should have commands for working with directories. To begin with, he decided to go with just two commands: cd (change the current directory) and pwd (display the current directory).Directories in Vasya's operating system form a traditional hierarchical tree structure. ... | For each command pwd you should print the full absolute path of the given directory, ending with a slash. It should start with a slash and contain the list of slash-separated directories in the order of being nested from the root to the current folder. It should contain no dots. | C | 494ac937ba939db1dbc4081e518ab54c | 00244eecc5278db5095944c209bc5e49 | GNU C | standard output | 256 megabytes | train_002.jsonl | [
"data structures",
"implementation",
"*special"
] | 1330804800 | ["7\npwd\ncd /home/vasya\npwd\ncd ..\npwd\ncd vasya/../petya\npwd", "4\ncd /a/b\npwd\ncd ../a/b\npwd"] | null | PASSED | 1,400 | standard input | 3 seconds | The first line of the input data contains the single integer n (1 ≤ n ≤ 50) — the number of commands. Then follow n lines, each contains one command. Each of these lines contains either command pwd, or command cd, followed by a space-separated non-empty parameter. The command parameter cd only contains lower case Latin... | ["/\n/home/vasya/\n/home/\n/home/petya/", "/a/b/\n/a/a/b/"] | #include <stdio.h>
#include <stdlib.h>
#include <string.h>
char command[5],strcd[10000]="/",string[201],str[201];
int main()
{
int n,i,m,nn,j;
scanf("%d",&m);
while(m--)
{
scanf("%s",command);
if(command[0]=='p')
{
printf("%s\n",strcd);
}
else
... | |
Vasya is writing an operating system shell, and it should have commands for working with directories. To begin with, he decided to go with just two commands: cd (change the current directory) and pwd (display the current directory).Directories in Vasya's operating system form a traditional hierarchical tree structure. ... | For each command pwd you should print the full absolute path of the given directory, ending with a slash. It should start with a slash and contain the list of slash-separated directories in the order of being nested from the root to the current folder. It should contain no dots. | C | 494ac937ba939db1dbc4081e518ab54c | 285083de9181d3f3c0f74daea71d713a | GNU C | standard output | 256 megabytes | train_002.jsonl | [
"data structures",
"implementation",
"*special"
] | 1330804800 | ["7\npwd\ncd /home/vasya\npwd\ncd ..\npwd\ncd vasya/../petya\npwd", "4\ncd /a/b\npwd\ncd ../a/b\npwd"] | null | PASSED | 1,400 | standard input | 3 seconds | The first line of the input data contains the single integer n (1 ≤ n ≤ 50) — the number of commands. Then follow n lines, each contains one command. Each of these lines contains either command pwd, or command cd, followed by a space-separated non-empty parameter. The command parameter cd only contains lower case Latin... | ["/\n/home/vasya/\n/home/\n/home/petya/", "/a/b/\n/a/a/b/"] | #include <stdio.h>
#include <stdlib.h>
#include <string.h>
int changeDirectory(char *, char *, int);
void strchar(char *, char);
int main(int argc, char *argv[]){
int n;
scanf("%i",&n);
if (n>50|| n<1)
return 1;
char *stkcmd[n],temp[250],output[1500],*stkdir[n];
// struct Cola dirs;
for (int i = 0; i<n; ... | |
Vasya is writing an operating system shell, and it should have commands for working with directories. To begin with, he decided to go with just two commands: cd (change the current directory) and pwd (display the current directory).Directories in Vasya's operating system form a traditional hierarchical tree structure. ... | For each command pwd you should print the full absolute path of the given directory, ending with a slash. It should start with a slash and contain the list of slash-separated directories in the order of being nested from the root to the current folder. It should contain no dots. | C | 494ac937ba939db1dbc4081e518ab54c | 796be50c3bb76c43b99bb6e281e0d2c3 | GNU C | standard output | 256 megabytes | train_002.jsonl | [
"data structures",
"implementation",
"*special"
] | 1330804800 | ["7\npwd\ncd /home/vasya\npwd\ncd ..\npwd\ncd vasya/../petya\npwd", "4\ncd /a/b\npwd\ncd ../a/b\npwd"] | null | PASSED | 1,400 | standard input | 3 seconds | The first line of the input data contains the single integer n (1 ≤ n ≤ 50) — the number of commands. Then follow n lines, each contains one command. Each of these lines contains either command pwd, or command cd, followed by a space-separated non-empty parameter. The command parameter cd only contains lower case Latin... | ["/\n/home/vasya/\n/home/\n/home/petya/", "/a/b/\n/a/a/b/"] | #include<stdio.h>
#include<string.h>
char a[10001][10001];
int top;
int letter_count;
int n;
void push(char value);
void pop();
void TOP();
void print();
void clean();
void clean_word();
//void clean_word1();
int main(){
int t,i;
char s[201];
scanf("%d",&t);
while(t--){
scanf("%s",s);
if(s[0]=='p')
print()... | |
Vasya is writing an operating system shell, and it should have commands for working with directories. To begin with, he decided to go with just two commands: cd (change the current directory) and pwd (display the current directory).Directories in Vasya's operating system form a traditional hierarchical tree structure. ... | For each command pwd you should print the full absolute path of the given directory, ending with a slash. It should start with a slash and contain the list of slash-separated directories in the order of being nested from the root to the current folder. It should contain no dots. | C | 494ac937ba939db1dbc4081e518ab54c | 339c1dfbba60e82480a90ffad9602a0a | GNU C | standard output | 256 megabytes | train_002.jsonl | [
"data structures",
"implementation",
"*special"
] | 1330804800 | ["7\npwd\ncd /home/vasya\npwd\ncd ..\npwd\ncd vasya/../petya\npwd", "4\ncd /a/b\npwd\ncd ../a/b\npwd"] | null | PASSED | 1,400 | standard input | 3 seconds | The first line of the input data contains the single integer n (1 ≤ n ≤ 50) — the number of commands. Then follow n lines, each contains one command. Each of these lines contains either command pwd, or command cd, followed by a space-separated non-empty parameter. The command parameter cd only contains lower case Latin... | ["/\n/home/vasya/\n/home/\n/home/petya/", "/a/b/\n/a/a/b/"] | /* Problem: 158C - Cd and pwd commands */
/* Solver: Gusztav Szmolik */
#include <stdio.h>
#include <string.h>
#include <ctype.h>
#include <stdlib.h>
struct dir
{
unsigned char* nm;
struct dir* pv;
struct dir* nx;
};
struct dir* ph;
void clrmem (void);
int main ()
{
unsigned short n... | |
Vasya is writing an operating system shell, and it should have commands for working with directories. To begin with, he decided to go with just two commands: cd (change the current directory) and pwd (display the current directory).Directories in Vasya's operating system form a traditional hierarchical tree structure. ... | For each command pwd you should print the full absolute path of the given directory, ending with a slash. It should start with a slash and contain the list of slash-separated directories in the order of being nested from the root to the current folder. It should contain no dots. | C | 494ac937ba939db1dbc4081e518ab54c | 7183fec5be16720cfe9c7cf6173d2c33 | GNU C | standard output | 256 megabytes | train_002.jsonl | [
"data structures",
"implementation",
"*special"
] | 1330804800 | ["7\npwd\ncd /home/vasya\npwd\ncd ..\npwd\ncd vasya/../petya\npwd", "4\ncd /a/b\npwd\ncd ../a/b\npwd"] | null | PASSED | 1,400 | standard input | 3 seconds | The first line of the input data contains the single integer n (1 ≤ n ≤ 50) — the number of commands. Then follow n lines, each contains one command. Each of these lines contains either command pwd, or command cd, followed by a space-separated non-empty parameter. The command parameter cd only contains lower case Latin... | ["/\n/home/vasya/\n/home/\n/home/petya/", "/a/b/\n/a/a/b/"] | #include <stdio.h>
#include <string.h>
int main()
{
int n, i, j, k, l, len;
char cd[210], command[10], word[210], path[20000];
scanf ("%d", &n);
path[0] = '/';
path[1] = '\0';
j = 1;
while (n--)
{
scanf ("%s", command);
if (command[0] == 'p')
p... | |
Vasya is writing an operating system shell, and it should have commands for working with directories. To begin with, he decided to go with just two commands: cd (change the current directory) and pwd (display the current directory).Directories in Vasya's operating system form a traditional hierarchical tree structure. ... | For each command pwd you should print the full absolute path of the given directory, ending with a slash. It should start with a slash and contain the list of slash-separated directories in the order of being nested from the root to the current folder. It should contain no dots. | C | 494ac937ba939db1dbc4081e518ab54c | 71cb4c697cb5219d9dba659139822c2a | GNU C | standard output | 256 megabytes | train_002.jsonl | [
"data structures",
"implementation",
"*special"
] | 1330804800 | ["7\npwd\ncd /home/vasya\npwd\ncd ..\npwd\ncd vasya/../petya\npwd", "4\ncd /a/b\npwd\ncd ../a/b\npwd"] | null | PASSED | 1,400 | standard input | 3 seconds | The first line of the input data contains the single integer n (1 ≤ n ≤ 50) — the number of commands. Then follow n lines, each contains one command. Each of these lines contains either command pwd, or command cd, followed by a space-separated non-empty parameter. The command parameter cd only contains lower case Latin... | ["/\n/home/vasya/\n/home/\n/home/petya/", "/a/b/\n/a/a/b/"] | #include<stdio.h>
#include<string.h>
char now[10100]={"/"},pros[201];
int main()
{
// freopen("asdf","r",stdin);
short N,n,m,M;
char cmd[201],*a,*b;
scanf("%hd",&N);
getchar();
for(n=0;n<N;++n)
{
scanf("%s",cmd);
if(!strcmp(cmd,"pwd"))
{
puts(now);
... | |
Vasya is writing an operating system shell, and it should have commands for working with directories. To begin with, he decided to go with just two commands: cd (change the current directory) and pwd (display the current directory).Directories in Vasya's operating system form a traditional hierarchical tree structure. ... | For each command pwd you should print the full absolute path of the given directory, ending with a slash. It should start with a slash and contain the list of slash-separated directories in the order of being nested from the root to the current folder. It should contain no dots. | C | 494ac937ba939db1dbc4081e518ab54c | 282e7c7147dffb1c47ab987300074620 | GNU C | standard output | 256 megabytes | train_002.jsonl | [
"data structures",
"implementation",
"*special"
] | 1330804800 | ["7\npwd\ncd /home/vasya\npwd\ncd ..\npwd\ncd vasya/../petya\npwd", "4\ncd /a/b\npwd\ncd ../a/b\npwd"] | null | PASSED | 1,400 | standard input | 3 seconds | The first line of the input data contains the single integer n (1 ≤ n ≤ 50) — the number of commands. Then follow n lines, each contains one command. Each of these lines contains either command pwd, or command cd, followed by a space-separated non-empty parameter. The command parameter cd only contains lower case Latin... | ["/\n/home/vasya/\n/home/\n/home/petya/", "/a/b/\n/a/a/b/"] | #include <stdio.h>
#include <stdlib.h>
#include <string.h>
char command[5],strcd[10000]="/",string[201],str[201];
int main()
{
int n,i,m,nn,j;
scanf("%d",&m);
while(m--)
{
scanf("%s",command);
if(command[0]=='p')
{
printf("%s\n",strcd);
}
else
... | |
Vasya is writing an operating system shell, and it should have commands for working with directories. To begin with, he decided to go with just two commands: cd (change the current directory) and pwd (display the current directory).Directories in Vasya's operating system form a traditional hierarchical tree structure. ... | For each command pwd you should print the full absolute path of the given directory, ending with a slash. It should start with a slash and contain the list of slash-separated directories in the order of being nested from the root to the current folder. It should contain no dots. | C | 494ac937ba939db1dbc4081e518ab54c | 25df32029c7719410ed59700e4481187 | GNU C | standard output | 256 megabytes | train_002.jsonl | [
"data structures",
"implementation",
"*special"
] | 1330804800 | ["7\npwd\ncd /home/vasya\npwd\ncd ..\npwd\ncd vasya/../petya\npwd", "4\ncd /a/b\npwd\ncd ../a/b\npwd"] | null | PASSED | 1,400 | standard input | 3 seconds | The first line of the input data contains the single integer n (1 ≤ n ≤ 50) — the number of commands. Then follow n lines, each contains one command. Each of these lines contains either command pwd, or command cd, followed by a space-separated non-empty parameter. The command parameter cd only contains lower case Latin... | ["/\n/home/vasya/\n/home/\n/home/petya/", "/a/b/\n/a/a/b/"] | #include <stdio.h>
#include <stddef.h>
#include <stdlib.h>
#include <string.h>
#define STSIZE 5000
typedef struct path
{
char name[200];
} path_t;
path_t st[STSIZE];
path_t *lst = st;
void exec_pwd()
{
path_t *cur = st;
printf("/");
while (cur != lst)
{
printf("%s/", cur->name);
cur++;
}
prin... | |
Vasya is writing an operating system shell, and it should have commands for working with directories. To begin with, he decided to go with just two commands: cd (change the current directory) and pwd (display the current directory).Directories in Vasya's operating system form a traditional hierarchical tree structure. ... | For each command pwd you should print the full absolute path of the given directory, ending with a slash. It should start with a slash and contain the list of slash-separated directories in the order of being nested from the root to the current folder. It should contain no dots. | C | 494ac937ba939db1dbc4081e518ab54c | d92deab3dfb815877ff5eaf760005914 | GNU C | standard output | 256 megabytes | train_002.jsonl | [
"data structures",
"implementation",
"*special"
] | 1330804800 | ["7\npwd\ncd /home/vasya\npwd\ncd ..\npwd\ncd vasya/../petya\npwd", "4\ncd /a/b\npwd\ncd ../a/b\npwd"] | null | PASSED | 1,400 | standard input | 3 seconds | The first line of the input data contains the single integer n (1 ≤ n ≤ 50) — the number of commands. Then follow n lines, each contains one command. Each of these lines contains either command pwd, or command cd, followed by a space-separated non-empty parameter. The command parameter cd only contains lower case Latin... | ["/\n/home/vasya/\n/home/\n/home/petya/", "/a/b/\n/a/a/b/"] | #include<stdio.h>
#include<string.h>
int main()
{
int n,top,i,len;
char s[4],s1[200],stack[20000] = {'/'};
scanf("%d",&n);
top = 0;
while(n--)
{
scanf("%s",s);
if(strcmp(s,"pwd")==0)
{
for(i=0;i<=top;++i)
printf("%c",stack[i]);
printf("\n");
}
else if(strcmp(s,"cd") == 0)
{
scanf("%s",s1)... | |
Vasya is writing an operating system shell, and it should have commands for working with directories. To begin with, he decided to go with just two commands: cd (change the current directory) and pwd (display the current directory).Directories in Vasya's operating system form a traditional hierarchical tree structure. ... | For each command pwd you should print the full absolute path of the given directory, ending with a slash. It should start with a slash and contain the list of slash-separated directories in the order of being nested from the root to the current folder. It should contain no dots. | C | 494ac937ba939db1dbc4081e518ab54c | fdc2f321f9015fd49aed40be520a3635 | GNU C | standard output | 256 megabytes | train_002.jsonl | [
"data structures",
"implementation",
"*special"
] | 1330804800 | ["7\npwd\ncd /home/vasya\npwd\ncd ..\npwd\ncd vasya/../petya\npwd", "4\ncd /a/b\npwd\ncd ../a/b\npwd"] | null | PASSED | 1,400 | standard input | 3 seconds | The first line of the input data contains the single integer n (1 ≤ n ≤ 50) — the number of commands. Then follow n lines, each contains one command. Each of these lines contains either command pwd, or command cd, followed by a space-separated non-empty parameter. The command parameter cd only contains lower case Latin... | ["/\n/home/vasya/\n/home/\n/home/petya/", "/a/b/\n/a/a/b/"] | #include <stdio.h>
#include <string.h>
int main()
{
char cd[201],c[10],p[10000],word[201];
int n,m,i,j,k,l;
p[0]='/';
p[1]='\0';
j=1;
scanf("%d",&n);
while(n--)
{
scanf("%s",c);
if(strcmp("pwd",c)==0)
printf("%s\n",p);
else
{
scanf("%s"... | |
Vasya is writing an operating system shell, and it should have commands for working with directories. To begin with, he decided to go with just two commands: cd (change the current directory) and pwd (display the current directory).Directories in Vasya's operating system form a traditional hierarchical tree structure. ... | For each command pwd you should print the full absolute path of the given directory, ending with a slash. It should start with a slash and contain the list of slash-separated directories in the order of being nested from the root to the current folder. It should contain no dots. | C | 494ac937ba939db1dbc4081e518ab54c | e9ee238a3da081d3af3e242d4ef8af2d | GNU C | standard output | 256 megabytes | train_002.jsonl | [
"data structures",
"implementation",
"*special"
] | 1330804800 | ["7\npwd\ncd /home/vasya\npwd\ncd ..\npwd\ncd vasya/../petya\npwd", "4\ncd /a/b\npwd\ncd ../a/b\npwd"] | null | PASSED | 1,400 | standard input | 3 seconds | The first line of the input data contains the single integer n (1 ≤ n ≤ 50) — the number of commands. Then follow n lines, each contains one command. Each of these lines contains either command pwd, or command cd, followed by a space-separated non-empty parameter. The command parameter cd only contains lower case Latin... | ["/\n/home/vasya/\n/home/\n/home/petya/", "/a/b/\n/a/a/b/"] | #include <stdio.h>
#include <string.h>
int main()
{
int i,n,len;
char string[1000000],*command,incommand[201];
char *substr = NULL;
scanf("%d",&n);
string[0] = '/';
string[1] = '\0';
while(n--)
{
scanf("%s",incommand);
if(strcmp(incommand,"pwd") == 0)
printf("%s\n",string);
else
{
scanf("%s",inco... | |
Vasya is writing an operating system shell, and it should have commands for working with directories. To begin with, he decided to go with just two commands: cd (change the current directory) and pwd (display the current directory).Directories in Vasya's operating system form a traditional hierarchical tree structure. ... | For each command pwd you should print the full absolute path of the given directory, ending with a slash. It should start with a slash and contain the list of slash-separated directories in the order of being nested from the root to the current folder. It should contain no dots. | C | 494ac937ba939db1dbc4081e518ab54c | 55666f24106bd24732320d7bbd9ae49a | GNU C | standard output | 256 megabytes | train_002.jsonl | [
"data structures",
"implementation",
"*special"
] | 1330804800 | ["7\npwd\ncd /home/vasya\npwd\ncd ..\npwd\ncd vasya/../petya\npwd", "4\ncd /a/b\npwd\ncd ../a/b\npwd"] | null | PASSED | 1,400 | standard input | 3 seconds | The first line of the input data contains the single integer n (1 ≤ n ≤ 50) — the number of commands. Then follow n lines, each contains one command. Each of these lines contains either command pwd, or command cd, followed by a space-separated non-empty parameter. The command parameter cd only contains lower case Latin... | ["/\n/home/vasya/\n/home/\n/home/petya/", "/a/b/\n/a/a/b/"] | #include <stdio.h>
#define N 5000
#define M 200
char s[N][M], x[2*M];
int h;
void printPath() {
int i=0;
printf("/");
for(i=0; i<h; i++) {
printf("%s/", s[i]);
}
printf("\n");
}
void changePath(char x[]) {
int i, j;
i=j=0;
if(x[0]=='/') {
h=0;
} else... | |
Vasya is writing an operating system shell, and it should have commands for working with directories. To begin with, he decided to go with just two commands: cd (change the current directory) and pwd (display the current directory).Directories in Vasya's operating system form a traditional hierarchical tree structure. ... | For each command pwd you should print the full absolute path of the given directory, ending with a slash. It should start with a slash and contain the list of slash-separated directories in the order of being nested from the root to the current folder. It should contain no dots. | C | 494ac937ba939db1dbc4081e518ab54c | 2e61e6b5ff3a06d20005128e7b06fe7b | GNU C | standard output | 256 megabytes | train_002.jsonl | [
"data structures",
"implementation",
"*special"
] | 1330804800 | ["7\npwd\ncd /home/vasya\npwd\ncd ..\npwd\ncd vasya/../petya\npwd", "4\ncd /a/b\npwd\ncd ../a/b\npwd"] | null | PASSED | 1,400 | standard input | 3 seconds | The first line of the input data contains the single integer n (1 ≤ n ≤ 50) — the number of commands. Then follow n lines, each contains one command. Each of these lines contains either command pwd, or command cd, followed by a space-separated non-empty parameter. The command parameter cd only contains lower case Latin... | ["/\n/home/vasya/\n/home/\n/home/petya/", "/a/b/\n/a/a/b/"] | #include <stdio.h>
typedef long long int LL;
char x[202][202];
char what[100000];
int xlen = 0;
void pushpop(int start,int end)
{
if(what[start]=='/')
start++;
int i,length=0;
//for(i=start;i<=end;i++)
// putchar(what[i]);
//putchar('\n');
if(what[start]=='.' && what[start+1]=='.')
xlen-... | |
Vasya is writing an operating system shell, and it should have commands for working with directories. To begin with, he decided to go with just two commands: cd (change the current directory) and pwd (display the current directory).Directories in Vasya's operating system form a traditional hierarchical tree structure. ... | For each command pwd you should print the full absolute path of the given directory, ending with a slash. It should start with a slash and contain the list of slash-separated directories in the order of being nested from the root to the current folder. It should contain no dots. | C | 494ac937ba939db1dbc4081e518ab54c | 943f4e7d1283e6b2c8cb2983f90db23c | GNU C | standard output | 256 megabytes | train_002.jsonl | [
"data structures",
"implementation",
"*special"
] | 1330804800 | ["7\npwd\ncd /home/vasya\npwd\ncd ..\npwd\ncd vasya/../petya\npwd", "4\ncd /a/b\npwd\ncd ../a/b\npwd"] | null | PASSED | 1,400 | standard input | 3 seconds | The first line of the input data contains the single integer n (1 ≤ n ≤ 50) — the number of commands. Then follow n lines, each contains one command. Each of these lines contains either command pwd, or command cd, followed by a space-separated non-empty parameter. The command parameter cd only contains lower case Latin... | ["/\n/home/vasya/\n/home/\n/home/petya/", "/a/b/\n/a/a/b/"] | #include <stdio.h>
#include <string.h>
struct dic
{
char dicName[208];
struct dic *pre;
struct dic *next;
};
/*void printlink(struct dic *p)
{
while(p != NULL)
{
printf("%s->",p->dicName);
p=p->next;
}
printf("\n");
}*/
void print(struct dic *current)
{
//printf("kj... | |
Vasya is writing an operating system shell, and it should have commands for working with directories. To begin with, he decided to go with just two commands: cd (change the current directory) and pwd (display the current directory).Directories in Vasya's operating system form a traditional hierarchical tree structure. ... | For each command pwd you should print the full absolute path of the given directory, ending with a slash. It should start with a slash and contain the list of slash-separated directories in the order of being nested from the root to the current folder. It should contain no dots. | C | 494ac937ba939db1dbc4081e518ab54c | 471e261a201085b8b1c66084c428ea39 | GNU C | standard output | 256 megabytes | train_002.jsonl | [
"data structures",
"implementation",
"*special"
] | 1330804800 | ["7\npwd\ncd /home/vasya\npwd\ncd ..\npwd\ncd vasya/../petya\npwd", "4\ncd /a/b\npwd\ncd ../a/b\npwd"] | null | PASSED | 1,400 | standard input | 3 seconds | The first line of the input data contains the single integer n (1 ≤ n ≤ 50) — the number of commands. Then follow n lines, each contains one command. Each of these lines contains either command pwd, or command cd, followed by a space-separated non-empty parameter. The command parameter cd only contains lower case Latin... | ["/\n/home/vasya/\n/home/\n/home/petya/", "/a/b/\n/a/a/b/"] | #include <stdio.h>
#include <stdlib.h>
#include <string.h>
typedef struct node *node_t;
typedef struct list *list_t;
struct node{
char path[201];
node_t next;
node_t prev;
};
struct list{
node_t path;
node_t last;
};
list_t add(list_t list, char *path){
node_t new = calloc(1, sizeof(struct node));
str... | |
Vasya is writing an operating system shell, and it should have commands for working with directories. To begin with, he decided to go with just two commands: cd (change the current directory) and pwd (display the current directory).Directories in Vasya's operating system form a traditional hierarchical tree structure. ... | For each command pwd you should print the full absolute path of the given directory, ending with a slash. It should start with a slash and contain the list of slash-separated directories in the order of being nested from the root to the current folder. It should contain no dots. | C | 494ac937ba939db1dbc4081e518ab54c | 60ca81e885258dee8912e4ba8bf49997 | GNU C | standard output | 256 megabytes | train_002.jsonl | [
"data structures",
"implementation",
"*special"
] | 1330804800 | ["7\npwd\ncd /home/vasya\npwd\ncd ..\npwd\ncd vasya/../petya\npwd", "4\ncd /a/b\npwd\ncd ../a/b\npwd"] | null | PASSED | 1,400 | standard input | 3 seconds | The first line of the input data contains the single integer n (1 ≤ n ≤ 50) — the number of commands. Then follow n lines, each contains one command. Each of these lines contains either command pwd, or command cd, followed by a space-separated non-empty parameter. The command parameter cd only contains lower case Latin... | ["/\n/home/vasya/\n/home/\n/home/petya/", "/a/b/\n/a/a/b/"] | #include<stdio.h>
#include<stdlib.h>
#include<string.h>
int main(){
void moveleft(char *ch,int n);
void del_till_slash(char *ch);
char a[300],*dir,b[200][300],result[60][100000],tmp[100000];
/*tag��ʾ�Ƿ�Ӹ�Ŀ¼��ʼ��step��ʾ����cd����֮��Ŀ��*/
int i,j=0,k=0,n,tag,step=0,repeat[60];
int cmd[60];
mem... | |
A team quiz game called "What? Where? When?" is very popular in Berland. The game is centered on two teams competing. They are the team of six Experts versus the team of the Audience. A person from the audience asks a question and the experts are allowed a minute on brainstorming and finding the right answer to the que... | Print the single number — the number of the sector containing the question the experts will be asked. It is guaranteed that the answer exists, that is that not all the questions have already been asked. | C | 1378b4c9ba8029d310f07a1027a8c7a6 | b994594d8a7a4be8a5c0e05e6260d4e3 | GNU C | output.txt | 256 megabytes | train_002.jsonl | [
"implementation"
] | 1318919400 | ["5 5\n0 1 0 1 0", "2 1\n1 1"] | null | PASSED | 1,100 | input.txt | 1 second | The first line contains two positive integers n and k (1 ≤ n ≤ 1000 and 1 ≤ k ≤ n) — the numbers of sectors on the table and the number of the sector where the arrow is pointing. The second line contains n numbers: ai = 0 if the question from sector i has already been asked and ai = 1 if the question from sector i hasn... | ["2", "1"] | #include<stdio.h>
int main(){
freopen("input.txt","r",stdin);
freopen("output.txt","w",stdout);
int n,m,i,j,a[1001],temp=1;
int count;
scanf("%d %d",&n,&m);
for(i=0;i<n;i++){
scanf("%d",&a[i]);
}
int pos=m-1;
for(i=0;i<n;i++){
if(a[pos]==0){
pos=(pos+1)%n;
... | |
A team quiz game called "What? Where? When?" is very popular in Berland. The game is centered on two teams competing. They are the team of six Experts versus the team of the Audience. A person from the audience asks a question and the experts are allowed a minute on brainstorming and finding the right answer to the que... | Print the single number — the number of the sector containing the question the experts will be asked. It is guaranteed that the answer exists, that is that not all the questions have already been asked. | C | 1378b4c9ba8029d310f07a1027a8c7a6 | d05c19d0beaac18311c9ac1dae0b85d0 | GNU C | output.txt | 256 megabytes | train_002.jsonl | [
"implementation"
] | 1318919400 | ["5 5\n0 1 0 1 0", "2 1\n1 1"] | null | PASSED | 1,100 | input.txt | 1 second | The first line contains two positive integers n and k (1 ≤ n ≤ 1000 and 1 ≤ k ≤ n) — the numbers of sectors on the table and the number of the sector where the arrow is pointing. The second line contains n numbers: ai = 0 if the question from sector i has already been asked and ai = 1 if the question from sector i hasn... | ["2", "1"] | #include<stdio.h>
int main(){
freopen("input.txt","r",stdin);
freopen("output.txt","w",stdout);
int n,m,i,j,a[1001],temp=1;
int count;
scanf("%d %d",&n,&m);
for(i=0;i<n;i++){
scanf("%d",&a[i]);
}
int pos=m-1;
for(i=0;i<n;i++){
if(a[pos]==0){
pos=(p... | |
A team quiz game called "What? Where? When?" is very popular in Berland. The game is centered on two teams competing. They are the team of six Experts versus the team of the Audience. A person from the audience asks a question and the experts are allowed a minute on brainstorming and finding the right answer to the que... | Print the single number — the number of the sector containing the question the experts will be asked. It is guaranteed that the answer exists, that is that not all the questions have already been asked. | C | 1378b4c9ba8029d310f07a1027a8c7a6 | 2423bf2b3237327cc82aa92bcff0f4b3 | GNU C | output.txt | 256 megabytes | train_002.jsonl | [
"implementation"
] | 1318919400 | ["5 5\n0 1 0 1 0", "2 1\n1 1"] | null | PASSED | 1,100 | input.txt | 1 second | The first line contains two positive integers n and k (1 ≤ n ≤ 1000 and 1 ≤ k ≤ n) — the numbers of sectors on the table and the number of the sector where the arrow is pointing. The second line contains n numbers: ai = 0 if the question from sector i has already been asked and ai = 1 if the question from sector i hasn... | ["2", "1"] | #include <stdio.h>
#include <string.h>
int main()
{
FILE *in, *out;
int n, k, a[10005], i, flag=0, flag2 = 0, l, r;
in = fopen("input.txt", "r");
out = fopen("output.txt", "w");
fscanf(in, "%d %d", &n, &k);
//scanf("%d %d", &n, &k);
for (i=1; i<=n; i++)
{
fscanf(in, "%d", &a[i]);
//scanf("%d", &a[i]);
if ... | |
A team quiz game called "What? Where? When?" is very popular in Berland. The game is centered on two teams competing. They are the team of six Experts versus the team of the Audience. A person from the audience asks a question and the experts are allowed a minute on brainstorming and finding the right answer to the que... | Print the single number — the number of the sector containing the question the experts will be asked. It is guaranteed that the answer exists, that is that not all the questions have already been asked. | C | 1378b4c9ba8029d310f07a1027a8c7a6 | d05c4d5e13644e828916cfed2be035f2 | GNU C | output.txt | 256 megabytes | train_002.jsonl | [
"implementation"
] | 1318919400 | ["5 5\n0 1 0 1 0", "2 1\n1 1"] | null | PASSED | 1,100 | input.txt | 1 second | The first line contains two positive integers n and k (1 ≤ n ≤ 1000 and 1 ≤ k ≤ n) — the numbers of sectors on the table and the number of the sector where the arrow is pointing. The second line contains n numbers: ai = 0 if the question from sector i has already been asked and ai = 1 if the question from sector i hasn... | ["2", "1"] | #include <stdio.h>
#include <string.h>
int main()
{
int n,k,i,j;
FILE *fp,*fp2;
fp=fopen("input.txt","r");
fp2=fopen("output.txt","w");
fscanf(fp,"%d %d",&n,&k);
int a[n];
for(i=0;i<n;i++)
{
fscanf(fp,"%d",&a[i]);
}
for(j=k-1;j<n;j++)
{
if(a[j]==1)
{
fprintf(fp2,"%d\n",j+1);
return 0;
}
}
f... | |
A team quiz game called "What? Where? When?" is very popular in Berland. The game is centered on two teams competing. They are the team of six Experts versus the team of the Audience. A person from the audience asks a question and the experts are allowed a minute on brainstorming and finding the right answer to the que... | Print the single number — the number of the sector containing the question the experts will be asked. It is guaranteed that the answer exists, that is that not all the questions have already been asked. | C | 1378b4c9ba8029d310f07a1027a8c7a6 | 83ba2319ca98d8c59a5e22f6373d38b1 | GNU C | output.txt | 256 megabytes | train_002.jsonl | [
"implementation"
] | 1318919400 | ["5 5\n0 1 0 1 0", "2 1\n1 1"] | null | PASSED | 1,100 | input.txt | 1 second | The first line contains two positive integers n and k (1 ≤ n ≤ 1000 and 1 ≤ k ≤ n) — the numbers of sectors on the table and the number of the sector where the arrow is pointing. The second line contains n numbers: ai = 0 if the question from sector i has already been asked and ai = 1 if the question from sector i hasn... | ["2", "1"] | #include<stdio.h>
#include<stdlib.h>
int main()
{
int n,k,i;
FILE *fpi,*fpo;
fpi=fopen("input.txt","r");
fpo=fopen("output.txt","w");
fscanf(fpi,"%d%d",&n,&k);
int *arr=(int*)calloc(n,sizeof(int));
for(i=0;i<n;i++)
fscanf(fpi,"%d",&arr[i]);
i=k-1;
while(arr[i]!=1) {i++;if(i==... | |
A team quiz game called "What? Where? When?" is very popular in Berland. The game is centered on two teams competing. They are the team of six Experts versus the team of the Audience. A person from the audience asks a question and the experts are allowed a minute on brainstorming and finding the right answer to the que... | Print the single number — the number of the sector containing the question the experts will be asked. It is guaranteed that the answer exists, that is that not all the questions have already been asked. | C | 1378b4c9ba8029d310f07a1027a8c7a6 | bc7c716c5d095760747c007a911a72df | GNU C | output.txt | 256 megabytes | train_002.jsonl | [
"implementation"
] | 1318919400 | ["5 5\n0 1 0 1 0", "2 1\n1 1"] | null | PASSED | 1,100 | input.txt | 1 second | The first line contains two positive integers n and k (1 ≤ n ≤ 1000 and 1 ≤ k ≤ n) — the numbers of sectors on the table and the number of the sector where the arrow is pointing. The second line contains n numbers: ai = 0 if the question from sector i has already been asked and ai = 1 if the question from sector i hasn... | ["2", "1"] | #include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <math.h>
int main()
{
int k , n, i, a[1000];
FILE *f1, *f2;
f1 = fopen("input.txt", "r");
f2 = fopen("output.txt", "w");
fscanf(f1, "%d%d", &n, &k);
k--;
for(i = 0; i < n; i++)
fscanf(f1, "%d", &a[i]);
while(a[... | |
A team quiz game called "What? Where? When?" is very popular in Berland. The game is centered on two teams competing. They are the team of six Experts versus the team of the Audience. A person from the audience asks a question and the experts are allowed a minute on brainstorming and finding the right answer to the que... | Print the single number — the number of the sector containing the question the experts will be asked. It is guaranteed that the answer exists, that is that not all the questions have already been asked. | C | 1378b4c9ba8029d310f07a1027a8c7a6 | dc75ba24a752e54453491926146502ac | GNU C | output.txt | 256 megabytes | train_002.jsonl | [
"implementation"
] | 1318919400 | ["5 5\n0 1 0 1 0", "2 1\n1 1"] | null | PASSED | 1,100 | input.txt | 1 second | The first line contains two positive integers n and k (1 ≤ n ≤ 1000 and 1 ≤ k ≤ n) — the numbers of sectors on the table and the number of the sector where the arrow is pointing. The second line contains n numbers: ai = 0 if the question from sector i has already been asked and ai = 1 if the question from sector i hasn... | ["2", "1"] | #include <stdio.h>
#include <string.h>
int main(void)
{
int i,n,k,arr[1005],res;
freopen("input.txt","r",stdin);
freopen("output.txt","w",stdout);
scanf("%d%d",&n,&k);
for(i=1;i<=n;i++)
scanf("%d",&arr[i]);
for(i=k;i<=n;)
{
if(arr[i]==1)
{
res=i;
... | |
A team quiz game called "What? Where? When?" is very popular in Berland. The game is centered on two teams competing. They are the team of six Experts versus the team of the Audience. A person from the audience asks a question and the experts are allowed a minute on brainstorming and finding the right answer to the que... | Print the single number — the number of the sector containing the question the experts will be asked. It is guaranteed that the answer exists, that is that not all the questions have already been asked. | C | 1378b4c9ba8029d310f07a1027a8c7a6 | e9751156ea38655ad57308d7e978b5d9 | GNU C | output.txt | 256 megabytes | train_002.jsonl | [
"implementation"
] | 1318919400 | ["5 5\n0 1 0 1 0", "2 1\n1 1"] | null | PASSED | 1,100 | input.txt | 1 second | The first line contains two positive integers n and k (1 ≤ n ≤ 1000 and 1 ≤ k ≤ n) — the numbers of sectors on the table and the number of the sector where the arrow is pointing. The second line contains n numbers: ai = 0 if the question from sector i has already been asked and ai = 1 if the question from sector i hasn... | ["2", "1"] | #include <stdio.h>
#include <string.h>
#include <stdlib.h>
int vis[1001];
int d[10001];
int main()
{
freopen("input.txt","r",stdin);
freopen("output.txt","w",stdout);
int n,m;
int a[10001];
while(~scanf("%d %d",&n,&m))
{
memset(vis,0,sizeof(vis));
for(int i=1;i<=n;i++)
{
... | |
A team quiz game called "What? Where? When?" is very popular in Berland. The game is centered on two teams competing. They are the team of six Experts versus the team of the Audience. A person from the audience asks a question and the experts are allowed a minute on brainstorming and finding the right answer to the que... | Print the single number — the number of the sector containing the question the experts will be asked. It is guaranteed that the answer exists, that is that not all the questions have already been asked. | C | 1378b4c9ba8029d310f07a1027a8c7a6 | f226783379f21b1a8e84f49f65ceab20 | GNU C | output.txt | 256 megabytes | train_002.jsonl | [
"implementation"
] | 1318919400 | ["5 5\n0 1 0 1 0", "2 1\n1 1"] | null | PASSED | 1,100 | input.txt | 1 second | The first line contains two positive integers n and k (1 ≤ n ≤ 1000 and 1 ≤ k ≤ n) — the numbers of sectors on the table and the number of the sector where the arrow is pointing. The second line contains n numbers: ai = 0 if the question from sector i has already been asked and ai = 1 if the question from sector i hasn... | ["2", "1"] | #include<stdio.h>
int main()
{ int n,k,i,a[1005];
freopen("input.txt","r",stdin);
freopen("output.txt","w",stdout);
scanf("%d%d",&n,&k);
for(i=0;i<n;i++)
scanf("%d",&a[i]);
r:
if(a[k-1]==0)
{
k++;
if(k>n)
{
k=1;
goto r;
}
goto r;
}
else
printf("%d",k);
return 0;
} | |
A team quiz game called "What? Where? When?" is very popular in Berland. The game is centered on two teams competing. They are the team of six Experts versus the team of the Audience. A person from the audience asks a question and the experts are allowed a minute on brainstorming and finding the right answer to the que... | Print the single number — the number of the sector containing the question the experts will be asked. It is guaranteed that the answer exists, that is that not all the questions have already been asked. | C | 1378b4c9ba8029d310f07a1027a8c7a6 | bc66432a73e95f5cb92615795933991e | GNU C | output.txt | 256 megabytes | train_002.jsonl | [
"implementation"
] | 1318919400 | ["5 5\n0 1 0 1 0", "2 1\n1 1"] | null | PASSED | 1,100 | input.txt | 1 second | The first line contains two positive integers n and k (1 ≤ n ≤ 1000 and 1 ≤ k ≤ n) — the numbers of sectors on the table and the number of the sector where the arrow is pointing. The second line contains n numbers: ai = 0 if the question from sector i has already been asked and ai = 1 if the question from sector i hasn... | ["2", "1"] | #include<stdio.h>
int main()
{
int n,k,i,j,min=0,ans=0;
FILE *in;
in=fopen("input.txt","r");
FILE *wr;
wr=fopen("output.txt","w");
fscanf(in,"%d%d\n",&n,&k);
// printf("%d%d",n,k);
// fscanf(in,"%d\n",k);
for(i=1;i<=n;i++)
{
fscanf(in,"%d",&j);
if(j==1&&min==... | |
A team quiz game called "What? Where? When?" is very popular in Berland. The game is centered on two teams competing. They are the team of six Experts versus the team of the Audience. A person from the audience asks a question and the experts are allowed a minute on brainstorming and finding the right answer to the que... | Print the single number — the number of the sector containing the question the experts will be asked. It is guaranteed that the answer exists, that is that not all the questions have already been asked. | C | 1378b4c9ba8029d310f07a1027a8c7a6 | 1ea794e76e5f3f87bc6ec2b0014b74b0 | GNU C | output.txt | 256 megabytes | train_002.jsonl | [
"implementation"
] | 1318919400 | ["5 5\n0 1 0 1 0", "2 1\n1 1"] | null | PASSED | 1,100 | input.txt | 1 second | The first line contains two positive integers n and k (1 ≤ n ≤ 1000 and 1 ≤ k ≤ n) — the numbers of sectors on the table and the number of the sector where the arrow is pointing. The second line contains n numbers: ai = 0 if the question from sector i has already been asked and ai = 1 if the question from sector i hasn... | ["2", "1"] | #include <stdio.h>
#include <stdlib.h>
int main()
{
int n,k,i, a[1005];
FILE *INP, *OUTP;
INP = fopen("input.txt", "r");
OUTP = fopen("output.txt", "w");
fscanf(INP, "%d %d", &n,&k);
for(i=1;i<=n;i++) fscanf(INP, "%d", &a[i]);
while(a[k]!=1)
{
k++;
if (k>n) k-=n;
}
... | |
A team quiz game called "What? Where? When?" is very popular in Berland. The game is centered on two teams competing. They are the team of six Experts versus the team of the Audience. A person from the audience asks a question and the experts are allowed a minute on brainstorming and finding the right answer to the que... | Print the single number — the number of the sector containing the question the experts will be asked. It is guaranteed that the answer exists, that is that not all the questions have already been asked. | C | 1378b4c9ba8029d310f07a1027a8c7a6 | 73e1d0dbc385a82f78716426aa9533fe | GNU C | output.txt | 256 megabytes | train_002.jsonl | [
"implementation"
] | 1318919400 | ["5 5\n0 1 0 1 0", "2 1\n1 1"] | null | PASSED | 1,100 | input.txt | 1 second | The first line contains two positive integers n and k (1 ≤ n ≤ 1000 and 1 ≤ k ≤ n) — the numbers of sectors on the table and the number of the sector where the arrow is pointing. The second line contains n numbers: ai = 0 if the question from sector i has already been asked and ai = 1 if the question from sector i hasn... | ["2", "1"] | #include<stdio.h>
#define nprintf(x,y) fprintf(file,x,y)
int main(){
int a[1005],n,k,i;
FILE *file = fopen("output.txt","w");
freopen ("input.txt","r",stdin);
scanf("%d%d",&n,&k);
for(i=1;i<=n;i++) scanf("%d",&a[i]);
while(!a[k])k=(k==n)?1:(k+1);
nprintf("%d",k);
fclose(file);
return 0;
}
| |
A team quiz game called "What? Where? When?" is very popular in Berland. The game is centered on two teams competing. They are the team of six Experts versus the team of the Audience. A person from the audience asks a question and the experts are allowed a minute on brainstorming and finding the right answer to the que... | Print the single number — the number of the sector containing the question the experts will be asked. It is guaranteed that the answer exists, that is that not all the questions have already been asked. | C | 1378b4c9ba8029d310f07a1027a8c7a6 | 9a3e7550031ad97f04fa7687b6d22218 | GNU C | output.txt | 256 megabytes | train_002.jsonl | [
"implementation"
] | 1318919400 | ["5 5\n0 1 0 1 0", "2 1\n1 1"] | null | PASSED | 1,100 | input.txt | 1 second | The first line contains two positive integers n and k (1 ≤ n ≤ 1000 and 1 ≤ k ≤ n) — the numbers of sectors on the table and the number of the sector where the arrow is pointing. The second line contains n numbers: ai = 0 if the question from sector i has already been asked and ai = 1 if the question from sector i hasn... | ["2", "1"] | #include <stdio.h>
int main()
{
freopen("input.txt","r",stdin);
freopen("output.txt","w",stdout);
int n, k;
scanf("%d%d", &n, &k);
k--;
int ar[n];
int i;
for(i=0;i<n;i++)
scanf("%d", ar+i);
while(!ar[k])
k = (k+1)%n;
printf("%d\n", k+1);
return 0;
}
| |
A team quiz game called "What? Where? When?" is very popular in Berland. The game is centered on two teams competing. They are the team of six Experts versus the team of the Audience. A person from the audience asks a question and the experts are allowed a minute on brainstorming and finding the right answer to the que... | Print the single number — the number of the sector containing the question the experts will be asked. It is guaranteed that the answer exists, that is that not all the questions have already been asked. | C | 1378b4c9ba8029d310f07a1027a8c7a6 | dd70a7f6426466458a176c2e4f42bcfe | GNU C | output.txt | 256 megabytes | train_002.jsonl | [
"implementation"
] | 1318919400 | ["5 5\n0 1 0 1 0", "2 1\n1 1"] | null | PASSED | 1,100 | input.txt | 1 second | The first line contains two positive integers n and k (1 ≤ n ≤ 1000 and 1 ≤ k ≤ n) — the numbers of sectors on the table and the number of the sector where the arrow is pointing. The second line contains n numbers: ai = 0 if the question from sector i has already been asked and ai = 1 if the question from sector i hasn... | ["2", "1"] | #include <stdio.h>
#include <math.h>
#include <string.h>
#include <stdlib.h>
FILE *fIN,*fOUT;
char buf[9];
int n,k,i,j,a[10000];
main(){
fIN=fopen("input.txt","r");
fOUT=fopen("output.txt","w");
fscanf(fIN,"%d%d",&n,&k);
for(i=1;i<=n;i++) fscanf(fIN,"%d",a+i);
i=k;
while(1){
if(a[i]) br... | |
A team quiz game called "What? Where? When?" is very popular in Berland. The game is centered on two teams competing. They are the team of six Experts versus the team of the Audience. A person from the audience asks a question and the experts are allowed a minute on brainstorming and finding the right answer to the que... | Print the single number — the number of the sector containing the question the experts will be asked. It is guaranteed that the answer exists, that is that not all the questions have already been asked. | C | 1378b4c9ba8029d310f07a1027a8c7a6 | e43c54b057e959343e40153addae120f | GNU C | output.txt | 256 megabytes | train_002.jsonl | [
"implementation"
] | 1318919400 | ["5 5\n0 1 0 1 0", "2 1\n1 1"] | null | PASSED | 1,100 | input.txt | 1 second | The first line contains two positive integers n and k (1 ≤ n ≤ 1000 and 1 ≤ k ≤ n) — the numbers of sectors on the table and the number of the sector where the arrow is pointing. The second line contains n numbers: ai = 0 if the question from sector i has already been asked and ai = 1 if the question from sector i hasn... | ["2", "1"] | //#include <bits/stdc++.h>
//#include <algorithm>
#include <stdio.h>
//using namespace std;
int main()
{
freopen("input.txt","r",stdin);
freopen("output.txt","w",stdout);
int n,k;
scanf("%d %d",&n,&k);
int i,j,ara[2000];
for(i=1; i<=n; i++)
{
scanf("%d",&ara[i]);
}
for(i=k; ... | |
Peppa the Pig was walking and walked into the forest. What a strange coincidence! The forest has the shape of a rectangle, consisting of n rows and m columns. We enumerate the rows of the rectangle from top to bottom with numbers from 1 to n, and the columns — from left to right with numbers from 1 to m. Let's denote t... | Print a single integer — the number of beautiful paths modulo 109 + 7. | C | 07fb2247b4b4ee5d3592fda21b814c7c | 81d7dcc9a3a98c45381e25aa0239b0bc | GNU C11 | standard output | 256 megabytes | train_002.jsonl | [
"dp",
"combinatorics"
] | 1439483400 | ["3 4\naaab\nbaaa\nabba"] | NotePicture illustrating possibilities for the sample test. | PASSED | 2,300 | standard input | 4 seconds | The first line contains two integers n, m (1 ≤ n, m ≤ 500) — the height and width of the field. Each of the following n lines contains m lowercase English letters identifying the types of cells of the forest. Identical cells are represented by identical letters, different cells are represented by different letters. | ["3"] | #include<stdio.h>
int mod=1000000007;
int dp[510][510];
int dpb[510][510];
char a[510][510];
char b[1010][510];
int n,m;
int main(){
int i,j,k;
scanf("%d%d",&n,&m);
for(i=0;i<n;i++){
scanf("%s",&a[i]);
}
if(n<m){
k=n;
n=m;
m=k;
for(i=0;i<n;i++){
fo... | |
Peppa the Pig was walking and walked into the forest. What a strange coincidence! The forest has the shape of a rectangle, consisting of n rows and m columns. We enumerate the rows of the rectangle from top to bottom with numbers from 1 to n, and the columns — from left to right with numbers from 1 to m. Let's denote t... | Print a single integer — the number of beautiful paths modulo 109 + 7. | C | 07fb2247b4b4ee5d3592fda21b814c7c | 6bbee385788a6e0f0ccdf40b0e8d12d2 | GNU C | standard output | 256 megabytes | train_002.jsonl | [
"dp",
"combinatorics"
] | 1439483400 | ["3 4\naaab\nbaaa\nabba"] | NotePicture illustrating possibilities for the sample test. | PASSED | 2,300 | standard input | 4 seconds | The first line contains two integers n, m (1 ≤ n, m ≤ 500) — the height and width of the field. Each of the following n lines contains m lowercase English letters identifying the types of cells of the forest. Identical cells are represented by identical letters, different cells are represented by different letters. | ["3"] | #include <stdio.h>
#include <string.h>
#include <stdbool.h>
#define MAX 502
#define MOD 1000000007
#define clr(ar) memset(ar, 0, sizeof(ar))
#define read() freopen("lol.txt", "r", stdin)
#define valid(i, j, k, l) ((i) >= 0 && (i) < n && (j) >= 0 && (j) < m && (k) >= 0 && (k) < n && (l) >= 0 && (l) < m)
char str[MAX][... | |
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 | a001f4d1ce762a247b34ec48e7612baa | 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 MAX_N 1111
int n, m, rsum[MAX_N], csum[MAX_N];
char c[MAX_N][MAX_N];
int main(){
int i, j, total=0;
scanf("%d%d",&n,&m);
for(i=0;i<n;i++) scanf("%s", c[i]);
for(i=0;i<n;i++) for(j=0;j<m;j++)
if(c[i][j]=='*') rsum[i]++, csum[j]++, total++;
for(i=0;i<n;i++) for(j=0;j<m;j++){
if(rsum[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 | 55b19cade03beb1198b39f02f11e6752 | 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 a,b,i,j,d=0,count=0,e=0,f=0,g,h,This_is_my_first_time=1,cases=1,k,numbering=0,y=0;
char c[1010],x;
scanf("%d %d",&a,&b);
for(i=0;i<a;i++)
{
scanf("%d",&x);
gets(c);
if(This_is_my_first_time==1)
{
for(j=0;j<b;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 | 0e9334f759196e4092775d68b370985e | 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 <limits.h>
int main()
{
int n,m,i,row[1005],col[1005],j,count,total=0,flag=0;
char mat[1005][1005];
scanf("%d %d",&n,&m);
for(i=0;i<n;i++)
{
row[i]=0;
}
for(j=0;j<m;j++)
{
col[i]=0;
}
for(i=0;i<n;i++)
{
scanf("%s",mat[i]);
}
for(i=0;i<n;i++)
{
for(j=0;j<m;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 | 1ca739710bf11b4a70babab860beb8a3 | 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<stdlib.h>
#include<math.h>
int main()
{
char s[1010][1010];
int r[1010],c[1010];
int n,m,k1,k2,i,j,k;
k=k1=k2=0;
scanf("%d%d",&n,&m);
for(i=1;i<=n;i++)
scanf("%s",s[i]+1);
for(i=1;i<=n;i++)
for(j=1;j<=m;j++)
if(s[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 | af33073de48e22993dc06c6cd134b6fd | 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 N 1005
char s[N][N];
int i,j,n,m,num;
int h[N],l[N];
int main()
{
scanf("%d %d",&n,&m);
for(i=1;i<=n;i++){
scanf("%s",s[i]);
for(j=1;j<=m;j++)
if(s[i][j-1]=='*')num++,h[i]++,l[j]++;
}
for(i=1;i<=n;i++)
for(j=1;j<=m;j++)
if(h[i]+l[j]-(s[i][j-1]=='*')==num){puts("YES");printf("%d... | |
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 | ea1e4c9fe583f3c647e9fee2232ca008 | 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"] | //Date:19-07-16
#include<stdio.h>
#include<string.h>
#define For(i ,n) for(i=1;i<=n;i++)
int row[1001] = {0} ,col[1001] = {0} ,wall[1001][1001];
int main(){
int n,m ,i ,j;
scanf("%d%d" ,&n ,&m);
char c;
int total =0;
memset(wall ,0 ,sizeof(wall));
For(i ,n)
For(j ,m){
scanf(" %c" ,&c);
if(c=='*') row[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 | 5bcb04618a34e123d655fc828fa01693 | 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 r,c,i,j;
char ch;
scanf("%d %d",&r,&c);
getchar();
int row[r],col[c];
char a[r][c];
memset(row,0,sizeof(row));
memset(col,0,sizeof(col));
int wall=0;
for(i=0;i<r;i++)
{
for(j=0;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 | b0ada2314e6897b814448cd0e5a286cd | 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 cmp(const void * a, const void * b)
{
return ( *(int*)a - *(int*)b );
}
int main()
{
int n, m, i = 0, j = 0, k = 0;
scanf("%d%d", &n, &m);
char grid[n][m];
for(i; i < n; i++)
{
scanf("%s", grid[i]);
}
int bombx[n*m], bomby[n*m], tempy[n*m... | |
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 | aaa9a59ff731a18adbba6693f4cf0ffd | 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 <limits.h>
#include <string.h>
int main(int argc, char* argv[]){
int n, m;
scanf("%d", &n);
scanf("%d", &m);
int nb_walls = 0;
char c;
int ligne[n+1];
int colonne[m+1];
int grille[n +1][m +1];
memset(ligne, 0, sizeof ligne);
memset... | |
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 | 12afb2162d86a141ed0fe94abacc55c8 | 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 Map[1000][1001];
int Row[1001];
int Col[1001];
int main()
{
int N, M, Sum = 0;
scanf("%d %d", &N, &M);
for(int i = 0; i < N; ++i) {
scanf("%s", Map[i]);
for(int j = 0; j < M; ++j) {
if(Map[i][j] == '*') {
++Row[i];
++Col[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 | e106284863354f4551c9df8a89bcf523 | 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"] | #define N 1001
//成功了,这里的处理非常细心!
#include<stdio.h>
//从更简单的角度来处理
//采用扫描的办法!
int main() {
int n,m;
scanf("%d%d",&n,&m);
//printf(stderr,"n=%d,m=%d\n",n,m);
int i,j;
char field[N][N];
for(i=0;i<n;i++){
scanf("%s",field[i]);
}
//扫描过程中统计哪些行被占了了!
//哪些列被占领了!
int rows=0;
int x... | |
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 | 7749a098b3f0bd116a4569f985c15149 | 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"] | #define N 1001
#include<stdio.h>
//从更简单的角度来处理
//采用扫描的办法!
int main() {
int n,m;
scanf("%d%d",&n,&m);
//printf(stderr,"n=%d,m=%d\n",n,m);
int i,j;
char field[N][N];
for(i=0;i<n;i++){
scanf("%s",field[i]);
}
//扫描过程中统计哪些行被占了了!
//哪些列被占领了!
int rows=0;
int x=0;
int y=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 | 98975b12aa52aeeba79210cda5836dc0 | 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()
{
char s[2000][2000];
int n,m,i,j,bomb=0,ans=0,count=0,row[2000],column[2000];
scanf("%d %d",&n,&m);
getchar();
for(i=1;i<=n;i++)
{
bomb=0;
for(j=1;j<=m;j++)
{
scanf("%c",&s[i][j]);
if(s[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 | 96eefab7940adeada9427587067184bc | 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 i,j,n=0,r,c,count=0,m;
int t;
scanf("%d %d\n",&r,&c);
char mat[r][c];
for(i=0;i<r;i++)
{
for(j=0;j<c;j++)
{
scanf("%c",&mat[i][j]);
if(mat[i][j]=='*')
count++;
}
if(i!=r-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 | 475a6d5c0dd9b2b5da35f64524a683bb | 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 SIZE 1000
int main()
{
int n, m, row[SIZE] = { 0 }, col[SIZE] = { 0 }, i, j, maxr, maxc, cnt = 0, ansr, ansc;
char s[SIZE][SIZE + 1];
scanf ("%d %d\n", &n, &m);
for (i = 0; i < n; i++)
gets (s[i]);
for (i = 0; i < n; i++)
for (j = 0; j < m; j++)
if (s[i][j] == '*') {
cnt++... | |
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 | 7b3b656e7cf9257b1ac3c41356badbda | 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>
#include <string.h>
int row[1010];
int col[1010];
char mat[1010][1010];
int main() {
int n, m;
int num = 0;
int i, j;
scanf("%d %d", &n, &m);
for (i = 0; i < n; i++) {
for (j = 0; j < m; j++) {
scanf(" %c", &mat[i][j]);
if (mat[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 | 2745472c0e32ba2976d908c441192fa8 | 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 x,y;
int f[1010];
int c[1010];
char map[1010][1010];
int main(){
int i,j,t;
scanf("%d %d",&x,&y);
for(i=t=0;i<x;i++){
scanf("%s",map[i]);
for(j=0;j<y;j++){
if(map[i][j]=='*'){
t++;
f[i]++;
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 | 2c904eca0f8542924924b43f88e0dc54 | 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 () {
char grid[1005][1005];
int n, m, i, j;
scanf("%d %d", &n, &m);
for (i = 0; i < n; i++) {
scanf("%s", grid[i]);
}
int horizontal[1005];
int vertical[1005];
for (i = 0; i <= 1000; i++) {
horizontal[i] = vertical[i] = 0;
}
int total = 0;
for (i = 0; i < n; i++... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.