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 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
There are n walruses standing in a queue in an airport. They are numbered starting from the queue's tail: the 1-st walrus stands at the end of the queue and the n-th walrus stands at the beginning of the queue. The i-th walrus has the age equal to ai.The i-th walrus becomes displeased if there's a younger walrus standi... | Print n numbers: if the i-th walrus is pleased with everything, print "-1" (without the quotes). Otherwise, print the i-th walrus's displeasure: the number of other walruses that stand between him and the furthest from him younger walrus. | C | 668f85cc331bc7bcdd708d9190bbd6e8 | fb817e4aa1da36603bdba818e555c3eb | GNU C | standard output | 256 megabytes | train_002.jsonl | [
"data structures",
"binary search"
] | 1308582000 | ["6\n10 8 5 3 50 45", "7\n10 4 6 3 2 8 15", "5\n10 3 1 10 11"] | null | PASSED | 1,500 | standard input | 2 seconds | The first line contains an integer n (2 ≤ n ≤ 105) — the number of walruses in the queue. The second line contains integers ai (1 ≤ ai ≤ 109). Note that some walruses can have the same age but for the displeasure to emerge the walrus that is closer to the head of the queue needs to be strictly younger than the other on... | ["2 1 0 -1 0 -1", "4 2 1 0 -1 -1 -1", "1 0 -1 -1 -1"] | #include<stdio.h>
#include<stdlib.h>
typedef struct IndM{
long long int I;
struct IndM *Sgte;
} INDM;
int minimo(INDM *, int * , int );
int main(){
int i,cant;
INDM *aux;
INDM *indices;
scanf("%d",&cant);
int edad[cant],desc[cant];
for(i=0;i<cant;i++){
scanf(... | |
There are n walruses standing in a queue in an airport. They are numbered starting from the queue's tail: the 1-st walrus stands at the end of the queue and the n-th walrus stands at the beginning of the queue. The i-th walrus has the age equal to ai.The i-th walrus becomes displeased if there's a younger walrus standi... | Print n numbers: if the i-th walrus is pleased with everything, print "-1" (without the quotes). Otherwise, print the i-th walrus's displeasure: the number of other walruses that stand between him and the furthest from him younger walrus. | C | 668f85cc331bc7bcdd708d9190bbd6e8 | 3158310cb2a3b73333e26fe2f18890e0 | GNU C | standard output | 256 megabytes | train_002.jsonl | [
"data structures",
"binary search"
] | 1308582000 | ["6\n10 8 5 3 50 45", "7\n10 4 6 3 2 8 15", "5\n10 3 1 10 11"] | null | PASSED | 1,500 | standard input | 2 seconds | The first line contains an integer n (2 ≤ n ≤ 105) — the number of walruses in the queue. The second line contains integers ai (1 ≤ ai ≤ 109). Note that some walruses can have the same age but for the displeasure to emerge the walrus that is closer to the head of the queue needs to be strictly younger than the other on... | ["2 1 0 -1 0 -1", "4 2 1 0 -1 -1 -1", "1 0 -1 -1 -1"] | #include<stdio.h>
#include<stdlib.h>
typedef struct Nodo
{
int posicion;
struct Nodo *siguiente;
} morsa;
int main()
{
morsa *siguiente,*aux;
int i,n;
scanf("%d",&n);
int a[n+1];
int v[n+1];
for(i = 0; i < n; i++)
scanf("%d",&a[i]);
siguiente = (morsa*)malloc(sizeof(morsa));
... | |
There are n walruses standing in a queue in an airport. They are numbered starting from the queue's tail: the 1-st walrus stands at the end of the queue and the n-th walrus stands at the beginning of the queue. The i-th walrus has the age equal to ai.The i-th walrus becomes displeased if there's a younger walrus standi... | Print n numbers: if the i-th walrus is pleased with everything, print "-1" (without the quotes). Otherwise, print the i-th walrus's displeasure: the number of other walruses that stand between him and the furthest from him younger walrus. | C | 668f85cc331bc7bcdd708d9190bbd6e8 | 47018fa70cae4c1b3a66d7517ce156bc | GNU C | standard output | 256 megabytes | train_002.jsonl | [
"data structures",
"binary search"
] | 1308582000 | ["6\n10 8 5 3 50 45", "7\n10 4 6 3 2 8 15", "5\n10 3 1 10 11"] | null | PASSED | 1,500 | standard input | 2 seconds | The first line contains an integer n (2 ≤ n ≤ 105) — the number of walruses in the queue. The second line contains integers ai (1 ≤ ai ≤ 109). Note that some walruses can have the same age but for the displeasure to emerge the walrus that is closer to the head of the queue needs to be strictly younger than the other on... | ["2 1 0 -1 0 -1", "4 2 1 0 -1 -1 -1", "1 0 -1 -1 -1"] | #include<stdio.h>
#include<stdlib.h>
typedef struct nodo
{
int pos; /*se guarda la posicion de los menores que se van encontrando en la fila a medida que se recorre el vector*/
struct nodo *sig; /*el orden es de menor a mayor*/
} contento;
int main()
{
contento *sig,*aux;
int i,n;
scanf... | |
There are n walruses standing in a queue in an airport. They are numbered starting from the queue's tail: the 1-st walrus stands at the end of the queue and the n-th walrus stands at the beginning of the queue. The i-th walrus has the age equal to ai.The i-th walrus becomes displeased if there's a younger walrus standi... | Print n numbers: if the i-th walrus is pleased with everything, print "-1" (without the quotes). Otherwise, print the i-th walrus's displeasure: the number of other walruses that stand between him and the furthest from him younger walrus. | C | 668f85cc331bc7bcdd708d9190bbd6e8 | 98b829bfdc8cca8ea3eb73b876fdfa58 | GNU C | standard output | 256 megabytes | train_002.jsonl | [
"data structures",
"binary search"
] | 1308582000 | ["6\n10 8 5 3 50 45", "7\n10 4 6 3 2 8 15", "5\n10 3 1 10 11"] | null | PASSED | 1,500 | standard input | 2 seconds | The first line contains an integer n (2 ≤ n ≤ 105) — the number of walruses in the queue. The second line contains integers ai (1 ≤ ai ≤ 109). Note that some walruses can have the same age but for the displeasure to emerge the walrus that is closer to the head of the queue needs to be strictly younger than the other on... | ["2 1 0 -1 0 -1", "4 2 1 0 -1 -1 -1", "1 0 -1 -1 -1"] | #include <stdio.h>
#include <stdlib.h>
#define N 100010
int vec[N];
int vec2[N];
int aux[N];
int aux2[N];
void mezcla( int l, int h);
int main(){
int n;
int que[N];
scanf("%d",&n);
int i=0;
for(i=0;i<n;i++)
{
scanf("%d",&que[i]);
vec[i]=que[i];
vec2[i]=i+1;
}
mezcla(0,n-1);
int cont=0;
for(i=0;i<n;i++)
{... | |
There are n walruses standing in a queue in an airport. They are numbered starting from the queue's tail: the 1-st walrus stands at the end of the queue and the n-th walrus stands at the beginning of the queue. The i-th walrus has the age equal to ai.The i-th walrus becomes displeased if there's a younger walrus standi... | Print n numbers: if the i-th walrus is pleased with everything, print "-1" (without the quotes). Otherwise, print the i-th walrus's displeasure: the number of other walruses that stand between him and the furthest from him younger walrus. | C | 668f85cc331bc7bcdd708d9190bbd6e8 | 20b36756832d355bc35aea57959fa07f | GNU C | standard output | 256 megabytes | train_002.jsonl | [
"data structures",
"binary search"
] | 1308582000 | ["6\n10 8 5 3 50 45", "7\n10 4 6 3 2 8 15", "5\n10 3 1 10 11"] | null | PASSED | 1,500 | standard input | 2 seconds | The first line contains an integer n (2 ≤ n ≤ 105) — the number of walruses in the queue. The second line contains integers ai (1 ≤ ai ≤ 109). Note that some walruses can have the same age but for the displeasure to emerge the walrus that is closer to the head of the queue needs to be strictly younger than the other on... | ["2 1 0 -1 0 -1", "4 2 1 0 -1 -1 -1", "1 0 -1 -1 -1"] | #include <stdio.h>
int morsas[100005], menor[100005];
int main() {
int n ,i, izq, der, med ;
scanf("%d", &n);
for(i = 0; i < n; i++) {
scanf("%d", &morsas[i]);
}
menor[n-1] = morsas[n-1];
for(i = n - 2; i >= 0; i--) {
if(morsas[i] < menor[i+1]){
menor[i] = morsas[i];... | |
There are n walruses standing in a queue in an airport. They are numbered starting from the queue's tail: the 1-st walrus stands at the end of the queue and the n-th walrus stands at the beginning of the queue. The i-th walrus has the age equal to ai.The i-th walrus becomes displeased if there's a younger walrus standi... | Print n numbers: if the i-th walrus is pleased with everything, print "-1" (without the quotes). Otherwise, print the i-th walrus's displeasure: the number of other walruses that stand between him and the furthest from him younger walrus. | C | 668f85cc331bc7bcdd708d9190bbd6e8 | 2d7f6fa0c761d9b27b5129adeabe3c42 | GNU C | standard output | 256 megabytes | train_002.jsonl | [
"data structures",
"binary search"
] | 1308582000 | ["6\n10 8 5 3 50 45", "7\n10 4 6 3 2 8 15", "5\n10 3 1 10 11"] | null | PASSED | 1,500 | standard input | 2 seconds | The first line contains an integer n (2 ≤ n ≤ 105) — the number of walruses in the queue. The second line contains integers ai (1 ≤ ai ≤ 109). Note that some walruses can have the same age but for the displeasure to emerge the walrus that is closer to the head of the queue needs to be strictly younger than the other on... | ["2 1 0 -1 0 -1", "4 2 1 0 -1 -1 -1", "1 0 -1 -1 -1"] | #include <stdio.h>
#define MAXN 100000
struct walrus_t
{
int position ;
int younger ;
int age ;
} ;
struct walrus_t walruses[MAXN] ;
void solve(int queue[], int size)
{
static int temp[MAXN] ;
int i, j, k, p ;
if (size > 1)
{
solve(queue, size / 2) ;
solve(queue + size / 2, size - size / 2) ;
... | |
There are n walruses standing in a queue in an airport. They are numbered starting from the queue's tail: the 1-st walrus stands at the end of the queue and the n-th walrus stands at the beginning of the queue. The i-th walrus has the age equal to ai.The i-th walrus becomes displeased if there's a younger walrus standi... | Print n numbers: if the i-th walrus is pleased with everything, print "-1" (without the quotes). Otherwise, print the i-th walrus's displeasure: the number of other walruses that stand between him and the furthest from him younger walrus. | C | 668f85cc331bc7bcdd708d9190bbd6e8 | 01543bb288b382d6c41d27345cd28370 | GNU C | standard output | 256 megabytes | train_002.jsonl | [
"data structures",
"binary search"
] | 1308582000 | ["6\n10 8 5 3 50 45", "7\n10 4 6 3 2 8 15", "5\n10 3 1 10 11"] | null | PASSED | 1,500 | standard input | 2 seconds | The first line contains an integer n (2 ≤ n ≤ 105) — the number of walruses in the queue. The second line contains integers ai (1 ≤ ai ≤ 109). Note that some walruses can have the same age but for the displeasure to emerge the walrus that is closer to the head of the queue needs to be strictly younger than the other on... | ["2 1 0 -1 0 -1", "4 2 1 0 -1 -1 -1", "1 0 -1 -1 -1"] | #include <stdio.h>
int morsas[100005], menor[100005];
int main() {
int n ,i, izq, der, med ;
scanf("%d", &n);
for(i = 0; i < n; i++) {
scanf("%d", &morsas[i]);
}
menor[n-1] = morsas[n-1];
for(i = n - 2; i >= 0; i--) {
if(morsas[i] < menor[i+1]){
menor[i] = morsas[i];... | |
There are n walruses standing in a queue in an airport. They are numbered starting from the queue's tail: the 1-st walrus stands at the end of the queue and the n-th walrus stands at the beginning of the queue. The i-th walrus has the age equal to ai.The i-th walrus becomes displeased if there's a younger walrus standi... | Print n numbers: if the i-th walrus is pleased with everything, print "-1" (without the quotes). Otherwise, print the i-th walrus's displeasure: the number of other walruses that stand between him and the furthest from him younger walrus. | C | 668f85cc331bc7bcdd708d9190bbd6e8 | 0a017e676c5407b6dfe30844ff5619c2 | GNU C | standard output | 256 megabytes | train_002.jsonl | [
"data structures",
"binary search"
] | 1308582000 | ["6\n10 8 5 3 50 45", "7\n10 4 6 3 2 8 15", "5\n10 3 1 10 11"] | null | PASSED | 1,500 | standard input | 2 seconds | The first line contains an integer n (2 ≤ n ≤ 105) — the number of walruses in the queue. The second line contains integers ai (1 ≤ ai ≤ 109). Note that some walruses can have the same age but for the displeasure to emerge the walrus that is closer to the head of the queue needs to be strictly younger than the other on... | ["2 1 0 -1 0 -1", "4 2 1 0 -1 -1 -1", "1 0 -1 -1 -1"] | #include <stdio.h>
int a[100005],b[100005];
int main() {
int n,i,l,r,med ;
scanf("%d", &n);
for(i = 0; i < n; i++) {
scanf("%d", &a[i]);
}
b[n-1]=a[n-1];
for(i = n - 2; i >= 0; i--) {
if(a[i]<b[i+1]){
b[i]=a[i];
}else{
b[i]=b[i+1];
}
}... | |
There are n walruses standing in a queue in an airport. They are numbered starting from the queue's tail: the 1-st walrus stands at the end of the queue and the n-th walrus stands at the beginning of the queue. The i-th walrus has the age equal to ai.The i-th walrus becomes displeased if there's a younger walrus standi... | Print n numbers: if the i-th walrus is pleased with everything, print "-1" (without the quotes). Otherwise, print the i-th walrus's displeasure: the number of other walruses that stand between him and the furthest from him younger walrus. | C | 668f85cc331bc7bcdd708d9190bbd6e8 | 0acc1ce7b79dab83f153f7bb5590566e | GNU C | standard output | 256 megabytes | train_002.jsonl | [
"data structures",
"binary search"
] | 1308582000 | ["6\n10 8 5 3 50 45", "7\n10 4 6 3 2 8 15", "5\n10 3 1 10 11"] | null | PASSED | 1,500 | standard input | 2 seconds | The first line contains an integer n (2 ≤ n ≤ 105) — the number of walruses in the queue. The second line contains integers ai (1 ≤ ai ≤ 109). Note that some walruses can have the same age but for the displeasure to emerge the walrus that is closer to the head of the queue needs to be strictly younger than the other on... | ["2 1 0 -1 0 -1", "4 2 1 0 -1 -1 -1", "1 0 -1 -1 -1"] | #include <stdio.h>
#define M 100005
typedef struct {
int no;
long long age;
} Record;
Record r[M];
int n;
int displs[100005];
int comp(const void *a, const void *b)
{
if((*(Record *)a).age != (*(Record *)b).age)
return (*(Record *)a).age > (*(Record *)b).age ? 1 : -1;
else
return (*(Record *)a).no > (*(Reco... | |
There are n walruses standing in a queue in an airport. They are numbered starting from the queue's tail: the 1-st walrus stands at the end of the queue and the n-th walrus stands at the beginning of the queue. The i-th walrus has the age equal to ai.The i-th walrus becomes displeased if there's a younger walrus standi... | Print n numbers: if the i-th walrus is pleased with everything, print "-1" (without the quotes). Otherwise, print the i-th walrus's displeasure: the number of other walruses that stand between him and the furthest from him younger walrus. | C | 668f85cc331bc7bcdd708d9190bbd6e8 | 942b555e44d20cc84deac917927cb85b | GNU C | standard output | 256 megabytes | train_002.jsonl | [
"data structures",
"binary search"
] | 1308582000 | ["6\n10 8 5 3 50 45", "7\n10 4 6 3 2 8 15", "5\n10 3 1 10 11"] | null | PASSED | 1,500 | standard input | 2 seconds | The first line contains an integer n (2 ≤ n ≤ 105) — the number of walruses in the queue. The second line contains integers ai (1 ≤ ai ≤ 109). Note that some walruses can have the same age but for the displeasure to emerge the walrus that is closer to the head of the queue needs to be strictly younger than the other on... | ["2 1 0 -1 0 -1", "4 2 1 0 -1 -1 -1", "1 0 -1 -1 -1"] | #include <stdio.h>
#include <stdlib.h>
typedef struct {
int a;
int b;
} walrus;
int cmp(const void *a, const void *b)
{
if (((walrus *)a)->a != ((walrus *)b)->a) {
return ((walrus *)a)->a - ((walrus *)b)->a;
} else {
return ((walrus *)a)->b - ((walrus *)b)->b;
}
}
int main()
{
int... | |
There are n walruses standing in a queue in an airport. They are numbered starting from the queue's tail: the 1-st walrus stands at the end of the queue and the n-th walrus stands at the beginning of the queue. The i-th walrus has the age equal to ai.The i-th walrus becomes displeased if there's a younger walrus standi... | Print n numbers: if the i-th walrus is pleased with everything, print "-1" (without the quotes). Otherwise, print the i-th walrus's displeasure: the number of other walruses that stand between him and the furthest from him younger walrus. | C | 668f85cc331bc7bcdd708d9190bbd6e8 | 64d2871f93bde2e687e4cfe4747a5b12 | GNU C | standard output | 256 megabytes | train_002.jsonl | [
"data structures",
"binary search"
] | 1308582000 | ["6\n10 8 5 3 50 45", "7\n10 4 6 3 2 8 15", "5\n10 3 1 10 11"] | null | PASSED | 1,500 | standard input | 2 seconds | The first line contains an integer n (2 ≤ n ≤ 105) — the number of walruses in the queue. The second line contains integers ai (1 ≤ ai ≤ 109). Note that some walruses can have the same age but for the displeasure to emerge the walrus that is closer to the head of the queue needs to be strictly younger than the other on... | ["2 1 0 -1 0 -1", "4 2 1 0 -1 -1 -1", "1 0 -1 -1 -1"] | #include <stdio.h>
int main()
{
int n, mitad, der, izq, i;
int v[100000];
int minimo[100000];
scanf("%d", &n);
for(i = 0; i < n; i++)
{
scanf("%d", &v[i]);
}
minimo[n-1] = v[n-1];
for(i = n - 2; i >= 0; i--)
{
if(v[i] < minimo[i+1])
{
minim... | |
There are n walruses standing in a queue in an airport. They are numbered starting from the queue's tail: the 1-st walrus stands at the end of the queue and the n-th walrus stands at the beginning of the queue. The i-th walrus has the age equal to ai.The i-th walrus becomes displeased if there's a younger walrus standi... | Print n numbers: if the i-th walrus is pleased with everything, print "-1" (without the quotes). Otherwise, print the i-th walrus's displeasure: the number of other walruses that stand between him and the furthest from him younger walrus. | C | 668f85cc331bc7bcdd708d9190bbd6e8 | e7c860e64582a55e2623da4a9f5af09b | GNU C | standard output | 256 megabytes | train_002.jsonl | [
"data structures",
"binary search"
] | 1308582000 | ["6\n10 8 5 3 50 45", "7\n10 4 6 3 2 8 15", "5\n10 3 1 10 11"] | null | PASSED | 1,500 | standard input | 2 seconds | The first line contains an integer n (2 ≤ n ≤ 105) — the number of walruses in the queue. The second line contains integers ai (1 ≤ ai ≤ 109). Note that some walruses can have the same age but for the displeasure to emerge the walrus that is closer to the head of the queue needs to be strictly younger than the other on... | ["2 1 0 -1 0 -1", "4 2 1 0 -1 -1 -1", "1 0 -1 -1 -1"] | #include<stdio.h>
#include<stdlib.h>
typedef struct Nodo{
int pos;
struct Nodo *sig;
}m;
int main(){
m *sig,*aux;
int i,n;
scanf("%d",&n);
int a[n + 1];
int dis[n + 1];
for(i = 0; i < n; i++){
scanf("%d",&a[i]);
}
sig = (m*)malloc(sizeof(m));
sig -> pos = n - 1;
... | |
There are n walruses standing in a queue in an airport. They are numbered starting from the queue's tail: the 1-st walrus stands at the end of the queue and the n-th walrus stands at the beginning of the queue. The i-th walrus has the age equal to ai.The i-th walrus becomes displeased if there's a younger walrus standi... | Print n numbers: if the i-th walrus is pleased with everything, print "-1" (without the quotes). Otherwise, print the i-th walrus's displeasure: the number of other walruses that stand between him and the furthest from him younger walrus. | C | 668f85cc331bc7bcdd708d9190bbd6e8 | 2c0ddf56aa0db1026ad6d598aac6c796 | GNU C | standard output | 256 megabytes | train_002.jsonl | [
"data structures",
"binary search"
] | 1308582000 | ["6\n10 8 5 3 50 45", "7\n10 4 6 3 2 8 15", "5\n10 3 1 10 11"] | null | PASSED | 1,500 | standard input | 2 seconds | The first line contains an integer n (2 ≤ n ≤ 105) — the number of walruses in the queue. The second line contains integers ai (1 ≤ ai ≤ 109). Note that some walruses can have the same age but for the displeasure to emerge the walrus that is closer to the head of the queue needs to be strictly younger than the other on... | ["2 1 0 -1 0 -1", "4 2 1 0 -1 -1 -1", "1 0 -1 -1 -1"] | #include <stdio.h>
int morsas[100005], edad[100005];
int main()
{
int n ,i, izq, der, med ;
scanf("%d", &n);
for(i = 0; i < n; i++) {
scanf("%d", &morsas[i]);
}
edad[n-1] = morsas[n-1];
for(i = n - 2; i >= 0; i--)
if(morsas[i] < edad[i+1])
{
edad[i] = morsas[i]... | |
There are n walruses standing in a queue in an airport. They are numbered starting from the queue's tail: the 1-st walrus stands at the end of the queue and the n-th walrus stands at the beginning of the queue. The i-th walrus has the age equal to ai.The i-th walrus becomes displeased if there's a younger walrus standi... | Print n numbers: if the i-th walrus is pleased with everything, print "-1" (without the quotes). Otherwise, print the i-th walrus's displeasure: the number of other walruses that stand between him and the furthest from him younger walrus. | C | 668f85cc331bc7bcdd708d9190bbd6e8 | 2fecf1469f709f628678d88fd6b890f2 | GNU C | standard output | 256 megabytes | train_002.jsonl | [
"data structures",
"binary search"
] | 1308582000 | ["6\n10 8 5 3 50 45", "7\n10 4 6 3 2 8 15", "5\n10 3 1 10 11"] | null | PASSED | 1,500 | standard input | 2 seconds | The first line contains an integer n (2 ≤ n ≤ 105) — the number of walruses in the queue. The second line contains integers ai (1 ≤ ai ≤ 109). Note that some walruses can have the same age but for the displeasure to emerge the walrus that is closer to the head of the queue needs to be strictly younger than the other on... | ["2 1 0 -1 0 -1", "4 2 1 0 -1 -1 -1", "1 0 -1 -1 -1"] | #include <stdio.h>
int n,num[100010];
int mn[100010];
int work(int pos)
{
int head = pos,tail = n,mid;
while(head<tail)
{
mid = (head+tail+1)>>1;
if(mn[mid]<num[pos]) head = mid;
else tail = mid-1;
}
return head-pos-1;
}
int main()
{
int i;
scanf("%d",&n);
for(i=1... | |
There are n walruses standing in a queue in an airport. They are numbered starting from the queue's tail: the 1-st walrus stands at the end of the queue and the n-th walrus stands at the beginning of the queue. The i-th walrus has the age equal to ai.The i-th walrus becomes displeased if there's a younger walrus standi... | Print n numbers: if the i-th walrus is pleased with everything, print "-1" (without the quotes). Otherwise, print the i-th walrus's displeasure: the number of other walruses that stand between him and the furthest from him younger walrus. | C | 668f85cc331bc7bcdd708d9190bbd6e8 | d00f3b3a583007c8100914dcc9c56f8a | GNU C | standard output | 256 megabytes | train_002.jsonl | [
"data structures",
"binary search"
] | 1308582000 | ["6\n10 8 5 3 50 45", "7\n10 4 6 3 2 8 15", "5\n10 3 1 10 11"] | null | PASSED | 1,500 | standard input | 2 seconds | The first line contains an integer n (2 ≤ n ≤ 105) — the number of walruses in the queue. The second line contains integers ai (1 ≤ ai ≤ 109). Note that some walruses can have the same age but for the displeasure to emerge the walrus that is closer to the head of the queue needs to be strictly younger than the other on... | ["2 1 0 -1 0 -1", "4 2 1 0 -1 -1 -1", "1 0 -1 -1 -1"] | #include <stdio.h>
#include <time.h>
struct zxf
{
long c,num;
}a[100005]={0,0},tmp;
long ans[100005]={0};
void quick(long l,long r)
{
long i,j,t;
t=l+rand()%(r-l); i=l; j=r+1;
while(i<j)
{
while(i<j && a[i].c<a[t].c) i++;
if(i<j)
{
tmp=a[i]; a[i]=a[t]; a[t]=tmp;
t=i;
j--;
}
while(i<j && a[t].c<a... | |
There are n walruses standing in a queue in an airport. They are numbered starting from the queue's tail: the 1-st walrus stands at the end of the queue and the n-th walrus stands at the beginning of the queue. The i-th walrus has the age equal to ai.The i-th walrus becomes displeased if there's a younger walrus standi... | Print n numbers: if the i-th walrus is pleased with everything, print "-1" (without the quotes). Otherwise, print the i-th walrus's displeasure: the number of other walruses that stand between him and the furthest from him younger walrus. | C | 668f85cc331bc7bcdd708d9190bbd6e8 | 777736a3995eeb0d772d2ddfdca03411 | GNU C | standard output | 256 megabytes | train_002.jsonl | [
"data structures",
"binary search"
] | 1308582000 | ["6\n10 8 5 3 50 45", "7\n10 4 6 3 2 8 15", "5\n10 3 1 10 11"] | null | PASSED | 1,500 | standard input | 2 seconds | The first line contains an integer n (2 ≤ n ≤ 105) — the number of walruses in the queue. The second line contains integers ai (1 ≤ ai ≤ 109). Note that some walruses can have the same age but for the displeasure to emerge the walrus that is closer to the head of the queue needs to be strictly younger than the other on... | ["2 1 0 -1 0 -1", "4 2 1 0 -1 -1 -1", "1 0 -1 -1 -1"] | #include<stdio.h>
#include<stdlib.h>
struct C{
int num;
int pos;
};
typedef struct C c;
void shell(c *v,int n);
int main()
{
int n,i=0,j,pos=0,b,k;
scanf("%d",&n);
c v[n+1];
int min[n+1];
for(i=1;i<=n;i++)
{
scanf("%d",&(v[i].num));
v[i].pos=i;
... | |
There are n walruses standing in a queue in an airport. They are numbered starting from the queue's tail: the 1-st walrus stands at the end of the queue and the n-th walrus stands at the beginning of the queue. The i-th walrus has the age equal to ai.The i-th walrus becomes displeased if there's a younger walrus standi... | Print n numbers: if the i-th walrus is pleased with everything, print "-1" (without the quotes). Otherwise, print the i-th walrus's displeasure: the number of other walruses that stand between him and the furthest from him younger walrus. | C | 668f85cc331bc7bcdd708d9190bbd6e8 | 2799dffa61c912e7cbfed275ec24ba83 | GNU C | standard output | 256 megabytes | train_002.jsonl | [
"data structures",
"binary search"
] | 1308582000 | ["6\n10 8 5 3 50 45", "7\n10 4 6 3 2 8 15", "5\n10 3 1 10 11"] | null | PASSED | 1,500 | standard input | 2 seconds | The first line contains an integer n (2 ≤ n ≤ 105) — the number of walruses in the queue. The second line contains integers ai (1 ≤ ai ≤ 109). Note that some walruses can have the same age but for the displeasure to emerge the walrus that is closer to the head of the queue needs to be strictly younger than the other on... | ["2 1 0 -1 0 -1", "4 2 1 0 -1 -1 -1", "1 0 -1 -1 -1"] | #include <stdio.h>
int main() {
int n ,i, izq, der, med ;
scanf("%d", &n);
int edadMorsas[n], menorEdad[n];
for(i = 0; i < n; i++) {
scanf("%d", &edadMorsas[i]);
}
menorEdad[n-1] = edadMorsas[n-1];
for(i = n - 2; i >= 0; i--){
if(edadMorsas[i] < menorEdad[i+1]){
... | |
There are n walruses standing in a queue in an airport. They are numbered starting from the queue's tail: the 1-st walrus stands at the end of the queue and the n-th walrus stands at the beginning of the queue. The i-th walrus has the age equal to ai.The i-th walrus becomes displeased if there's a younger walrus standi... | Print n numbers: if the i-th walrus is pleased with everything, print "-1" (without the quotes). Otherwise, print the i-th walrus's displeasure: the number of other walruses that stand between him and the furthest from him younger walrus. | C | 668f85cc331bc7bcdd708d9190bbd6e8 | 07f5f097df085750681e97d8fe7fda93 | GNU C | standard output | 256 megabytes | train_002.jsonl | [
"data structures",
"binary search"
] | 1308582000 | ["6\n10 8 5 3 50 45", "7\n10 4 6 3 2 8 15", "5\n10 3 1 10 11"] | null | PASSED | 1,500 | standard input | 2 seconds | The first line contains an integer n (2 ≤ n ≤ 105) — the number of walruses in the queue. The second line contains integers ai (1 ≤ ai ≤ 109). Note that some walruses can have the same age but for the displeasure to emerge the walrus that is closer to the head of the queue needs to be strictly younger than the other on... | ["2 1 0 -1 0 -1", "4 2 1 0 -1 -1 -1", "1 0 -1 -1 -1"] | #include <stdio.h>
#include <stdlib.h>
struct Nodo{
int valor;
int ind;
struct Nodo* sig;
};
typedef struct Nodo nodo;
int main(){
int n,h,i,j;
nodo* menor=malloc(sizeof(nodo));
nodo* aux;
scanf("%d",&n);
int l[n];
int v[n];
for(i=0;i<n;i++){
... | |
There are n walruses standing in a queue in an airport. They are numbered starting from the queue's tail: the 1-st walrus stands at the end of the queue and the n-th walrus stands at the beginning of the queue. The i-th walrus has the age equal to ai.The i-th walrus becomes displeased if there's a younger walrus standi... | Print n numbers: if the i-th walrus is pleased with everything, print "-1" (without the quotes). Otherwise, print the i-th walrus's displeasure: the number of other walruses that stand between him and the furthest from him younger walrus. | C | 668f85cc331bc7bcdd708d9190bbd6e8 | 672a791a1e468d8ad7557b8282186a72 | GNU C | standard output | 256 megabytes | train_002.jsonl | [
"data structures",
"binary search"
] | 1308582000 | ["6\n10 8 5 3 50 45", "7\n10 4 6 3 2 8 15", "5\n10 3 1 10 11"] | null | PASSED | 1,500 | standard input | 2 seconds | The first line contains an integer n (2 ≤ n ≤ 105) — the number of walruses in the queue. The second line contains integers ai (1 ≤ ai ≤ 109). Note that some walruses can have the same age but for the displeasure to emerge the walrus that is closer to the head of the queue needs to be strictly younger than the other on... | ["2 1 0 -1 0 -1", "4 2 1 0 -1 -1 -1", "1 0 -1 -1 -1"] | #include <stdio.h>
#define MIN(a, b) ((a) < (b) ? (a) : (b))
struct segment_tree {
int left;
int right;
int minimum;
};
struct segment_tree t[300000];
int a[100000];
void init(int root, int l, int r) {
int mid;
t[root].left = l;
t[root].right = r;
mid = (l + r) >> 1;
if (l == r) {
t[root].minimu... | |
There are n walruses standing in a queue in an airport. They are numbered starting from the queue's tail: the 1-st walrus stands at the end of the queue and the n-th walrus stands at the beginning of the queue. The i-th walrus has the age equal to ai.The i-th walrus becomes displeased if there's a younger walrus standi... | Print n numbers: if the i-th walrus is pleased with everything, print "-1" (without the quotes). Otherwise, print the i-th walrus's displeasure: the number of other walruses that stand between him and the furthest from him younger walrus. | C | 668f85cc331bc7bcdd708d9190bbd6e8 | 7d5238b31d41fb5f4c792da0489040dd | GNU C | standard output | 256 megabytes | train_002.jsonl | [
"data structures",
"binary search"
] | 1308582000 | ["6\n10 8 5 3 50 45", "7\n10 4 6 3 2 8 15", "5\n10 3 1 10 11"] | null | PASSED | 1,500 | standard input | 2 seconds | The first line contains an integer n (2 ≤ n ≤ 105) — the number of walruses in the queue. The second line contains integers ai (1 ≤ ai ≤ 109). Note that some walruses can have the same age but for the displeasure to emerge the walrus that is closer to the head of the queue needs to be strictly younger than the other on... | ["2 1 0 -1 0 -1", "4 2 1 0 -1 -1 -1", "1 0 -1 -1 -1"] | // Queue
#include <stdio.h>
#include <stdlib.h>
#define MAX(a, b) ((a) > (b) ? (a) : (b))
struct Pair
{
int age;
int index;
}p[100001];
int maxs[100001];
int ans[100001];
int cmp(const void *a, const void *b)
{
return ((struct Pair *)a)->age - ((struct Pair *)b)->age;
}
void deal(int n)
{
int i, j... | |
There are n walruses standing in a queue in an airport. They are numbered starting from the queue's tail: the 1-st walrus stands at the end of the queue and the n-th walrus stands at the beginning of the queue. The i-th walrus has the age equal to ai.The i-th walrus becomes displeased if there's a younger walrus standi... | Print n numbers: if the i-th walrus is pleased with everything, print "-1" (without the quotes). Otherwise, print the i-th walrus's displeasure: the number of other walruses that stand between him and the furthest from him younger walrus. | C | 668f85cc331bc7bcdd708d9190bbd6e8 | b3c599347f2895f84bb1a67fcd98fc32 | GNU C | standard output | 256 megabytes | train_002.jsonl | [
"data structures",
"binary search"
] | 1308582000 | ["6\n10 8 5 3 50 45", "7\n10 4 6 3 2 8 15", "5\n10 3 1 10 11"] | null | PASSED | 1,500 | standard input | 2 seconds | The first line contains an integer n (2 ≤ n ≤ 105) — the number of walruses in the queue. The second line contains integers ai (1 ≤ ai ≤ 109). Note that some walruses can have the same age but for the displeasure to emerge the walrus that is closer to the head of the queue needs to be strictly younger than the other on... | ["2 1 0 -1 0 -1", "4 2 1 0 -1 -1 -1", "1 0 -1 -1 -1"] | #include<stdio.h>
#include<stdlib.h>
typedef struct morsasNoMolestas{
long int edad;
long int pos;
struct morsasNoMolestas *sig;
}MorsasNoMolestas;
long int distancia(long int r, MorsasNoMolestas menor);
void agregar( MorsasNoMolestas **ptr, long int edad,... | |
There are n walruses standing in a queue in an airport. They are numbered starting from the queue's tail: the 1-st walrus stands at the end of the queue and the n-th walrus stands at the beginning of the queue. The i-th walrus has the age equal to ai.The i-th walrus becomes displeased if there's a younger walrus standi... | Print n numbers: if the i-th walrus is pleased with everything, print "-1" (without the quotes). Otherwise, print the i-th walrus's displeasure: the number of other walruses that stand between him and the furthest from him younger walrus. | C | 668f85cc331bc7bcdd708d9190bbd6e8 | 44208c6f932c1dd71bcc72cdcf5b230b | GNU C | standard output | 256 megabytes | train_002.jsonl | [
"data structures",
"binary search"
] | 1308582000 | ["6\n10 8 5 3 50 45", "7\n10 4 6 3 2 8 15", "5\n10 3 1 10 11"] | null | PASSED | 1,500 | standard input | 2 seconds | The first line contains an integer n (2 ≤ n ≤ 105) — the number of walruses in the queue. The second line contains integers ai (1 ≤ ai ≤ 109). Note that some walruses can have the same age but for the displeasure to emerge the walrus that is closer to the head of the queue needs to be strictly younger than the other on... | ["2 1 0 -1 0 -1", "4 2 1 0 -1 -1 -1", "1 0 -1 -1 -1"] | #include<stdio.h>
#include<stdlib.h>
typedef struct morsasNoMolestas{
long int edad;
long int pos;
struct morsasNoMolestas *sig;
}MorsasNoMolestas;
long int distancia(long int r, MorsasNoMolestas menor);
void agregar( MorsasNoMolestas **ptr, long int edad,... | |
There are n walruses standing in a queue in an airport. They are numbered starting from the queue's tail: the 1-st walrus stands at the end of the queue and the n-th walrus stands at the beginning of the queue. The i-th walrus has the age equal to ai.The i-th walrus becomes displeased if there's a younger walrus standi... | Print n numbers: if the i-th walrus is pleased with everything, print "-1" (without the quotes). Otherwise, print the i-th walrus's displeasure: the number of other walruses that stand between him and the furthest from him younger walrus. | C | 668f85cc331bc7bcdd708d9190bbd6e8 | 0da25c14a8b4d33d3f8b290858ebaf60 | GNU C | standard output | 256 megabytes | train_002.jsonl | [
"data structures",
"binary search"
] | 1308582000 | ["6\n10 8 5 3 50 45", "7\n10 4 6 3 2 8 15", "5\n10 3 1 10 11"] | null | PASSED | 1,500 | standard input | 2 seconds | The first line contains an integer n (2 ≤ n ≤ 105) — the number of walruses in the queue. The second line contains integers ai (1 ≤ ai ≤ 109). Note that some walruses can have the same age but for the displeasure to emerge the walrus that is closer to the head of the queue needs to be strictly younger than the other on... | ["2 1 0 -1 0 -1", "4 2 1 0 -1 -1 -1", "1 0 -1 -1 -1"] | #include<stdio.h>
#include<stdlib.h>
typedef struct morsasNoMolestas{
long int edad;
long int pos;
struct morsasNoMolestas *sig;
}MorsasNoMolestas;
long int distancia(long int r, MorsasNoMolestas menor);
void agregar( MorsasNoMolestas **ptr, long int edad,... | |
$$$n$$$ students are taking an exam. The highest possible score at this exam is $$$m$$$. Let $$$a_{i}$$$ be the score of the $$$i$$$-th student. You have access to the school database which stores the results of all students.You can change each student's score as long as the following conditions are satisfied: All sc... | For each testcase, output one integer — the highest possible score you can assign to yourself such that both conditions are satisfied._ | C | 7c2a61de728e6767b25e58c74497bbae | 1a524230539e0f4e1b2f3bf9f048698f | GNU C11 | standard output | 256 megabytes | train_002.jsonl | [
"implementation"
] | 1583332500 | ["2\n4 10\n1 2 3 4\n4 5\n1 2 3 4"] | NoteIn the first case, $$$a = [1,2,3,4] $$$, with average of $$$2.5$$$. You can change array $$$a$$$ to $$$[10,0,0,0]$$$. Average remains $$$2.5$$$, and all conditions are satisfied.In the second case, $$$0 \leq a_{i} \leq 5$$$. You can change $$$a$$$ to $$$[5,1,1,3]$$$. You cannot increase $$$a_{1}$$$ further as it wi... | PASSED | 800 | standard input | 1 second | Each test contains multiple test cases. The first line contains the number of test cases $$$t$$$ ($$$1 \le t \le 200$$$). The description of the test cases follows. The first line of each test case contains two integers $$$n$$$ and $$$m$$$ ($$$1 \leq n \leq 10^{3}$$$, $$$1 \leq m \leq 10^{5}$$$) — the number of stude... | ["10\n5"] | #include<stdio.h>
int main()
{
int t;
scanf("%d",&t);
while(t--)
{
int n,m,i,a,sum=0;
scanf("%d",&n);
scanf("%d",&m);
for(i=0;i<n;i++)
{
scanf("%d",&a);
sum+=a;
}
if(sum>m)
printf("%d\n",m);
else
printf("%d\n",sum);
}
return 0;
} | |
$$$n$$$ students are taking an exam. The highest possible score at this exam is $$$m$$$. Let $$$a_{i}$$$ be the score of the $$$i$$$-th student. You have access to the school database which stores the results of all students.You can change each student's score as long as the following conditions are satisfied: All sc... | For each testcase, output one integer — the highest possible score you can assign to yourself such that both conditions are satisfied._ | C | 7c2a61de728e6767b25e58c74497bbae | 665690af413220e5087288c31b1d32fd | GNU C11 | standard output | 256 megabytes | train_002.jsonl | [
"implementation"
] | 1583332500 | ["2\n4 10\n1 2 3 4\n4 5\n1 2 3 4"] | NoteIn the first case, $$$a = [1,2,3,4] $$$, with average of $$$2.5$$$. You can change array $$$a$$$ to $$$[10,0,0,0]$$$. Average remains $$$2.5$$$, and all conditions are satisfied.In the second case, $$$0 \leq a_{i} \leq 5$$$. You can change $$$a$$$ to $$$[5,1,1,3]$$$. You cannot increase $$$a_{1}$$$ further as it wi... | PASSED | 800 | standard input | 1 second | Each test contains multiple test cases. The first line contains the number of test cases $$$t$$$ ($$$1 \le t \le 200$$$). The description of the test cases follows. The first line of each test case contains two integers $$$n$$$ and $$$m$$$ ($$$1 \leq n \leq 10^{3}$$$, $$$1 \leq m \leq 10^{5}$$$) — the number of stude... | ["10\n5"] | #include <stdio.h>
int main()
{
int t;
scanf("%d",&t);
for(int i=0;i<t;i++)
{
int n,m;
scanf("%d%d",&n,&m);
int arr[n];
for(int j=0;j<n;j++)
{
scanf("%d",&arr[j]);
}
int sum=0;
for(int k=0;k<n;k++)
{
sum+=ar... | |
$$$n$$$ students are taking an exam. The highest possible score at this exam is $$$m$$$. Let $$$a_{i}$$$ be the score of the $$$i$$$-th student. You have access to the school database which stores the results of all students.You can change each student's score as long as the following conditions are satisfied: All sc... | For each testcase, output one integer — the highest possible score you can assign to yourself such that both conditions are satisfied._ | C | 7c2a61de728e6767b25e58c74497bbae | eec9561e81620908cd09330ab9fcabc7 | GNU C11 | standard output | 256 megabytes | train_002.jsonl | [
"implementation"
] | 1583332500 | ["2\n4 10\n1 2 3 4\n4 5\n1 2 3 4"] | NoteIn the first case, $$$a = [1,2,3,4] $$$, with average of $$$2.5$$$. You can change array $$$a$$$ to $$$[10,0,0,0]$$$. Average remains $$$2.5$$$, and all conditions are satisfied.In the second case, $$$0 \leq a_{i} \leq 5$$$. You can change $$$a$$$ to $$$[5,1,1,3]$$$. You cannot increase $$$a_{1}$$$ further as it wi... | PASSED | 800 | standard input | 1 second | Each test contains multiple test cases. The first line contains the number of test cases $$$t$$$ ($$$1 \le t \le 200$$$). The description of the test cases follows. The first line of each test case contains two integers $$$n$$$ and $$$m$$$ ($$$1 \leq n \leq 10^{3}$$$, $$$1 \leq m \leq 10^{5}$$$) — the number of stude... | ["10\n5"] | #include<stdio.h>
void solve();
int main()
{ int t;
scanf("%d", &t);
for(int k=0; k<t; k++){
solve();
}
return 0;
}
void solve (){
int n, total=0, possible, scored, cache, allot;
scanf("%d%d", &n, &possible);
int a[n];
for(int j=0; j<n; j++){
scanf("%d", &a[j]);
total= total+ a[j];
}
scored=... | |
$$$n$$$ students are taking an exam. The highest possible score at this exam is $$$m$$$. Let $$$a_{i}$$$ be the score of the $$$i$$$-th student. You have access to the school database which stores the results of all students.You can change each student's score as long as the following conditions are satisfied: All sc... | For each testcase, output one integer — the highest possible score you can assign to yourself such that both conditions are satisfied._ | C | 7c2a61de728e6767b25e58c74497bbae | c963e4c6a5ba68ec67b6662ae04de7a0 | GNU C11 | standard output | 256 megabytes | train_002.jsonl | [
"implementation"
] | 1583332500 | ["2\n4 10\n1 2 3 4\n4 5\n1 2 3 4"] | NoteIn the first case, $$$a = [1,2,3,4] $$$, with average of $$$2.5$$$. You can change array $$$a$$$ to $$$[10,0,0,0]$$$. Average remains $$$2.5$$$, and all conditions are satisfied.In the second case, $$$0 \leq a_{i} \leq 5$$$. You can change $$$a$$$ to $$$[5,1,1,3]$$$. You cannot increase $$$a_{1}$$$ further as it wi... | PASSED | 800 | standard input | 1 second | Each test contains multiple test cases. The first line contains the number of test cases $$$t$$$ ($$$1 \le t \le 200$$$). The description of the test cases follows. The first line of each test case contains two integers $$$n$$$ and $$$m$$$ ($$$1 \leq n \leq 10^{3}$$$, $$$1 \leq m \leq 10^{5}$$$) — the number of stude... | ["10\n5"] | #include<stdio.h>
int main(void)
{
int t;
//while (t >= 1 && t <=200)
// {
scanf("%d", &t);
int n, m;
while (t--)
{
scanf("%d", &n);
scanf("%d", &m);
int score[n];
int s = 0;
for (int i = 0; i < n; i++)
{
scanf("%d", &score[i]);
s += score[i];
}
if (s >= m){
printf("%d\... | |
$$$n$$$ students are taking an exam. The highest possible score at this exam is $$$m$$$. Let $$$a_{i}$$$ be the score of the $$$i$$$-th student. You have access to the school database which stores the results of all students.You can change each student's score as long as the following conditions are satisfied: All sc... | For each testcase, output one integer — the highest possible score you can assign to yourself such that both conditions are satisfied._ | C | 7c2a61de728e6767b25e58c74497bbae | 46b2da184cc865c7f958473f74953eec | GNU C11 | standard output | 256 megabytes | train_002.jsonl | [
"implementation"
] | 1583332500 | ["2\n4 10\n1 2 3 4\n4 5\n1 2 3 4"] | NoteIn the first case, $$$a = [1,2,3,4] $$$, with average of $$$2.5$$$. You can change array $$$a$$$ to $$$[10,0,0,0]$$$. Average remains $$$2.5$$$, and all conditions are satisfied.In the second case, $$$0 \leq a_{i} \leq 5$$$. You can change $$$a$$$ to $$$[5,1,1,3]$$$. You cannot increase $$$a_{1}$$$ further as it wi... | PASSED | 800 | standard input | 1 second | Each test contains multiple test cases. The first line contains the number of test cases $$$t$$$ ($$$1 \le t \le 200$$$). The description of the test cases follows. The first line of each test case contains two integers $$$n$$$ and $$$m$$$ ($$$1 \leq n \leq 10^{3}$$$, $$$1 \leq m \leq 10^{5}$$$) — the number of stude... | ["10\n5"] | #include <stdio.h>
int main()
{
int t,n,m,a[100000],b[100000];
scanf("%d",&t);
for(int j=0;j<t;j++)
{
int s=0;
scanf("%d%d",&n,&m);
for (int i=0;i<n;i++)
{
scanf("%d",&a[i]);
s=s+a[i];
}
if(s<=m)
{b[j]=s;}
else
{
b[j]=m;
}
}
... | |
$$$n$$$ students are taking an exam. The highest possible score at this exam is $$$m$$$. Let $$$a_{i}$$$ be the score of the $$$i$$$-th student. You have access to the school database which stores the results of all students.You can change each student's score as long as the following conditions are satisfied: All sc... | For each testcase, output one integer — the highest possible score you can assign to yourself such that both conditions are satisfied._ | C | 7c2a61de728e6767b25e58c74497bbae | 4c6bc197ac24c5fbf875f6fd973d62c0 | GNU C11 | standard output | 256 megabytes | train_002.jsonl | [
"implementation"
] | 1583332500 | ["2\n4 10\n1 2 3 4\n4 5\n1 2 3 4"] | NoteIn the first case, $$$a = [1,2,3,4] $$$, with average of $$$2.5$$$. You can change array $$$a$$$ to $$$[10,0,0,0]$$$. Average remains $$$2.5$$$, and all conditions are satisfied.In the second case, $$$0 \leq a_{i} \leq 5$$$. You can change $$$a$$$ to $$$[5,1,1,3]$$$. You cannot increase $$$a_{1}$$$ further as it wi... | PASSED | 800 | standard input | 1 second | Each test contains multiple test cases. The first line contains the number of test cases $$$t$$$ ($$$1 \le t \le 200$$$). The description of the test cases follows. The first line of each test case contains two integers $$$n$$$ and $$$m$$$ ($$$1 \leq n \leq 10^{3}$$$, $$$1 \leq m \leq 10^{5}$$$) — the number of stude... | ["10\n5"] | #include<stdio.h>
int main(){
int t,a,b,i;
scanf("%d",&t);
while(t--){
int s=0;
scanf("%d%d",&a,&b);
int k[a];
for(i=0;i<a;i++){
scanf("%d",&k[i]);
}
for(i=0;i<a;i++){
s=s+k[i];
... | |
$$$n$$$ students are taking an exam. The highest possible score at this exam is $$$m$$$. Let $$$a_{i}$$$ be the score of the $$$i$$$-th student. You have access to the school database which stores the results of all students.You can change each student's score as long as the following conditions are satisfied: All sc... | For each testcase, output one integer — the highest possible score you can assign to yourself such that both conditions are satisfied._ | C | 7c2a61de728e6767b25e58c74497bbae | c1dbddfea0beb33c16e9e743f62dc550 | GNU C11 | standard output | 256 megabytes | train_002.jsonl | [
"implementation"
] | 1583332500 | ["2\n4 10\n1 2 3 4\n4 5\n1 2 3 4"] | NoteIn the first case, $$$a = [1,2,3,4] $$$, with average of $$$2.5$$$. You can change array $$$a$$$ to $$$[10,0,0,0]$$$. Average remains $$$2.5$$$, and all conditions are satisfied.In the second case, $$$0 \leq a_{i} \leq 5$$$. You can change $$$a$$$ to $$$[5,1,1,3]$$$. You cannot increase $$$a_{1}$$$ further as it wi... | PASSED | 800 | standard input | 1 second | Each test contains multiple test cases. The first line contains the number of test cases $$$t$$$ ($$$1 \le t \le 200$$$). The description of the test cases follows. The first line of each test case contains two integers $$$n$$$ and $$$m$$$ ($$$1 \leq n \leq 10^{3}$$$, $$$1 \leq m \leq 10^{5}$$$) — the number of stude... | ["10\n5"] | #include<stdio.h>
#include<stdlib.h>
int main()
{
int n,m,i,t,j;
scanf("%d",&t);
for(j=0;j<t;j++)
{
scanf("%d%d",&n,&m);
int a[n];
for(i=0;i<n;i++)
{
scanf("%d",&a[i]);
}
for(i=1;i<n;i++)
{
a[0]+=a[i];
}
if(a[0]>=m)
{
printf("%d\n"... | |
$$$n$$$ students are taking an exam. The highest possible score at this exam is $$$m$$$. Let $$$a_{i}$$$ be the score of the $$$i$$$-th student. You have access to the school database which stores the results of all students.You can change each student's score as long as the following conditions are satisfied: All sc... | For each testcase, output one integer — the highest possible score you can assign to yourself such that both conditions are satisfied._ | C | 7c2a61de728e6767b25e58c74497bbae | 32b15c92dcd0ec6d5cd9c928371177f6 | GNU C11 | standard output | 256 megabytes | train_002.jsonl | [
"implementation"
] | 1583332500 | ["2\n4 10\n1 2 3 4\n4 5\n1 2 3 4"] | NoteIn the first case, $$$a = [1,2,3,4] $$$, with average of $$$2.5$$$. You can change array $$$a$$$ to $$$[10,0,0,0]$$$. Average remains $$$2.5$$$, and all conditions are satisfied.In the second case, $$$0 \leq a_{i} \leq 5$$$. You can change $$$a$$$ to $$$[5,1,1,3]$$$. You cannot increase $$$a_{1}$$$ further as it wi... | PASSED | 800 | standard input | 1 second | Each test contains multiple test cases. The first line contains the number of test cases $$$t$$$ ($$$1 \le t \le 200$$$). The description of the test cases follows. The first line of each test case contains two integers $$$n$$$ and $$$m$$$ ($$$1 \leq n \leq 10^{3}$$$, $$$1 \leq m \leq 10^{5}$$$) — the number of stude... | ["10\n5"] | #include<stdio.h>
int main()
{
int t,q,i,n,m;
scanf("%d", &t);
for(q=0;q<t;q++){
scanf("%d%d", &n, &m);
int a[n];
int sum=0;
for(i=0;i<n;i++){
scanf("%d", &a[i]);
sum=sum+a[i];
}
if(sum<m){
printf("%d\n", sum);
}
... | |
$$$n$$$ students are taking an exam. The highest possible score at this exam is $$$m$$$. Let $$$a_{i}$$$ be the score of the $$$i$$$-th student. You have access to the school database which stores the results of all students.You can change each student's score as long as the following conditions are satisfied: All sc... | For each testcase, output one integer — the highest possible score you can assign to yourself such that both conditions are satisfied._ | C | 7c2a61de728e6767b25e58c74497bbae | c3b862b73fbbde2c568f8c544091aed2 | GNU C11 | standard output | 256 megabytes | train_002.jsonl | [
"implementation"
] | 1583332500 | ["2\n4 10\n1 2 3 4\n4 5\n1 2 3 4"] | NoteIn the first case, $$$a = [1,2,3,4] $$$, with average of $$$2.5$$$. You can change array $$$a$$$ to $$$[10,0,0,0]$$$. Average remains $$$2.5$$$, and all conditions are satisfied.In the second case, $$$0 \leq a_{i} \leq 5$$$. You can change $$$a$$$ to $$$[5,1,1,3]$$$. You cannot increase $$$a_{1}$$$ further as it wi... | PASSED | 800 | standard input | 1 second | Each test contains multiple test cases. The first line contains the number of test cases $$$t$$$ ($$$1 \le t \le 200$$$). The description of the test cases follows. The first line of each test case contains two integers $$$n$$$ and $$$m$$$ ($$$1 \leq n \leq 10^{3}$$$, $$$1 \leq m \leq 10^{5}$$$) — the number of stude... | ["10\n5"] | #include <stdio.h>
int main()
{
long long int i,j,m,n,t,high,sum;
//double avg;
scanf("%lld", &t);
for(i=0;i<t;i++){
sum=0;
scanf("%lld%lld", &n,&high);
int a[n];
for(j=0;j<n;j++){
scanf("%lld", &a[j]);
sum+=a[j];
}
if(sum<=high)pri... | |
$$$n$$$ students are taking an exam. The highest possible score at this exam is $$$m$$$. Let $$$a_{i}$$$ be the score of the $$$i$$$-th student. You have access to the school database which stores the results of all students.You can change each student's score as long as the following conditions are satisfied: All sc... | For each testcase, output one integer — the highest possible score you can assign to yourself such that both conditions are satisfied._ | C | 7c2a61de728e6767b25e58c74497bbae | fba1550a0fe305ef96fbf84cea496191 | GNU C11 | standard output | 256 megabytes | train_002.jsonl | [
"implementation"
] | 1583332500 | ["2\n4 10\n1 2 3 4\n4 5\n1 2 3 4"] | NoteIn the first case, $$$a = [1,2,3,4] $$$, with average of $$$2.5$$$. You can change array $$$a$$$ to $$$[10,0,0,0]$$$. Average remains $$$2.5$$$, and all conditions are satisfied.In the second case, $$$0 \leq a_{i} \leq 5$$$. You can change $$$a$$$ to $$$[5,1,1,3]$$$. You cannot increase $$$a_{1}$$$ further as it wi... | PASSED | 800 | standard input | 1 second | Each test contains multiple test cases. The first line contains the number of test cases $$$t$$$ ($$$1 \le t \le 200$$$). The description of the test cases follows. The first line of each test case contains two integers $$$n$$$ and $$$m$$$ ($$$1 \leq n \leq 10^{3}$$$, $$$1 \leq m \leq 10^{5}$$$) — the number of stude... | ["10\n5"] | #include <stdio.h>
int main(){
int t;
scanf("%d", &t);
int n,m, soma=0, soma100eu=0, eu=0;
for(int testes=0; testes<t; testes++){
scanf("%d %d", &n, &m);
int notas[n+1];
soma = 0;
for(int i=0; i<n; i++){
scanf("%d", ¬as[i]);
soma += notas[... | |
$$$n$$$ students are taking an exam. The highest possible score at this exam is $$$m$$$. Let $$$a_{i}$$$ be the score of the $$$i$$$-th student. You have access to the school database which stores the results of all students.You can change each student's score as long as the following conditions are satisfied: All sc... | For each testcase, output one integer — the highest possible score you can assign to yourself such that both conditions are satisfied._ | C | 7c2a61de728e6767b25e58c74497bbae | e2398c87d698654fd995452716e4566f | GNU C11 | standard output | 256 megabytes | train_002.jsonl | [
"implementation"
] | 1583332500 | ["2\n4 10\n1 2 3 4\n4 5\n1 2 3 4"] | NoteIn the first case, $$$a = [1,2,3,4] $$$, with average of $$$2.5$$$. You can change array $$$a$$$ to $$$[10,0,0,0]$$$. Average remains $$$2.5$$$, and all conditions are satisfied.In the second case, $$$0 \leq a_{i} \leq 5$$$. You can change $$$a$$$ to $$$[5,1,1,3]$$$. You cannot increase $$$a_{1}$$$ further as it wi... | PASSED | 800 | standard input | 1 second | Each test contains multiple test cases. The first line contains the number of test cases $$$t$$$ ($$$1 \le t \le 200$$$). The description of the test cases follows. The first line of each test case contains two integers $$$n$$$ and $$$m$$$ ($$$1 \leq n \leq 10^{3}$$$, $$$1 \leq m \leq 10^{5}$$$) — the number of stude... | ["10\n5"] | #include<stdio.h>
#include<string.h>
#define N 10000
int main()
{
int n,t,m,a[N]={0},i,j,sum=0;
scanf("%d",&t);
while(t--)
{
sum=0;
memset(a,0,sizeof(a));
scanf("%d%d",&n,&m);
for(i=0;i<n;i++)
{
scanf("%d",&a[i]);
sum+=a[i];
}
if(sum==0)
{
printf("0\n");
continue;
}
for(j=m;j>=1;j--... | |
$$$n$$$ students are taking an exam. The highest possible score at this exam is $$$m$$$. Let $$$a_{i}$$$ be the score of the $$$i$$$-th student. You have access to the school database which stores the results of all students.You can change each student's score as long as the following conditions are satisfied: All sc... | For each testcase, output one integer — the highest possible score you can assign to yourself such that both conditions are satisfied._ | C | 7c2a61de728e6767b25e58c74497bbae | a3ae2230a522a04cc60cb59a6f9b5140 | GNU C11 | standard output | 256 megabytes | train_002.jsonl | [
"implementation"
] | 1583332500 | ["2\n4 10\n1 2 3 4\n4 5\n1 2 3 4"] | NoteIn the first case, $$$a = [1,2,3,4] $$$, with average of $$$2.5$$$. You can change array $$$a$$$ to $$$[10,0,0,0]$$$. Average remains $$$2.5$$$, and all conditions are satisfied.In the second case, $$$0 \leq a_{i} \leq 5$$$. You can change $$$a$$$ to $$$[5,1,1,3]$$$. You cannot increase $$$a_{1}$$$ further as it wi... | PASSED | 800 | standard input | 1 second | Each test contains multiple test cases. The first line contains the number of test cases $$$t$$$ ($$$1 \le t \le 200$$$). The description of the test cases follows. The first line of each test case contains two integers $$$n$$$ and $$$m$$$ ($$$1 \leq n \leq 10^{3}$$$, $$$1 \leq m \leq 10^{5}$$$) — the number of stude... | ["10\n5"] | #include<stdio.h>
void main()
{
int t=0,m=0,n=0,temp=0;
scanf("\n%d",&t);
while(t>0)
{
--t;
scanf("\n%d %d",&n,&m);
int a[n];
for(int i=0;i<n;i++)
scanf("%d",&a[i]);
if(a[0]==m)
{ //printf("%d",m);
//return m;
}
else{
for(int i=1;i<n;i++... | |
$$$n$$$ students are taking an exam. The highest possible score at this exam is $$$m$$$. Let $$$a_{i}$$$ be the score of the $$$i$$$-th student. You have access to the school database which stores the results of all students.You can change each student's score as long as the following conditions are satisfied: All sc... | For each testcase, output one integer — the highest possible score you can assign to yourself such that both conditions are satisfied._ | C | 7c2a61de728e6767b25e58c74497bbae | 7f7f3a08967c26be076f84f1f29bd831 | GNU C11 | standard output | 256 megabytes | train_002.jsonl | [
"implementation"
] | 1583332500 | ["2\n4 10\n1 2 3 4\n4 5\n1 2 3 4"] | NoteIn the first case, $$$a = [1,2,3,4] $$$, with average of $$$2.5$$$. You can change array $$$a$$$ to $$$[10,0,0,0]$$$. Average remains $$$2.5$$$, and all conditions are satisfied.In the second case, $$$0 \leq a_{i} \leq 5$$$. You can change $$$a$$$ to $$$[5,1,1,3]$$$. You cannot increase $$$a_{1}$$$ further as it wi... | PASSED | 800 | standard input | 1 second | Each test contains multiple test cases. The first line contains the number of test cases $$$t$$$ ($$$1 \le t \le 200$$$). The description of the test cases follows. The first line of each test case contains two integers $$$n$$$ and $$$m$$$ ($$$1 \leq n \leq 10^{3}$$$, $$$1 \leq m \leq 10^{5}$$$) — the number of stude... | ["10\n5"] | #include <stdio.h>
int main()
{
int t;
scanf("%d",&t);
while(t--)
{
int n,m,k=0,c=0;
scanf("%d%d",&n,&m);
int a[n],i;
for(i=0;i<n;i++)
{
scanf("%d",&a[i]);
k=k+a[i];
if(a[i]==0)
c++;
}
//printf(" %d %d",k,c);
int max=a[0] ;
for(i=0;i<n;i++)
{ if(a[i]>max)
max=a[i];
}
if((c==n-1)||... | |
$$$n$$$ students are taking an exam. The highest possible score at this exam is $$$m$$$. Let $$$a_{i}$$$ be the score of the $$$i$$$-th student. You have access to the school database which stores the results of all students.You can change each student's score as long as the following conditions are satisfied: All sc... | For each testcase, output one integer — the highest possible score you can assign to yourself such that both conditions are satisfied._ | C | 7c2a61de728e6767b25e58c74497bbae | e3d188bb0826aabfa2aa88b06963b072 | GNU C11 | standard output | 256 megabytes | train_002.jsonl | [
"implementation"
] | 1583332500 | ["2\n4 10\n1 2 3 4\n4 5\n1 2 3 4"] | NoteIn the first case, $$$a = [1,2,3,4] $$$, with average of $$$2.5$$$. You can change array $$$a$$$ to $$$[10,0,0,0]$$$. Average remains $$$2.5$$$, and all conditions are satisfied.In the second case, $$$0 \leq a_{i} \leq 5$$$. You can change $$$a$$$ to $$$[5,1,1,3]$$$. You cannot increase $$$a_{1}$$$ further as it wi... | PASSED | 800 | standard input | 1 second | Each test contains multiple test cases. The first line contains the number of test cases $$$t$$$ ($$$1 \le t \le 200$$$). The description of the test cases follows. The first line of each test case contains two integers $$$n$$$ and $$$m$$$ ($$$1 \leq n \leq 10^{3}$$$, $$$1 \leq m \leq 10^{5}$$$) — the number of stude... | ["10\n5"] | #include <stdio.h>
int main()
{
int a,b,i;
scanf("%d\n",&a);
for(i=a;i!=0;i--)
{int c,d,sum=0;
scanf("%d%d",&c,&d);
int j;
int s;
for(j=0;j<c;j++)
{
scanf("%d",&s);
sum=sum+s;
}
if(sum<d)
{
printf("%d\n",sum);
}else
{
printf("%d\n",d);
}
}
return 0;
} | |
$$$n$$$ students are taking an exam. The highest possible score at this exam is $$$m$$$. Let $$$a_{i}$$$ be the score of the $$$i$$$-th student. You have access to the school database which stores the results of all students.You can change each student's score as long as the following conditions are satisfied: All sc... | For each testcase, output one integer — the highest possible score you can assign to yourself such that both conditions are satisfied._ | C | 7c2a61de728e6767b25e58c74497bbae | 60129850f2191e45f82dfb1e4bc1b8a4 | GNU C11 | standard output | 256 megabytes | train_002.jsonl | [
"implementation"
] | 1583332500 | ["2\n4 10\n1 2 3 4\n4 5\n1 2 3 4"] | NoteIn the first case, $$$a = [1,2,3,4] $$$, with average of $$$2.5$$$. You can change array $$$a$$$ to $$$[10,0,0,0]$$$. Average remains $$$2.5$$$, and all conditions are satisfied.In the second case, $$$0 \leq a_{i} \leq 5$$$. You can change $$$a$$$ to $$$[5,1,1,3]$$$. You cannot increase $$$a_{1}$$$ further as it wi... | PASSED | 800 | standard input | 1 second | Each test contains multiple test cases. The first line contains the number of test cases $$$t$$$ ($$$1 \le t \le 200$$$). The description of the test cases follows. The first line of each test case contains two integers $$$n$$$ and $$$m$$$ ($$$1 \leq n \leq 10^{3}$$$, $$$1 \leq m \leq 10^{5}$$$) — the number of stude... | ["10\n5"] | #include<stdio.h>
int main()
{
int t,a[1000],n,i,h,sum,c=1;
scanf("%d",&t);
for(c=1; c<=t; c++)
{
scanf("%d %d",&n,&h);
for(i=1,sum=0; i<=n; i++)
{
scanf("%d",&a[i]);
sum=sum+a[i];
}
if(sum>=h)
{
printf("%d\n",h);
... | |
$$$n$$$ students are taking an exam. The highest possible score at this exam is $$$m$$$. Let $$$a_{i}$$$ be the score of the $$$i$$$-th student. You have access to the school database which stores the results of all students.You can change each student's score as long as the following conditions are satisfied: All sc... | For each testcase, output one integer — the highest possible score you can assign to yourself such that both conditions are satisfied._ | C | 7c2a61de728e6767b25e58c74497bbae | aadf8b302472d62dba91d11d95813896 | GNU C11 | standard output | 256 megabytes | train_002.jsonl | [
"implementation"
] | 1583332500 | ["2\n4 10\n1 2 3 4\n4 5\n1 2 3 4"] | NoteIn the first case, $$$a = [1,2,3,4] $$$, with average of $$$2.5$$$. You can change array $$$a$$$ to $$$[10,0,0,0]$$$. Average remains $$$2.5$$$, and all conditions are satisfied.In the second case, $$$0 \leq a_{i} \leq 5$$$. You can change $$$a$$$ to $$$[5,1,1,3]$$$. You cannot increase $$$a_{1}$$$ further as it wi... | PASSED | 800 | standard input | 1 second | Each test contains multiple test cases. The first line contains the number of test cases $$$t$$$ ($$$1 \le t \le 200$$$). The description of the test cases follows. The first line of each test case contains two integers $$$n$$$ and $$$m$$$ ($$$1 \leq n \leq 10^{3}$$$, $$$1 \leq m \leq 10^{5}$$$) — the number of stude... | ["10\n5"] | #include <stdio.h>
int main(){
int t, n, m, notas, total;
scanf("%d", &t);
total = 0;
for(int i = 0; i < t; ++i){
scanf("%d%d", &n, &m);
total = 0;
for(int u = 0; u < n; ++u){
scanf("%d", ¬as);
total += notas;
}
if(total >= m)... | |
$$$n$$$ students are taking an exam. The highest possible score at this exam is $$$m$$$. Let $$$a_{i}$$$ be the score of the $$$i$$$-th student. You have access to the school database which stores the results of all students.You can change each student's score as long as the following conditions are satisfied: All sc... | For each testcase, output one integer — the highest possible score you can assign to yourself such that both conditions are satisfied._ | C | 7c2a61de728e6767b25e58c74497bbae | e8c3fc7694a6a1890d0d3f078a7e5902 | GNU C11 | standard output | 256 megabytes | train_002.jsonl | [
"implementation"
] | 1583332500 | ["2\n4 10\n1 2 3 4\n4 5\n1 2 3 4"] | NoteIn the first case, $$$a = [1,2,3,4] $$$, with average of $$$2.5$$$. You can change array $$$a$$$ to $$$[10,0,0,0]$$$. Average remains $$$2.5$$$, and all conditions are satisfied.In the second case, $$$0 \leq a_{i} \leq 5$$$. You can change $$$a$$$ to $$$[5,1,1,3]$$$. You cannot increase $$$a_{1}$$$ further as it wi... | PASSED | 800 | standard input | 1 second | Each test contains multiple test cases. The first line contains the number of test cases $$$t$$$ ($$$1 \le t \le 200$$$). The description of the test cases follows. The first line of each test case contains two integers $$$n$$$ and $$$m$$$ ($$$1 \leq n \leq 10^{3}$$$, $$$1 \leq m \leq 10^{5}$$$) — the number of stude... | ["10\n5"] | #include <stdio.h>
#include <string.h>
int main(){
int t, n, m, result, media, total, nota;
scanf("%d", &t);
media = 0;
result = 0;
total = 0;
for(int i = 0; i < t; ++i){
scanf("%d %d", &n, &m);
total = 0;
for(int u = 0; u < n; ++u){
scanf("%d", ¬a);
... | |
$$$n$$$ students are taking an exam. The highest possible score at this exam is $$$m$$$. Let $$$a_{i}$$$ be the score of the $$$i$$$-th student. You have access to the school database which stores the results of all students.You can change each student's score as long as the following conditions are satisfied: All sc... | For each testcase, output one integer — the highest possible score you can assign to yourself such that both conditions are satisfied._ | C | 7c2a61de728e6767b25e58c74497bbae | 43dc0e0cab2d4d9d9c54b9c7e8a77548 | GNU C11 | standard output | 256 megabytes | train_002.jsonl | [
"implementation"
] | 1583332500 | ["2\n4 10\n1 2 3 4\n4 5\n1 2 3 4"] | NoteIn the first case, $$$a = [1,2,3,4] $$$, with average of $$$2.5$$$. You can change array $$$a$$$ to $$$[10,0,0,0]$$$. Average remains $$$2.5$$$, and all conditions are satisfied.In the second case, $$$0 \leq a_{i} \leq 5$$$. You can change $$$a$$$ to $$$[5,1,1,3]$$$. You cannot increase $$$a_{1}$$$ further as it wi... | PASSED | 800 | standard input | 1 second | Each test contains multiple test cases. The first line contains the number of test cases $$$t$$$ ($$$1 \le t \le 200$$$). The description of the test cases follows. The first line of each test case contains two integers $$$n$$$ and $$$m$$$ ($$$1 \leq n \leq 10^{3}$$$, $$$1 \leq m \leq 10^{5}$$$) — the number of stude... | ["10\n5"] | #include <stdio.h>
#include <stdlib.h>
int main()
{
int t;
scanf("%d", &t);
for (int i = 0; i < t; i++)
{
int n, m;
scanf("%d%d", &n, &m);
int *arr = (int *)malloc(n * (sizeof(int)));
int sum = 0;
for (int j = 0; j < n; j++)
{
scanf("%d", &arr[... | |
$$$n$$$ students are taking an exam. The highest possible score at this exam is $$$m$$$. Let $$$a_{i}$$$ be the score of the $$$i$$$-th student. You have access to the school database which stores the results of all students.You can change each student's score as long as the following conditions are satisfied: All sc... | For each testcase, output one integer — the highest possible score you can assign to yourself such that both conditions are satisfied._ | C | 7c2a61de728e6767b25e58c74497bbae | 21d6b64b704bf21e13b137ecbe30724d | GNU C11 | standard output | 256 megabytes | train_002.jsonl | [
"implementation"
] | 1583332500 | ["2\n4 10\n1 2 3 4\n4 5\n1 2 3 4"] | NoteIn the first case, $$$a = [1,2,3,4] $$$, with average of $$$2.5$$$. You can change array $$$a$$$ to $$$[10,0,0,0]$$$. Average remains $$$2.5$$$, and all conditions are satisfied.In the second case, $$$0 \leq a_{i} \leq 5$$$. You can change $$$a$$$ to $$$[5,1,1,3]$$$. You cannot increase $$$a_{1}$$$ further as it wi... | PASSED | 800 | standard input | 1 second | Each test contains multiple test cases. The first line contains the number of test cases $$$t$$$ ($$$1 \le t \le 200$$$). The description of the test cases follows. The first line of each test case contains two integers $$$n$$$ and $$$m$$$ ($$$1 \leq n \leq 10^{3}$$$, $$$1 \leq m \leq 10^{5}$$$) — the number of stude... | ["10\n5"] | #include <stdio.h>
#define LL long long
LL int a,b,c,t;
LL int d;
int main(void)
{
scanf("%d",&a);
for(int i=0;i<a;i++)
{
c=0;
t=0;
scanf("%d %d",&b,&c);
for(int j=0;j<b;j++)
{
scanf("%d",&d);
t+=d;
}
... | |
$$$n$$$ students are taking an exam. The highest possible score at this exam is $$$m$$$. Let $$$a_{i}$$$ be the score of the $$$i$$$-th student. You have access to the school database which stores the results of all students.You can change each student's score as long as the following conditions are satisfied: All sc... | For each testcase, output one integer — the highest possible score you can assign to yourself such that both conditions are satisfied._ | C | 7c2a61de728e6767b25e58c74497bbae | 9df091ec2b72b1a6ec6e65b57c4f5970 | GNU C11 | standard output | 256 megabytes | train_002.jsonl | [
"implementation"
] | 1583332500 | ["2\n4 10\n1 2 3 4\n4 5\n1 2 3 4"] | NoteIn the first case, $$$a = [1,2,3,4] $$$, with average of $$$2.5$$$. You can change array $$$a$$$ to $$$[10,0,0,0]$$$. Average remains $$$2.5$$$, and all conditions are satisfied.In the second case, $$$0 \leq a_{i} \leq 5$$$. You can change $$$a$$$ to $$$[5,1,1,3]$$$. You cannot increase $$$a_{1}$$$ further as it wi... | PASSED | 800 | standard input | 1 second | Each test contains multiple test cases. The first line contains the number of test cases $$$t$$$ ($$$1 \le t \le 200$$$). The description of the test cases follows. The first line of each test case contains two integers $$$n$$$ and $$$m$$$ ($$$1 \leq n \leq 10^{3}$$$, $$$1 \leq m \leq 10^{5}$$$) — the number of stude... | ["10\n5"] | int main()
{
int t=0;
scanf("%d",&t);
while(t--)
{
int n,m,s=0;
scanf("%d %d",&n,&m);
int a[n];
for(int i =0; i<n; i++)
{
scanf("%d ",&a[i]);
s=s+a[i];
}
if(s>=m)
printf("%d\n",m);
else
printf("%d\n",... | |
$$$n$$$ students are taking an exam. The highest possible score at this exam is $$$m$$$. Let $$$a_{i}$$$ be the score of the $$$i$$$-th student. You have access to the school database which stores the results of all students.You can change each student's score as long as the following conditions are satisfied: All sc... | For each testcase, output one integer — the highest possible score you can assign to yourself such that both conditions are satisfied._ | C | 7c2a61de728e6767b25e58c74497bbae | dfff8975bc89a1c80ce2a487c8afbd22 | GNU C11 | standard output | 256 megabytes | train_002.jsonl | [
"implementation"
] | 1583332500 | ["2\n4 10\n1 2 3 4\n4 5\n1 2 3 4"] | NoteIn the first case, $$$a = [1,2,3,4] $$$, with average of $$$2.5$$$. You can change array $$$a$$$ to $$$[10,0,0,0]$$$. Average remains $$$2.5$$$, and all conditions are satisfied.In the second case, $$$0 \leq a_{i} \leq 5$$$. You can change $$$a$$$ to $$$[5,1,1,3]$$$. You cannot increase $$$a_{1}$$$ further as it wi... | PASSED | 800 | standard input | 1 second | Each test contains multiple test cases. The first line contains the number of test cases $$$t$$$ ($$$1 \le t \le 200$$$). The description of the test cases follows. The first line of each test case contains two integers $$$n$$$ and $$$m$$$ ($$$1 \leq n \leq 10^{3}$$$, $$$1 \leq m \leq 10^{5}$$$) — the number of stude... | ["10\n5"] | #include<stdio.h>
main(){
int t,n,m,res,x;
scanf("%d",&t);
while(t--){
scanf("%d%d",&n,&m);
res=0;
while(n--){
scanf("%d",&x);
res+=x;
}
if(res>=m){
printf("%d\n",m);
}
else{
printf("%d\n",res);... | |
$$$n$$$ students are taking an exam. The highest possible score at this exam is $$$m$$$. Let $$$a_{i}$$$ be the score of the $$$i$$$-th student. You have access to the school database which stores the results of all students.You can change each student's score as long as the following conditions are satisfied: All sc... | For each testcase, output one integer — the highest possible score you can assign to yourself such that both conditions are satisfied._ | C | 7c2a61de728e6767b25e58c74497bbae | 58a3cdbdb42d75fc171f63aee6de34da | GNU C11 | standard output | 256 megabytes | train_002.jsonl | [
"implementation"
] | 1583332500 | ["2\n4 10\n1 2 3 4\n4 5\n1 2 3 4"] | NoteIn the first case, $$$a = [1,2,3,4] $$$, with average of $$$2.5$$$. You can change array $$$a$$$ to $$$[10,0,0,0]$$$. Average remains $$$2.5$$$, and all conditions are satisfied.In the second case, $$$0 \leq a_{i} \leq 5$$$. You can change $$$a$$$ to $$$[5,1,1,3]$$$. You cannot increase $$$a_{1}$$$ further as it wi... | PASSED | 800 | standard input | 1 second | Each test contains multiple test cases. The first line contains the number of test cases $$$t$$$ ($$$1 \le t \le 200$$$). The description of the test cases follows. The first line of each test case contains two integers $$$n$$$ and $$$m$$$ ($$$1 \leq n \leq 10^{3}$$$, $$$1 \leq m \leq 10^{5}$$$) — the number of stude... | ["10\n5"] | #include<stdio.h>
#include<stdlib.h>
int main()
{
int t;
scanf("%d",&t);
while(t--)
{
int n,m,i,s=0;
scanf("%d %d",&n,&m);
int a[n+1];
for(i=0;i<n;i++)
{
scanf("%d",&a[i]);
s+=a[i];
}
if(m>s)
{
printf("%d\n",s);
}
else
{
pri... | |
$$$n$$$ students are taking an exam. The highest possible score at this exam is $$$m$$$. Let $$$a_{i}$$$ be the score of the $$$i$$$-th student. You have access to the school database which stores the results of all students.You can change each student's score as long as the following conditions are satisfied: All sc... | For each testcase, output one integer — the highest possible score you can assign to yourself such that both conditions are satisfied._ | C | 7c2a61de728e6767b25e58c74497bbae | c18321a8d7bcc14d391d64e30c59a750 | GNU C11 | standard output | 256 megabytes | train_002.jsonl | [
"implementation"
] | 1583332500 | ["2\n4 10\n1 2 3 4\n4 5\n1 2 3 4"] | NoteIn the first case, $$$a = [1,2,3,4] $$$, with average of $$$2.5$$$. You can change array $$$a$$$ to $$$[10,0,0,0]$$$. Average remains $$$2.5$$$, and all conditions are satisfied.In the second case, $$$0 \leq a_{i} \leq 5$$$. You can change $$$a$$$ to $$$[5,1,1,3]$$$. You cannot increase $$$a_{1}$$$ further as it wi... | PASSED | 800 | standard input | 1 second | Each test contains multiple test cases. The first line contains the number of test cases $$$t$$$ ($$$1 \le t \le 200$$$). The description of the test cases follows. The first line of each test case contains two integers $$$n$$$ and $$$m$$$ ($$$1 \leq n \leq 10^{3}$$$, $$$1 \leq m \leq 10^{5}$$$) — the number of stude... | ["10\n5"] | #include<stdio.h>
int main(void){
long long int n,t,m,a[1000],j,s=0,i;
scanf("%lld", &t);
for(i=0;i<t;i++){
s=0;
scanf("%lld %lld", &n,&m);
for(j=0;j<n;j++){
scanf("%lld", &a[i]);
s=s+a[i];
}
if(s<=m){
printf("%lld\n",s);}
e... | |
$$$n$$$ students are taking an exam. The highest possible score at this exam is $$$m$$$. Let $$$a_{i}$$$ be the score of the $$$i$$$-th student. You have access to the school database which stores the results of all students.You can change each student's score as long as the following conditions are satisfied: All sc... | For each testcase, output one integer — the highest possible score you can assign to yourself such that both conditions are satisfied._ | C | 7c2a61de728e6767b25e58c74497bbae | c117214e528f1d8514b7aaa6b7bb4a93 | GNU C11 | standard output | 256 megabytes | train_002.jsonl | [
"implementation"
] | 1583332500 | ["2\n4 10\n1 2 3 4\n4 5\n1 2 3 4"] | NoteIn the first case, $$$a = [1,2,3,4] $$$, with average of $$$2.5$$$. You can change array $$$a$$$ to $$$[10,0,0,0]$$$. Average remains $$$2.5$$$, and all conditions are satisfied.In the second case, $$$0 \leq a_{i} \leq 5$$$. You can change $$$a$$$ to $$$[5,1,1,3]$$$. You cannot increase $$$a_{1}$$$ further as it wi... | PASSED | 800 | standard input | 1 second | Each test contains multiple test cases. The first line contains the number of test cases $$$t$$$ ($$$1 \le t \le 200$$$). The description of the test cases follows. The first line of each test case contains two integers $$$n$$$ and $$$m$$$ ($$$1 \leq n \leq 10^{3}$$$, $$$1 \leq m \leq 10^{5}$$$) — the number of stude... | ["10\n5"] | #include<stdio.h>
int main()
{
int t;
scanf("%d",&t);
while(t>0)
{
int n,m;
scanf("%d%d",&n,&m);
int a[n],i,s=0;
for(i=0;i<n;i++)
{
scanf("%d",&a[i]);
s=s+a[i];
}
float avg=s/n;
if(s<=m)
{
printf(... | |
$$$n$$$ students are taking an exam. The highest possible score at this exam is $$$m$$$. Let $$$a_{i}$$$ be the score of the $$$i$$$-th student. You have access to the school database which stores the results of all students.You can change each student's score as long as the following conditions are satisfied: All sc... | For each testcase, output one integer — the highest possible score you can assign to yourself such that both conditions are satisfied._ | C | 7c2a61de728e6767b25e58c74497bbae | 371c7db0cfd601b97bbf835161f9a9fe | GNU C11 | standard output | 256 megabytes | train_002.jsonl | [
"implementation"
] | 1583332500 | ["2\n4 10\n1 2 3 4\n4 5\n1 2 3 4"] | NoteIn the first case, $$$a = [1,2,3,4] $$$, with average of $$$2.5$$$. You can change array $$$a$$$ to $$$[10,0,0,0]$$$. Average remains $$$2.5$$$, and all conditions are satisfied.In the second case, $$$0 \leq a_{i} \leq 5$$$. You can change $$$a$$$ to $$$[5,1,1,3]$$$. You cannot increase $$$a_{1}$$$ further as it wi... | PASSED | 800 | standard input | 1 second | Each test contains multiple test cases. The first line contains the number of test cases $$$t$$$ ($$$1 \le t \le 200$$$). The description of the test cases follows. The first line of each test case contains two integers $$$n$$$ and $$$m$$$ ($$$1 \leq n \leq 10^{3}$$$, $$$1 \leq m \leq 10^{5}$$$) — the number of stude... | ["10\n5"] | #include <stdio.h>
#define ll long long
int main()
{
ll int t,n,m,i,j;
scanf("%lld",&t);
while(t--)
{
int x,s=0;
scanf("%lld %lld",&n,&m);
for(i=0;i<n;i++)
{
scanf("%d",&x);
s+=x;
}
j=(s<m)?s:m;
printf("%lld\n",j);
}
return 0;
}
| |
$$$n$$$ students are taking an exam. The highest possible score at this exam is $$$m$$$. Let $$$a_{i}$$$ be the score of the $$$i$$$-th student. You have access to the school database which stores the results of all students.You can change each student's score as long as the following conditions are satisfied: All sc... | For each testcase, output one integer — the highest possible score you can assign to yourself such that both conditions are satisfied._ | C | 7c2a61de728e6767b25e58c74497bbae | 17b385005cd2ac7fee2a5f17f72c3f8a | GNU C11 | standard output | 256 megabytes | train_002.jsonl | [
"implementation"
] | 1583332500 | ["2\n4 10\n1 2 3 4\n4 5\n1 2 3 4"] | NoteIn the first case, $$$a = [1,2,3,4] $$$, with average of $$$2.5$$$. You can change array $$$a$$$ to $$$[10,0,0,0]$$$. Average remains $$$2.5$$$, and all conditions are satisfied.In the second case, $$$0 \leq a_{i} \leq 5$$$. You can change $$$a$$$ to $$$[5,1,1,3]$$$. You cannot increase $$$a_{1}$$$ further as it wi... | PASSED | 800 | standard input | 1 second | Each test contains multiple test cases. The first line contains the number of test cases $$$t$$$ ($$$1 \le t \le 200$$$). The description of the test cases follows. The first line of each test case contains two integers $$$n$$$ and $$$m$$$ ($$$1 \leq n \leq 10^{3}$$$, $$$1 \leq m \leq 10^{5}$$$) — the number of stude... | ["10\n5"] | #include<stdio.h>
#include<stdlib.h>
int main()
{
int *a,i,n,max,t;
scanf("%d",&t);
while(t--)
{
scanf("%d %d",&n,&max);
a=(int *)malloc(n*sizeof(int));
for(i=0;i<n;i++)
{
scanf("%d",&a[i]);
}
if(a[0]==max)
{
printf("%d\n",max);
}
else
{
... | |
$$$n$$$ students are taking an exam. The highest possible score at this exam is $$$m$$$. Let $$$a_{i}$$$ be the score of the $$$i$$$-th student. You have access to the school database which stores the results of all students.You can change each student's score as long as the following conditions are satisfied: All sc... | For each testcase, output one integer — the highest possible score you can assign to yourself such that both conditions are satisfied._ | C | 7c2a61de728e6767b25e58c74497bbae | 822410e478453f38f598d22237a7565b | GNU C11 | standard output | 256 megabytes | train_002.jsonl | [
"implementation"
] | 1583332500 | ["2\n4 10\n1 2 3 4\n4 5\n1 2 3 4"] | NoteIn the first case, $$$a = [1,2,3,4] $$$, with average of $$$2.5$$$. You can change array $$$a$$$ to $$$[10,0,0,0]$$$. Average remains $$$2.5$$$, and all conditions are satisfied.In the second case, $$$0 \leq a_{i} \leq 5$$$. You can change $$$a$$$ to $$$[5,1,1,3]$$$. You cannot increase $$$a_{1}$$$ further as it wi... | PASSED | 800 | standard input | 1 second | Each test contains multiple test cases. The first line contains the number of test cases $$$t$$$ ($$$1 \le t \le 200$$$). The description of the test cases follows. The first line of each test case contains two integers $$$n$$$ and $$$m$$$ ($$$1 \leq n \leq 10^{3}$$$, $$$1 \leq m \leq 10^{5}$$$) — the number of stude... | ["10\n5"] | #include<stdio.h>
#include<math.h>
int main()
{
int t,n,m,i,j,a[1000],h,sum,b;
scanf("%d",&t);
for(i=0;i<t;i++)
{
sum=0;
scanf("%d %d",&n,&m);
for(j=0;j<n;j++)
{
scanf("%d",&a[j]);
}
for(j=0;j<n;j++)
{
sum=sum+a[j];
... | |
$$$n$$$ students are taking an exam. The highest possible score at this exam is $$$m$$$. Let $$$a_{i}$$$ be the score of the $$$i$$$-th student. You have access to the school database which stores the results of all students.You can change each student's score as long as the following conditions are satisfied: All sc... | For each testcase, output one integer — the highest possible score you can assign to yourself such that both conditions are satisfied._ | C | 7c2a61de728e6767b25e58c74497bbae | f430c48bbcc0c57b5b234f9a3347b7da | GNU C11 | standard output | 256 megabytes | train_002.jsonl | [
"implementation"
] | 1583332500 | ["2\n4 10\n1 2 3 4\n4 5\n1 2 3 4"] | NoteIn the first case, $$$a = [1,2,3,4] $$$, with average of $$$2.5$$$. You can change array $$$a$$$ to $$$[10,0,0,0]$$$. Average remains $$$2.5$$$, and all conditions are satisfied.In the second case, $$$0 \leq a_{i} \leq 5$$$. You can change $$$a$$$ to $$$[5,1,1,3]$$$. You cannot increase $$$a_{1}$$$ further as it wi... | PASSED | 800 | standard input | 1 second | Each test contains multiple test cases. The first line contains the number of test cases $$$t$$$ ($$$1 \le t \le 200$$$). The description of the test cases follows. The first line of each test case contains two integers $$$n$$$ and $$$m$$$ ($$$1 \leq n \leq 10^{3}$$$, $$$1 \leq m \leq 10^{5}$$$) — the number of stude... | ["10\n5"] | #include <stdio.h>
int high;
int max_of_arr(int A[],int siz){
high =A[0];
int i = 1;
while(i<siz){
if (A[i]>high ){
high = A[i];
}
i++;
}
return high;
}
void main(){
// total test cases t
int t;
scanf("%d",&t);
// number of students ie araray si... | |
Ziota found a video game called "Monster Invaders".Similar to every other shooting RPG game, "Monster Invaders" involves killing monsters and bosses with guns.For the sake of simplicity, we only consider two different types of monsters and three different types of guns.Namely, the two types of monsters are: a normal ... | Print one integer, the minimum time to finish the game. | C | b532deda90a4edc6e97b207cb05d3843 | 5c4b7eeebcbe654aafe7720fa4d79faa | GNU C11 | standard output | 512 megabytes | train_002.jsonl | [
"dp",
"implementation",
"greedy"
] | 1598798100 | ["4 1 3 4 3\n3 2 5 1", "4 2 4 4 1\n4 5 1 2"] | NoteIn the first test case, the optimal strategy is: Use the pistol to kill three normal monsters and AWP to kill the boss (Total time $$$1\cdot3+4=7$$$) Move to stage two (Total time $$$7+3=10$$$) Use the pistol twice and AWP to kill the boss (Total time $$$10+1\cdot2+4=16$$$) Move to stage three (Total time $$$16... | PASSED | 2,300 | standard input | 2 seconds | The first line of the input contains five integers separated by single spaces: $$$n$$$ $$$(2 \le n \le 10^6)$$$ — the number of stages, $$$r_1, r_2, r_3$$$ $$$(1 \le r_1 \le r_2 \le r_3 \le 10^9)$$$ — the reload time of the three guns respectively, $$$d$$$ $$$(1 \le d \le 10^9)$$$ — the time of moving between adjacent ... | ["34", "31"] | #include <stdio.h>
#define N 1000000
long long min(long long a, long long b) { return a < b ? a : b; }
int main() {
static long long tt1[N], tt2[N], dp[N], dq[N];
int n, r1, r2, r3, d, i;
long long ans;
scanf("%d%d%d%d%d", &n, &r1, &r2, &r3, &d);
for (i = 0; i < n; i++) {
int a;
scanf("%d", &a);
tt1[i] ... | |
Okabe and Super Hacker Daru are stacking and removing boxes. There are n boxes numbered from 1 to n. Initially there are no boxes on the stack.Okabe, being a control freak, gives Daru 2n commands: n of which are to add a box to the top of the stack, and n of which are to remove a box from the top of the stack and throw... | Print the minimum number of times Daru needs to reorder the boxes to successfully complete all of Okabe's commands. | C | 2535fc09ce74b829c26e1ebfc1ee17c6 | 209eb33a7dfbab10e524dfc6ecffb4ad | GNU C | standard output | 256 megabytes | train_002.jsonl | [
"data structures",
"greedy",
"trees"
] | 1498401300 | ["3\nadd 1\nremove\nadd 2\nadd 3\nremove\nremove", "7\nadd 3\nadd 2\nadd 1\nremove\nadd 4\nremove\nremove\nremove\nadd 6\nadd 7\nadd 5\nremove\nremove\nremove"] | NoteIn the first sample, Daru should reorder the boxes after adding box 3 to the stack.In the second sample, Daru should reorder the boxes after adding box 4 and box 7 to the stack. | PASSED | 1,500 | standard input | 3 seconds | The first line of input contains the integer n (1 ≤ n ≤ 3·105) — the number of boxes. Each of the next 2n lines of input starts with a string "add" or "remove". If the line starts with the "add", an integer x (1 ≤ x ≤ n) follows, indicating that Daru should add the box with number x to the top of the stack. It is guar... | ["1", "2"] | #include<stdio.h>
main()
{
int n,i,num,p=0,stack[300000], top=-1, count=0;
scanf("%d",&n);
char arr[10];
for(i=0;i<2*n;i++)
{
scanf("%s",arr);
if(arr[0]=='a')
{
scanf("%d", &num);
stack[++top]=num;
}
else if(arr[0]=='r')
{
p++;
if(top!=-1)
{
if(stack[top]==p)
top--;
else
... | |
Okabe and Super Hacker Daru are stacking and removing boxes. There are n boxes numbered from 1 to n. Initially there are no boxes on the stack.Okabe, being a control freak, gives Daru 2n commands: n of which are to add a box to the top of the stack, and n of which are to remove a box from the top of the stack and throw... | Print the minimum number of times Daru needs to reorder the boxes to successfully complete all of Okabe's commands. | C | 2535fc09ce74b829c26e1ebfc1ee17c6 | 731d580dbd55c519516ab342838a3230 | GNU C | standard output | 256 megabytes | train_002.jsonl | [
"data structures",
"greedy",
"trees"
] | 1498401300 | ["3\nadd 1\nremove\nadd 2\nadd 3\nremove\nremove", "7\nadd 3\nadd 2\nadd 1\nremove\nadd 4\nremove\nremove\nremove\nadd 6\nadd 7\nadd 5\nremove\nremove\nremove"] | NoteIn the first sample, Daru should reorder the boxes after adding box 3 to the stack.In the second sample, Daru should reorder the boxes after adding box 4 and box 7 to the stack. | PASSED | 1,500 | standard input | 3 seconds | The first line of input contains the integer n (1 ≤ n ≤ 3·105) — the number of boxes. Each of the next 2n lines of input starts with a string "add" or "remove". If the line starts with the "add", an integer x (1 ≤ x ≤ n) follows, indicating that Daru should add the box with number x to the top of the stack. It is guar... | ["1", "2"] | #include<stdio.h>
#define MAX 300003
void push(int value);
void pop();
struct stack
{
int stk[MAX];
int top;
}stack;
void push(int value)
{
stack.top+=1;
stack.stk[stack.top]=value;
}
void pop()
{
stack.top-=1;
}
int main()
{
int n,i,num,count=1,ans=0;
char s[10];
stack.top=-1;
scanf("%d",&n);
for(i=0;i<2... | |
Okabe and Super Hacker Daru are stacking and removing boxes. There are n boxes numbered from 1 to n. Initially there are no boxes on the stack.Okabe, being a control freak, gives Daru 2n commands: n of which are to add a box to the top of the stack, and n of which are to remove a box from the top of the stack and throw... | Print the minimum number of times Daru needs to reorder the boxes to successfully complete all of Okabe's commands. | C | 2535fc09ce74b829c26e1ebfc1ee17c6 | ed3fd9df653af06cfff84813f58ef560 | GNU C | standard output | 256 megabytes | train_002.jsonl | [
"data structures",
"greedy",
"trees"
] | 1498401300 | ["3\nadd 1\nremove\nadd 2\nadd 3\nremove\nremove", "7\nadd 3\nadd 2\nadd 1\nremove\nadd 4\nremove\nremove\nremove\nadd 6\nadd 7\nadd 5\nremove\nremove\nremove"] | NoteIn the first sample, Daru should reorder the boxes after adding box 3 to the stack.In the second sample, Daru should reorder the boxes after adding box 4 and box 7 to the stack. | PASSED | 1,500 | standard input | 3 seconds | The first line of input contains the integer n (1 ≤ n ≤ 3·105) — the number of boxes. Each of the next 2n lines of input starts with a string "add" or "remove". If the line starts with the "add", an integer x (1 ≤ x ≤ n) follows, indicating that Daru should add the box with number x to the top of the stack. It is guar... | ["1", "2"] | #include<stdio.h>
#include<stdlib.h>
#include<stdbool.h>
int main()
{
int n,i,a[300000],top=-1,count=0,check=0;
scanf("%d",&n);
for(i=0;i<2*n;i++)
{
char s[10];
scanf("%s",s);
int m;
if(s[0]=='a')
{
top++;
scanf("%d",&m);
a[top... | |
Okabe and Super Hacker Daru are stacking and removing boxes. There are n boxes numbered from 1 to n. Initially there are no boxes on the stack.Okabe, being a control freak, gives Daru 2n commands: n of which are to add a box to the top of the stack, and n of which are to remove a box from the top of the stack and throw... | Print the minimum number of times Daru needs to reorder the boxes to successfully complete all of Okabe's commands. | C | 2535fc09ce74b829c26e1ebfc1ee17c6 | 38619291e2d2d1816cd3ea722dcf1b66 | GNU C | standard output | 256 megabytes | train_002.jsonl | [
"data structures",
"greedy",
"trees"
] | 1498401300 | ["3\nadd 1\nremove\nadd 2\nadd 3\nremove\nremove", "7\nadd 3\nadd 2\nadd 1\nremove\nadd 4\nremove\nremove\nremove\nadd 6\nadd 7\nadd 5\nremove\nremove\nremove"] | NoteIn the first sample, Daru should reorder the boxes after adding box 3 to the stack.In the second sample, Daru should reorder the boxes after adding box 4 and box 7 to the stack. | PASSED | 1,500 | standard input | 3 seconds | The first line of input contains the integer n (1 ≤ n ≤ 3·105) — the number of boxes. Each of the next 2n lines of input starts with a string "add" or "remove". If the line starts with the "add", an integer x (1 ≤ x ≤ n) follows, indicating that Daru should add the box with number x to the top of the stack. It is guar... | ["1", "2"] | #include<stdio.h>
#include<string.h>
int main()
{
char s[7];
int rem = 0;
int n,temp=-1;
int in;
int heap[300001];
int ans = 0;
scanf("%d",&n);
for(int i = 0 ; i<(2*n) ; i++)
{
scanf("%s",s);
if(s[0]=='a')
{
scanf("%d",&in);
heap[++temp... | |
Okabe and Super Hacker Daru are stacking and removing boxes. There are n boxes numbered from 1 to n. Initially there are no boxes on the stack.Okabe, being a control freak, gives Daru 2n commands: n of which are to add a box to the top of the stack, and n of which are to remove a box from the top of the stack and throw... | Print the minimum number of times Daru needs to reorder the boxes to successfully complete all of Okabe's commands. | C | 2535fc09ce74b829c26e1ebfc1ee17c6 | 1728eca167800d5c33ab038301de6fd7 | GNU C | standard output | 256 megabytes | train_002.jsonl | [
"data structures",
"greedy",
"trees"
] | 1498401300 | ["3\nadd 1\nremove\nadd 2\nadd 3\nremove\nremove", "7\nadd 3\nadd 2\nadd 1\nremove\nadd 4\nremove\nremove\nremove\nadd 6\nadd 7\nadd 5\nremove\nremove\nremove"] | NoteIn the first sample, Daru should reorder the boxes after adding box 3 to the stack.In the second sample, Daru should reorder the boxes after adding box 4 and box 7 to the stack. | PASSED | 1,500 | standard input | 3 seconds | The first line of input contains the integer n (1 ≤ n ≤ 3·105) — the number of boxes. Each of the next 2n lines of input starts with a string "add" or "remove". If the line starts with the "add", an integer x (1 ≤ x ≤ n) follows, indicating that Daru should add the box with number x to the top of the stack. It is guar... | ["1", "2"] | #include <stdio.h>
#include <string.h>
#include <stdlib.h>
/*
Problem 821C
C. Okabe and Boxes
*/
static int *stack;
static int sp = 0;
void print_stack(void)
{
int i;
puts("*********");
for(i = 0; i < sp; i ++)
printf("%d\n", stack[i]);
}
int compare(const void *x, const void *y)
{
int a = *(int ... | |
Okabe and Super Hacker Daru are stacking and removing boxes. There are n boxes numbered from 1 to n. Initially there are no boxes on the stack.Okabe, being a control freak, gives Daru 2n commands: n of which are to add a box to the top of the stack, and n of which are to remove a box from the top of the stack and throw... | Print the minimum number of times Daru needs to reorder the boxes to successfully complete all of Okabe's commands. | C | 2535fc09ce74b829c26e1ebfc1ee17c6 | 70070d17843a7499f40856109912f2fc | GNU C | standard output | 256 megabytes | train_002.jsonl | [
"data structures",
"greedy",
"trees"
] | 1498401300 | ["3\nadd 1\nremove\nadd 2\nadd 3\nremove\nremove", "7\nadd 3\nadd 2\nadd 1\nremove\nadd 4\nremove\nremove\nremove\nadd 6\nadd 7\nadd 5\nremove\nremove\nremove"] | NoteIn the first sample, Daru should reorder the boxes after adding box 3 to the stack.In the second sample, Daru should reorder the boxes after adding box 4 and box 7 to the stack. | PASSED | 1,500 | standard input | 3 seconds | The first line of input contains the integer n (1 ≤ n ≤ 3·105) — the number of boxes. Each of the next 2n lines of input starts with a string "add" or "remove". If the line starts with the "add", an integer x (1 ≤ x ≤ n) follows, indicating that Daru should add the box with number x to the top of the stack. It is guar... | ["1", "2"] | #include <stdio.h>
#include <string.h>
int a[1000000], b[1000000];
int main(int argc, char const *argv[])
{
int i,j,k,l,n,q,x,y,p,m,b;
char str[100];
scanf("%d", &n);
// for(i=0;i<n;i++)
// b[i] = 0;
int count = 0;
i=0;
j=0;
int num = 1;
for(l=0;l<2*n;l++){
// printf("statement : %d\n",l );
scanf("%s"... | |
Okabe and Super Hacker Daru are stacking and removing boxes. There are n boxes numbered from 1 to n. Initially there are no boxes on the stack.Okabe, being a control freak, gives Daru 2n commands: n of which are to add a box to the top of the stack, and n of which are to remove a box from the top of the stack and throw... | Print the minimum number of times Daru needs to reorder the boxes to successfully complete all of Okabe's commands. | C | 2535fc09ce74b829c26e1ebfc1ee17c6 | e36bf3b0c32b1598e64435cd375a9359 | GNU C | standard output | 256 megabytes | train_002.jsonl | [
"data structures",
"greedy",
"trees"
] | 1498401300 | ["3\nadd 1\nremove\nadd 2\nadd 3\nremove\nremove", "7\nadd 3\nadd 2\nadd 1\nremove\nadd 4\nremove\nremove\nremove\nadd 6\nadd 7\nadd 5\nremove\nremove\nremove"] | NoteIn the first sample, Daru should reorder the boxes after adding box 3 to the stack.In the second sample, Daru should reorder the boxes after adding box 4 and box 7 to the stack. | PASSED | 1,500 | standard input | 3 seconds | The first line of input contains the integer n (1 ≤ n ≤ 3·105) — the number of boxes. Each of the next 2n lines of input starts with a string "add" or "remove". If the line starts with the "add", an integer x (1 ≤ x ≤ n) follows, indicating that Daru should add the box with number x to the top of the stack. It is guar... | ["1", "2"] | #include <stdio.h>
typedef struct {
int n;
int array[500000];
} stack;
stack S;
void push(int x) {
S.array[S.n] = x;
S.n += 1;
return;
}
int pop(void) {
S.n -= 1;
return S.array[S.n];
}
int top(void) {
if (S.n != 0)
return S.array[S.n - 1];
else
return 0;
}
int ... | |
Okabe and Super Hacker Daru are stacking and removing boxes. There are n boxes numbered from 1 to n. Initially there are no boxes on the stack.Okabe, being a control freak, gives Daru 2n commands: n of which are to add a box to the top of the stack, and n of which are to remove a box from the top of the stack and throw... | Print the minimum number of times Daru needs to reorder the boxes to successfully complete all of Okabe's commands. | C | 2535fc09ce74b829c26e1ebfc1ee17c6 | ed2af5afba794e49303e628aaa0b7457 | GNU C | standard output | 256 megabytes | train_002.jsonl | [
"data structures",
"greedy",
"trees"
] | 1498401300 | ["3\nadd 1\nremove\nadd 2\nadd 3\nremove\nremove", "7\nadd 3\nadd 2\nadd 1\nremove\nadd 4\nremove\nremove\nremove\nadd 6\nadd 7\nadd 5\nremove\nremove\nremove"] | NoteIn the first sample, Daru should reorder the boxes after adding box 3 to the stack.In the second sample, Daru should reorder the boxes after adding box 4 and box 7 to the stack. | PASSED | 1,500 | standard input | 3 seconds | The first line of input contains the integer n (1 ≤ n ≤ 3·105) — the number of boxes. Each of the next 2n lines of input starts with a string "add" or "remove". If the line starts with the "add", an integer x (1 ≤ x ≤ n) follows, indicating that Daru should add the box with number x to the top of the stack. It is guar... | ["1", "2"] | #include <stdio.h>
typedef long long unsigned llu;
typedef unsigned u;
u A[333333],Q[333333],Qi,x=1;char cmd[9];
int main()
{
u n,q,k,r=0;
scanf("%u",&n);
for(q=n<<1;q--;)
{
scanf("%s",cmd);
if(*cmd=='a')
{
scanf("%u",&k);
Q[Qi++]=k;
}
if(*cmd=='r')
{
if(Qi&&Q[Qi-1]==x){--Qi;++x;}
else if(!Q... | |
You are given a permutation $$$p_1, p_2, \dots, p_n$$$. Recall that sequence of $$$n$$$ integers is called a permutation if it contains all integers from $$$1$$$ to $$$n$$$ exactly once.Find three indices $$$i$$$, $$$j$$$ and $$$k$$$ such that: $$$1 \le i < j < k \le n$$$; $$$p_i < p_j$$$ and $$$p_j > p_... | For each test case: if there are such indices $$$i$$$, $$$j$$$ and $$$k$$$, print YES (case insensitive) and the indices themselves; if there are no such indices, print NO (case insensitive). If there are multiple valid triples of indices, print any of them. | C | dd55e29ac9756325530ad2f4479d9f6d | 1df3d7dfbafbba322c9712e62a16a892 | GNU C11 | standard output | 256 megabytes | train_002.jsonl | [
"data structures",
"brute force"
] | 1594565100 | ["3\n4\n2 1 4 3\n6\n4 6 1 2 5 3\n5\n5 3 1 2 4"] | null | PASSED | 900 | standard input | 2 seconds | The first line contains a single integer $$$T$$$ ($$$1 \le T \le 200$$$) — the number of test cases. Next $$$2T$$$ lines contain test cases — two lines per test case. The first line of each test case contains the single integer $$$n$$$ ($$$3 \le n \le 1000$$$) — the length of the permutation $$$p$$$. The second line co... | ["YES\n2 3 4\nYES\n3 5 6\nNO"] | #include<stdio.h>
#include<stdlib.h>
int main()
{
int m,t;
int n,i,j,k,l,r,temp,flag;
scanf("%d",&t);
for(m=1;m<=t;m++)
{ flag=0;
scanf("%d",&n);
int a[n];
for(i=0;i<n;i++)
scanf("%d",&a[i]);
// i=0;
//j=1;
//k=2;
for(j=1;j<n-1;j... | |
You are given a permutation $$$p_1, p_2, \dots, p_n$$$. Recall that sequence of $$$n$$$ integers is called a permutation if it contains all integers from $$$1$$$ to $$$n$$$ exactly once.Find three indices $$$i$$$, $$$j$$$ and $$$k$$$ such that: $$$1 \le i < j < k \le n$$$; $$$p_i < p_j$$$ and $$$p_j > p_... | For each test case: if there are such indices $$$i$$$, $$$j$$$ and $$$k$$$, print YES (case insensitive) and the indices themselves; if there are no such indices, print NO (case insensitive). If there are multiple valid triples of indices, print any of them. | C | dd55e29ac9756325530ad2f4479d9f6d | 6bb7462432e9b7165403910db43735a5 | GNU C11 | standard output | 256 megabytes | train_002.jsonl | [
"data structures",
"brute force"
] | 1594565100 | ["3\n4\n2 1 4 3\n6\n4 6 1 2 5 3\n5\n5 3 1 2 4"] | null | PASSED | 900 | standard input | 2 seconds | The first line contains a single integer $$$T$$$ ($$$1 \le T \le 200$$$) — the number of test cases. Next $$$2T$$$ lines contain test cases — two lines per test case. The first line of each test case contains the single integer $$$n$$$ ($$$3 \le n \le 1000$$$) — the length of the permutation $$$p$$$. The second line co... | ["YES\n2 3 4\nYES\n3 5 6\nNO"] | #include <stdio.h>
#include <stdlib.h>
void prob1380A(){
int T;
scanf("%d", &T);
while(T--){
int n, r1, r2, r3,i, state=0;
scanf("%d", &n);
int arr[n];
for (i =0; i<n; i++)scanf("%d", &arr[i]);
for (i=1; i<n-1; i++){
if (arr[i-1]<arr[i]&& arr[i]>arr[i+1... | |
You are given a permutation $$$p_1, p_2, \dots, p_n$$$. Recall that sequence of $$$n$$$ integers is called a permutation if it contains all integers from $$$1$$$ to $$$n$$$ exactly once.Find three indices $$$i$$$, $$$j$$$ and $$$k$$$ such that: $$$1 \le i < j < k \le n$$$; $$$p_i < p_j$$$ and $$$p_j > p_... | For each test case: if there are such indices $$$i$$$, $$$j$$$ and $$$k$$$, print YES (case insensitive) and the indices themselves; if there are no such indices, print NO (case insensitive). If there are multiple valid triples of indices, print any of them. | C | dd55e29ac9756325530ad2f4479d9f6d | e13aabbf1549f88736755c1765a7e3c2 | GNU C11 | standard output | 256 megabytes | train_002.jsonl | [
"data structures",
"brute force"
] | 1594565100 | ["3\n4\n2 1 4 3\n6\n4 6 1 2 5 3\n5\n5 3 1 2 4"] | null | PASSED | 900 | standard input | 2 seconds | The first line contains a single integer $$$T$$$ ($$$1 \le T \le 200$$$) — the number of test cases. Next $$$2T$$$ lines contain test cases — two lines per test case. The first line of each test case contains the single integer $$$n$$$ ($$$3 \le n \le 1000$$$) — the length of the permutation $$$p$$$. The second line co... | ["YES\n2 3 4\nYES\n3 5 6\nNO"] | #include<stdio.h>
#include<stdlib.h>
int main()
{
int t;
scanf("%d", &t);
while (t--)
{
int n, a[1000], f = 0, i;
scanf("%d", &n);
for (i = 0; i<n; i++)
{
scanf("%d", &a[i]);
}
for (i = 1; i<n - 1; i++)
{
if ((a[i] > a[i - 1]) && (a[i] > a[i + 1]))
{
printf("YES\n");
printf("%d %d %... | |
You are given a permutation $$$p_1, p_2, \dots, p_n$$$. Recall that sequence of $$$n$$$ integers is called a permutation if it contains all integers from $$$1$$$ to $$$n$$$ exactly once.Find three indices $$$i$$$, $$$j$$$ and $$$k$$$ such that: $$$1 \le i < j < k \le n$$$; $$$p_i < p_j$$$ and $$$p_j > p_... | For each test case: if there are such indices $$$i$$$, $$$j$$$ and $$$k$$$, print YES (case insensitive) and the indices themselves; if there are no such indices, print NO (case insensitive). If there are multiple valid triples of indices, print any of them. | C | dd55e29ac9756325530ad2f4479d9f6d | d4d76ff47056100b91b7265d81a54c16 | GNU C11 | standard output | 256 megabytes | train_002.jsonl | [
"data structures",
"brute force"
] | 1594565100 | ["3\n4\n2 1 4 3\n6\n4 6 1 2 5 3\n5\n5 3 1 2 4"] | null | PASSED | 900 | standard input | 2 seconds | The first line contains a single integer $$$T$$$ ($$$1 \le T \le 200$$$) — the number of test cases. Next $$$2T$$$ lines contain test cases — two lines per test case. The first line of each test case contains the single integer $$$n$$$ ($$$3 \le n \le 1000$$$) — the length of the permutation $$$p$$$. The second line co... | ["YES\n2 3 4\nYES\n3 5 6\nNO"] | #include <stdio.h>
#include <stdlib.h>
int main(void)
{
int i,n, arr[1000], j,k=0;
scanf("%d", &i);
for(;i>0;i--){
scanf("%d", &n);
for(j=0;j<n;j++) scanf("%d", &arr[j]);
for(j=1;j<n-1;j++){
if(arr[j]>arr[j-1] && arr[j]>arr[j+1]){
printf("YES\n");
... | |
You are given a permutation $$$p_1, p_2, \dots, p_n$$$. Recall that sequence of $$$n$$$ integers is called a permutation if it contains all integers from $$$1$$$ to $$$n$$$ exactly once.Find three indices $$$i$$$, $$$j$$$ and $$$k$$$ such that: $$$1 \le i < j < k \le n$$$; $$$p_i < p_j$$$ and $$$p_j > p_... | For each test case: if there are such indices $$$i$$$, $$$j$$$ and $$$k$$$, print YES (case insensitive) and the indices themselves; if there are no such indices, print NO (case insensitive). If there are multiple valid triples of indices, print any of them. | C | dd55e29ac9756325530ad2f4479d9f6d | fa291c2460ae117f79576d1391916614 | GNU C11 | standard output | 256 megabytes | train_002.jsonl | [
"data structures",
"brute force"
] | 1594565100 | ["3\n4\n2 1 4 3\n6\n4 6 1 2 5 3\n5\n5 3 1 2 4"] | null | PASSED | 900 | standard input | 2 seconds | The first line contains a single integer $$$T$$$ ($$$1 \le T \le 200$$$) — the number of test cases. Next $$$2T$$$ lines contain test cases — two lines per test case. The first line of each test case contains the single integer $$$n$$$ ($$$3 \le n \le 1000$$$) — the length of the permutation $$$p$$$. The second line co... | ["YES\n2 3 4\nYES\n3 5 6\nNO"] | #include <stdio.h>
int main() {
int num_cases, n, num;
scanf("%d", &num_cases);
for (int idx = 0; idx < num_cases; ++idx) {
scanf("%d", &n);
char incr = 0;
int prev, maxi = 0;
scanf("%d", &prev);
for (int i = 2; i <= n; ++i) {
scanf("%d", &num);
... | |
You are given a permutation $$$p_1, p_2, \dots, p_n$$$. Recall that sequence of $$$n$$$ integers is called a permutation if it contains all integers from $$$1$$$ to $$$n$$$ exactly once.Find three indices $$$i$$$, $$$j$$$ and $$$k$$$ such that: $$$1 \le i < j < k \le n$$$; $$$p_i < p_j$$$ and $$$p_j > p_... | For each test case: if there are such indices $$$i$$$, $$$j$$$ and $$$k$$$, print YES (case insensitive) and the indices themselves; if there are no such indices, print NO (case insensitive). If there are multiple valid triples of indices, print any of them. | C | dd55e29ac9756325530ad2f4479d9f6d | 75f4ee027563802948060724a22c4a6d | GNU C11 | standard output | 256 megabytes | train_002.jsonl | [
"data structures",
"brute force"
] | 1594565100 | ["3\n4\n2 1 4 3\n6\n4 6 1 2 5 3\n5\n5 3 1 2 4"] | null | PASSED | 900 | standard input | 2 seconds | The first line contains a single integer $$$T$$$ ($$$1 \le T \le 200$$$) — the number of test cases. Next $$$2T$$$ lines contain test cases — two lines per test case. The first line of each test case contains the single integer $$$n$$$ ($$$3 \le n \le 1000$$$) — the length of the permutation $$$p$$$. The second line co... | ["YES\n2 3 4\nYES\n3 5 6\nNO"] | // Online C compiler to run C online.
// Write C code in this online editor and run it.
// Online C compiler to run C online.
// Write C code in this online editor and run it.
#include<stdio.h>
int main()
{
int i=0,j=-1,k,x=1,c=1,d=0,t,h,n;
scanf("%d",&t);
while(c<=t)
{
d=0;i=1;j=-1;k=... | |
You are given a permutation $$$p_1, p_2, \dots, p_n$$$. Recall that sequence of $$$n$$$ integers is called a permutation if it contains all integers from $$$1$$$ to $$$n$$$ exactly once.Find three indices $$$i$$$, $$$j$$$ and $$$k$$$ such that: $$$1 \le i < j < k \le n$$$; $$$p_i < p_j$$$ and $$$p_j > p_... | For each test case: if there are such indices $$$i$$$, $$$j$$$ and $$$k$$$, print YES (case insensitive) and the indices themselves; if there are no such indices, print NO (case insensitive). If there are multiple valid triples of indices, print any of them. | C | dd55e29ac9756325530ad2f4479d9f6d | 9d780dad2c273e46de179fa2af5135e0 | GNU C11 | standard output | 256 megabytes | train_002.jsonl | [
"data structures",
"brute force"
] | 1594565100 | ["3\n4\n2 1 4 3\n6\n4 6 1 2 5 3\n5\n5 3 1 2 4"] | null | PASSED | 900 | standard input | 2 seconds | The first line contains a single integer $$$T$$$ ($$$1 \le T \le 200$$$) — the number of test cases. Next $$$2T$$$ lines contain test cases — two lines per test case. The first line of each test case contains the single integer $$$n$$$ ($$$3 \le n \le 1000$$$) — the length of the permutation $$$p$$$. The second line co... | ["YES\n2 3 4\nYES\n3 5 6\nNO"] | #include <stdio.h>
int main()
{
int t;
scanf("%d",&t);
for(int i=0;i<t;i++)
{
int A,b,c,n,v,pa,pb,pc;
pa=0;pb=0;pc=0;
b=0;v=0;
scanf("%d",&n);
int a[n];
for(int j=0;j<n;j++)
{
scanf("%d",&a[j]);
}
A=a[0];pa=1;
f... | |
You are given a permutation $$$p_1, p_2, \dots, p_n$$$. Recall that sequence of $$$n$$$ integers is called a permutation if it contains all integers from $$$1$$$ to $$$n$$$ exactly once.Find three indices $$$i$$$, $$$j$$$ and $$$k$$$ such that: $$$1 \le i < j < k \le n$$$; $$$p_i < p_j$$$ and $$$p_j > p_... | For each test case: if there are such indices $$$i$$$, $$$j$$$ and $$$k$$$, print YES (case insensitive) and the indices themselves; if there are no such indices, print NO (case insensitive). If there are multiple valid triples of indices, print any of them. | C | dd55e29ac9756325530ad2f4479d9f6d | 53c3c8902abff7652ea181b21e160419 | GNU C11 | standard output | 256 megabytes | train_002.jsonl | [
"data structures",
"brute force"
] | 1594565100 | ["3\n4\n2 1 4 3\n6\n4 6 1 2 5 3\n5\n5 3 1 2 4"] | null | PASSED | 900 | standard input | 2 seconds | The first line contains a single integer $$$T$$$ ($$$1 \le T \le 200$$$) — the number of test cases. Next $$$2T$$$ lines contain test cases — two lines per test case. The first line of each test case contains the single integer $$$n$$$ ($$$3 \le n \le 1000$$$) — the length of the permutation $$$p$$$. The second line co... | ["YES\n2 3 4\nYES\n3 5 6\nNO"] | #include <stdio.h>
int main()
{
long long int t;
scanf("%lld",&t);
while(t--)
{
long long int n,j,a[10000],count=1;
scanf("%lld",&n);
for(j=1;j<=n;j++) scanf("%lld",&a[j]);
for(j=2;j<=n-1;j++)
{
if((a[j]>a[j-1])&&(a[j]>a[j+1]))
{
printf("YES\n%lld %l... | |
You are given a permutation $$$p_1, p_2, \dots, p_n$$$. Recall that sequence of $$$n$$$ integers is called a permutation if it contains all integers from $$$1$$$ to $$$n$$$ exactly once.Find three indices $$$i$$$, $$$j$$$ and $$$k$$$ such that: $$$1 \le i < j < k \le n$$$; $$$p_i < p_j$$$ and $$$p_j > p_... | For each test case: if there are such indices $$$i$$$, $$$j$$$ and $$$k$$$, print YES (case insensitive) and the indices themselves; if there are no such indices, print NO (case insensitive). If there are multiple valid triples of indices, print any of them. | C | dd55e29ac9756325530ad2f4479d9f6d | 9f405e17a6caa325f4e851d804684e61 | GNU C11 | standard output | 256 megabytes | train_002.jsonl | [
"data structures",
"brute force"
] | 1594565100 | ["3\n4\n2 1 4 3\n6\n4 6 1 2 5 3\n5\n5 3 1 2 4"] | null | PASSED | 900 | standard input | 2 seconds | The first line contains a single integer $$$T$$$ ($$$1 \le T \le 200$$$) — the number of test cases. Next $$$2T$$$ lines contain test cases — two lines per test case. The first line of each test case contains the single integer $$$n$$$ ($$$3 \le n \le 1000$$$) — the length of the permutation $$$p$$$. The second line co... | ["YES\n2 3 4\nYES\n3 5 6\nNO"] | #include<stdio.h>
#include<string.h>
#include<math.h>
int main()
{
int d,k,a=0,b=0,w=0,i,j,t,n,arr[1005],p=0,q=0,r=0;
scanf("%d",&t);
while(t--)
{
scanf("%d",&n);
for(i=0;i<n;i++)
{
scanf("%d",&arr[i]);
if(i)
{
... | |
You are given a permutation $$$p_1, p_2, \dots, p_n$$$. Recall that sequence of $$$n$$$ integers is called a permutation if it contains all integers from $$$1$$$ to $$$n$$$ exactly once.Find three indices $$$i$$$, $$$j$$$ and $$$k$$$ such that: $$$1 \le i < j < k \le n$$$; $$$p_i < p_j$$$ and $$$p_j > p_... | For each test case: if there are such indices $$$i$$$, $$$j$$$ and $$$k$$$, print YES (case insensitive) and the indices themselves; if there are no such indices, print NO (case insensitive). If there are multiple valid triples of indices, print any of them. | C | dd55e29ac9756325530ad2f4479d9f6d | 4816752d720e7bd62f80cfe923bb477b | GNU C11 | standard output | 256 megabytes | train_002.jsonl | [
"data structures",
"brute force"
] | 1594565100 | ["3\n4\n2 1 4 3\n6\n4 6 1 2 5 3\n5\n5 3 1 2 4"] | null | PASSED | 900 | standard input | 2 seconds | The first line contains a single integer $$$T$$$ ($$$1 \le T \le 200$$$) — the number of test cases. Next $$$2T$$$ lines contain test cases — two lines per test case. The first line of each test case contains the single integer $$$n$$$ ($$$3 \le n \le 1000$$$) — the length of the permutation $$$p$$$. The second line co... | ["YES\n2 3 4\nYES\n3 5 6\nNO"] | #include <stdio.h>
int main()
{
int t, i, j, n, ar[2000], a, b, c, temp, k;
scanf("%d", &t);
for(i=0; i<t; i++){
temp = 0;
scanf("%d", &n);
for(j=0; j<n; j++){
scanf("%d", &ar[j]);
}
for(j=0; j<n-1; j++){
if(ar[j]<ar[j+1]){
a =... | |
You are given a permutation $$$p_1, p_2, \dots, p_n$$$. Recall that sequence of $$$n$$$ integers is called a permutation if it contains all integers from $$$1$$$ to $$$n$$$ exactly once.Find three indices $$$i$$$, $$$j$$$ and $$$k$$$ such that: $$$1 \le i < j < k \le n$$$; $$$p_i < p_j$$$ and $$$p_j > p_... | For each test case: if there are such indices $$$i$$$, $$$j$$$ and $$$k$$$, print YES (case insensitive) and the indices themselves; if there are no such indices, print NO (case insensitive). If there are multiple valid triples of indices, print any of them. | C | dd55e29ac9756325530ad2f4479d9f6d | 993d51f70b4b017a245160957d769026 | GNU C11 | standard output | 256 megabytes | train_002.jsonl | [
"data structures",
"brute force"
] | 1594565100 | ["3\n4\n2 1 4 3\n6\n4 6 1 2 5 3\n5\n5 3 1 2 4"] | null | PASSED | 900 | standard input | 2 seconds | The first line contains a single integer $$$T$$$ ($$$1 \le T \le 200$$$) — the number of test cases. Next $$$2T$$$ lines contain test cases — two lines per test case. The first line of each test case contains the single integer $$$n$$$ ($$$3 \le n \le 1000$$$) — the length of the permutation $$$p$$$. The second line co... | ["YES\n2 3 4\nYES\n3 5 6\nNO"] | #include<stdio.h>
int main(){
int i,j,k,n,t,arr[1001],p,h;
int ip,ik;
scanf("%d",&t);
for(ip=1;ip<=t;ip++){
int d=0,e=0;
scanf("%d",&n);
for(ik=0;ik<n;ik++){
scanf("%d",&arr[ik]);
}
for(j=1;j<n-1;j++){
for(i=0;i<j;i++){
if(arr[i]<arr[j]){
p=i;
d++;
break;
}
}
if(d!=0){
for(k=n-1;k... | |
You are given a permutation $$$p_1, p_2, \dots, p_n$$$. Recall that sequence of $$$n$$$ integers is called a permutation if it contains all integers from $$$1$$$ to $$$n$$$ exactly once.Find three indices $$$i$$$, $$$j$$$ and $$$k$$$ such that: $$$1 \le i < j < k \le n$$$; $$$p_i < p_j$$$ and $$$p_j > p_... | For each test case: if there are such indices $$$i$$$, $$$j$$$ and $$$k$$$, print YES (case insensitive) and the indices themselves; if there are no such indices, print NO (case insensitive). If there are multiple valid triples of indices, print any of them. | C | dd55e29ac9756325530ad2f4479d9f6d | 80d061e7c24d90c0e2d3db504efafd31 | GNU C11 | standard output | 256 megabytes | train_002.jsonl | [
"data structures",
"brute force"
] | 1594565100 | ["3\n4\n2 1 4 3\n6\n4 6 1 2 5 3\n5\n5 3 1 2 4"] | null | PASSED | 900 | standard input | 2 seconds | The first line contains a single integer $$$T$$$ ($$$1 \le T \le 200$$$) — the number of test cases. Next $$$2T$$$ lines contain test cases — two lines per test case. The first line of each test case contains the single integer $$$n$$$ ($$$3 \le n \le 1000$$$) — the length of the permutation $$$p$$$. The second line co... | ["YES\n2 3 4\nYES\n3 5 6\nNO"] | #include<stdio.h>
#include<stdlib.h>
int N,n;
int a[1010];
int* solve(){
static int b[3];
int left;
b[0]=-1;
for (int i=1;i<n-1;i++){
left=-1;
for (int j=0;j<i;j++){
//printf("%d %d %d\n",i,a[i],a[j]);
if ((a[j]-a[i])<0){left=j+1;break;}
}
if (left==-1)continue;
for (int j=i+1;j<n;j++){
... | |
You are given a permutation $$$p_1, p_2, \dots, p_n$$$. Recall that sequence of $$$n$$$ integers is called a permutation if it contains all integers from $$$1$$$ to $$$n$$$ exactly once.Find three indices $$$i$$$, $$$j$$$ and $$$k$$$ such that: $$$1 \le i < j < k \le n$$$; $$$p_i < p_j$$$ and $$$p_j > p_... | For each test case: if there are such indices $$$i$$$, $$$j$$$ and $$$k$$$, print YES (case insensitive) and the indices themselves; if there are no such indices, print NO (case insensitive). If there are multiple valid triples of indices, print any of them. | C | dd55e29ac9756325530ad2f4479d9f6d | edad37af4c9ec023a13d12f5fa36896f | GNU C11 | standard output | 256 megabytes | train_002.jsonl | [
"data structures",
"brute force"
] | 1594565100 | ["3\n4\n2 1 4 3\n6\n4 6 1 2 5 3\n5\n5 3 1 2 4"] | null | PASSED | 900 | standard input | 2 seconds | The first line contains a single integer $$$T$$$ ($$$1 \le T \le 200$$$) — the number of test cases. Next $$$2T$$$ lines contain test cases — two lines per test case. The first line of each test case contains the single integer $$$n$$$ ($$$3 \le n \le 1000$$$) — the length of the permutation $$$p$$$. The second line co... | ["YES\n2 3 4\nYES\n3 5 6\nNO"] | #include<stdio.h>
int main()
{
int T,p,i,j,k,l,m,count=0;
scanf("%d",&T);
int ary[1000];
while(T--){
scanf("%d",&p);
for(m=0;m<p;m++){
scanf("%d",&ary[m]);
}
for(l=0;l<p-2;l++){
i=l+1;
j=l+2;
k=l+3;
if(i>=1&&i<... | |
You are given a permutation $$$p_1, p_2, \dots, p_n$$$. Recall that sequence of $$$n$$$ integers is called a permutation if it contains all integers from $$$1$$$ to $$$n$$$ exactly once.Find three indices $$$i$$$, $$$j$$$ and $$$k$$$ such that: $$$1 \le i < j < k \le n$$$; $$$p_i < p_j$$$ and $$$p_j > p_... | For each test case: if there are such indices $$$i$$$, $$$j$$$ and $$$k$$$, print YES (case insensitive) and the indices themselves; if there are no such indices, print NO (case insensitive). If there are multiple valid triples of indices, print any of them. | C | dd55e29ac9756325530ad2f4479d9f6d | 7d79d37c9803f9964c34bb98a9687162 | GNU C11 | standard output | 256 megabytes | train_002.jsonl | [
"data structures",
"brute force"
] | 1594565100 | ["3\n4\n2 1 4 3\n6\n4 6 1 2 5 3\n5\n5 3 1 2 4"] | null | PASSED | 900 | standard input | 2 seconds | The first line contains a single integer $$$T$$$ ($$$1 \le T \le 200$$$) — the number of test cases. Next $$$2T$$$ lines contain test cases — two lines per test case. The first line of each test case contains the single integer $$$n$$$ ($$$3 \le n \le 1000$$$) — the length of the permutation $$$p$$$. The second line co... | ["YES\n2 3 4\nYES\n3 5 6\nNO"] | #include <stdio.h>
int main()
{
int t,n,p[1005];
scanf("%d",&t);
while(t--)
{
scanf("%d",&n);
int i,j,k,flag1=0,flag2=0;
for(int i=0;i<n;i++)
scanf("%d",&p[i]);
for(i=1;i<n-1;i++)
{
for(j=i-1;j>=0;j--)
{
if(p[j]... | |
You are given a permutation $$$p_1, p_2, \dots, p_n$$$. Recall that sequence of $$$n$$$ integers is called a permutation if it contains all integers from $$$1$$$ to $$$n$$$ exactly once.Find three indices $$$i$$$, $$$j$$$ and $$$k$$$ such that: $$$1 \le i < j < k \le n$$$; $$$p_i < p_j$$$ and $$$p_j > p_... | For each test case: if there are such indices $$$i$$$, $$$j$$$ and $$$k$$$, print YES (case insensitive) and the indices themselves; if there are no such indices, print NO (case insensitive). If there are multiple valid triples of indices, print any of them. | C | dd55e29ac9756325530ad2f4479d9f6d | 65882ce8e220547aa5fe85d38e52ae55 | GNU C11 | standard output | 256 megabytes | train_002.jsonl | [
"data structures",
"brute force"
] | 1594565100 | ["3\n4\n2 1 4 3\n6\n4 6 1 2 5 3\n5\n5 3 1 2 4"] | null | PASSED | 900 | standard input | 2 seconds | The first line contains a single integer $$$T$$$ ($$$1 \le T \le 200$$$) — the number of test cases. Next $$$2T$$$ lines contain test cases — two lines per test case. The first line of each test case contains the single integer $$$n$$$ ($$$3 \le n \le 1000$$$) — the length of the permutation $$$p$$$. The second line co... | ["YES\n2 3 4\nYES\n3 5 6\nNO"] | #include<stdio.h>
int main()
{
int t,m;
scanf("%d",&t);
m=t-1;
int arr[t][4];
while(t--)
{
arr[t][0]=0;
int n,l=0,p=0,q=0,f=0,g=0;
scanf("%d",&n);
int ar[n];
for(int i=0;i<n;i++)
scanf("%d",&ar[i]);
for(int i=1;i<n-1;i++)
{
f=0;
g=0;
for(int j=0;j<i;j... | |
You are given a permutation $$$p_1, p_2, \dots, p_n$$$. Recall that sequence of $$$n$$$ integers is called a permutation if it contains all integers from $$$1$$$ to $$$n$$$ exactly once.Find three indices $$$i$$$, $$$j$$$ and $$$k$$$ such that: $$$1 \le i < j < k \le n$$$; $$$p_i < p_j$$$ and $$$p_j > p_... | For each test case: if there are such indices $$$i$$$, $$$j$$$ and $$$k$$$, print YES (case insensitive) and the indices themselves; if there are no such indices, print NO (case insensitive). If there are multiple valid triples of indices, print any of them. | C | dd55e29ac9756325530ad2f4479d9f6d | 0acd8271a1c76ccb5685b5887350f848 | GNU C11 | standard output | 256 megabytes | train_002.jsonl | [
"data structures",
"brute force"
] | 1594565100 | ["3\n4\n2 1 4 3\n6\n4 6 1 2 5 3\n5\n5 3 1 2 4"] | null | PASSED | 900 | standard input | 2 seconds | The first line contains a single integer $$$T$$$ ($$$1 \le T \le 200$$$) — the number of test cases. Next $$$2T$$$ lines contain test cases — two lines per test case. The first line of each test case contains the single integer $$$n$$$ ($$$3 \le n \le 1000$$$) — the length of the permutation $$$p$$$. The second line co... | ["YES\n2 3 4\nYES\n3 5 6\nNO"] | #include <stdio.h>
#include <stdlib.h>
int main() {
int i,t,n,*p,flag;
scanf("%d",&t);
while(t--) {
flag = 0;
scanf("%d",&n);
p = (int*)calloc(n,sizeof(int));
for(i = 0; i < n; i++)
scanf("%d",&p[i]);
for(i = 0; i < n - 2; i++){
if(p[i] < p[i ... | |
You are given a permutation $$$p_1, p_2, \dots, p_n$$$. Recall that sequence of $$$n$$$ integers is called a permutation if it contains all integers from $$$1$$$ to $$$n$$$ exactly once.Find three indices $$$i$$$, $$$j$$$ and $$$k$$$ such that: $$$1 \le i < j < k \le n$$$; $$$p_i < p_j$$$ and $$$p_j > p_... | For each test case: if there are such indices $$$i$$$, $$$j$$$ and $$$k$$$, print YES (case insensitive) and the indices themselves; if there are no such indices, print NO (case insensitive). If there are multiple valid triples of indices, print any of them. | C | dd55e29ac9756325530ad2f4479d9f6d | 47f99f97df46d8269444844e465ee20e | GNU C11 | standard output | 256 megabytes | train_002.jsonl | [
"data structures",
"brute force"
] | 1594565100 | ["3\n4\n2 1 4 3\n6\n4 6 1 2 5 3\n5\n5 3 1 2 4"] | null | PASSED | 900 | standard input | 2 seconds | The first line contains a single integer $$$T$$$ ($$$1 \le T \le 200$$$) — the number of test cases. Next $$$2T$$$ lines contain test cases — two lines per test case. The first line of each test case contains the single integer $$$n$$$ ($$$3 \le n \le 1000$$$) — the length of the permutation $$$p$$$. The second line co... | ["YES\n2 3 4\nYES\n3 5 6\nNO"] | #include <stdio.h>
#include <stdlib.h>
#include <stdbool.h>
int main()
{
int cases;
scanf("%d", &cases);
for (int i = 1; i <= cases; i += 1) {
cycle();
}
return 0;
}
void cycle() {
int n;
scanf("%d", &n);
int items[n];
for (int i = 0; i < n; i += 1) {
scanf("%d", &... | |
You are given a permutation $$$p_1, p_2, \dots, p_n$$$. Recall that sequence of $$$n$$$ integers is called a permutation if it contains all integers from $$$1$$$ to $$$n$$$ exactly once.Find three indices $$$i$$$, $$$j$$$ and $$$k$$$ such that: $$$1 \le i < j < k \le n$$$; $$$p_i < p_j$$$ and $$$p_j > p_... | For each test case: if there are such indices $$$i$$$, $$$j$$$ and $$$k$$$, print YES (case insensitive) and the indices themselves; if there are no such indices, print NO (case insensitive). If there are multiple valid triples of indices, print any of them. | C | dd55e29ac9756325530ad2f4479d9f6d | 7c1b9bbad614aefc9068b0bea0289760 | GNU C11 | standard output | 256 megabytes | train_002.jsonl | [
"data structures",
"brute force"
] | 1594565100 | ["3\n4\n2 1 4 3\n6\n4 6 1 2 5 3\n5\n5 3 1 2 4"] | null | PASSED | 900 | standard input | 2 seconds | The first line contains a single integer $$$T$$$ ($$$1 \le T \le 200$$$) — the number of test cases. Next $$$2T$$$ lines contain test cases — two lines per test case. The first line of each test case contains the single integer $$$n$$$ ($$$3 \le n \le 1000$$$) — the length of the permutation $$$p$$$. The second line co... | ["YES\n2 3 4\nYES\n3 5 6\nNO"] | #include<stdio.h>
#include<string.h>
#include<math.h>
int main()
{
int d,k,a=0,b=0,w=0,i,j,t,n,arr[1005],p=0,q=0,r=0;
scanf("%d",&t);
while(t--)
{
scanf("%d",&n);
for(i=0;i<n;i++)
{
scanf("%d",&arr[i]);
if(i)
{
//printf("%d\n",... | |
You are given a permutation $$$p_1, p_2, \dots, p_n$$$. Recall that sequence of $$$n$$$ integers is called a permutation if it contains all integers from $$$1$$$ to $$$n$$$ exactly once.Find three indices $$$i$$$, $$$j$$$ and $$$k$$$ such that: $$$1 \le i < j < k \le n$$$; $$$p_i < p_j$$$ and $$$p_j > p_... | For each test case: if there are such indices $$$i$$$, $$$j$$$ and $$$k$$$, print YES (case insensitive) and the indices themselves; if there are no such indices, print NO (case insensitive). If there are multiple valid triples of indices, print any of them. | C | dd55e29ac9756325530ad2f4479d9f6d | 65c52e67a538498d80c705a0ecd53108 | GNU C11 | standard output | 256 megabytes | train_002.jsonl | [
"data structures",
"brute force"
] | 1594565100 | ["3\n4\n2 1 4 3\n6\n4 6 1 2 5 3\n5\n5 3 1 2 4"] | null | PASSED | 900 | standard input | 2 seconds | The first line contains a single integer $$$T$$$ ($$$1 \le T \le 200$$$) — the number of test cases. Next $$$2T$$$ lines contain test cases — two lines per test case. The first line of each test case contains the single integer $$$n$$$ ($$$3 \le n \le 1000$$$) — the length of the permutation $$$p$$$. The second line co... | ["YES\n2 3 4\nYES\n3 5 6\nNO"] | #include <stdio.h>
int main(){
int t, n, p[1001], s[1001], l, r, max, flag, i;
scanf("%d", &t);
while(t--){
scanf("%d", &n);
l = 1;
r = n;
max = n;
flag = 0;
for(i = 1; i <= n; i++){
scanf("%d", &p[i]);
s[p[i]] = i;
}
while(l < r && flag == 0){
//printf("%d %d %d", l, r, flag);
if(max ==... | |
You are given a permutation $$$p_1, p_2, \dots, p_n$$$. Recall that sequence of $$$n$$$ integers is called a permutation if it contains all integers from $$$1$$$ to $$$n$$$ exactly once.Find three indices $$$i$$$, $$$j$$$ and $$$k$$$ such that: $$$1 \le i < j < k \le n$$$; $$$p_i < p_j$$$ and $$$p_j > p_... | For each test case: if there are such indices $$$i$$$, $$$j$$$ and $$$k$$$, print YES (case insensitive) and the indices themselves; if there are no such indices, print NO (case insensitive). If there are multiple valid triples of indices, print any of them. | C | dd55e29ac9756325530ad2f4479d9f6d | d2c81a982d237d1dc81c7286f9eda067 | GNU C11 | standard output | 256 megabytes | train_002.jsonl | [
"data structures",
"brute force"
] | 1594565100 | ["3\n4\n2 1 4 3\n6\n4 6 1 2 5 3\n5\n5 3 1 2 4"] | null | PASSED | 900 | standard input | 2 seconds | The first line contains a single integer $$$T$$$ ($$$1 \le T \le 200$$$) — the number of test cases. Next $$$2T$$$ lines contain test cases — two lines per test case. The first line of each test case contains the single integer $$$n$$$ ($$$3 \le n \le 1000$$$) — the length of the permutation $$$p$$$. The second line co... | ["YES\n2 3 4\nYES\n3 5 6\nNO"] | #include <stdio.h>
int main(void)
{
int t;
scanf("%d",&t);
while(t--)
{
int n;
scanf("%d",&n);
int count;
int arr[n], check = 0;
for (count =0; count < n; count++)
scanf("%d",arr+count);
for (count =0; count < n-2; count++)
if (arr[count]<arr[count+1]&&arr[count+1]>arr[count+2])
{
printf("... | |
You are given a permutation $$$p_1, p_2, \dots, p_n$$$. Recall that sequence of $$$n$$$ integers is called a permutation if it contains all integers from $$$1$$$ to $$$n$$$ exactly once.Find three indices $$$i$$$, $$$j$$$ and $$$k$$$ such that: $$$1 \le i < j < k \le n$$$; $$$p_i < p_j$$$ and $$$p_j > p_... | For each test case: if there are such indices $$$i$$$, $$$j$$$ and $$$k$$$, print YES (case insensitive) and the indices themselves; if there are no such indices, print NO (case insensitive). If there are multiple valid triples of indices, print any of them. | C | dd55e29ac9756325530ad2f4479d9f6d | f4cf7720620e0fb8dc508f6a49393c4c | GNU C11 | standard output | 256 megabytes | train_002.jsonl | [
"data structures",
"brute force"
] | 1594565100 | ["3\n4\n2 1 4 3\n6\n4 6 1 2 5 3\n5\n5 3 1 2 4"] | null | PASSED | 900 | standard input | 2 seconds | The first line contains a single integer $$$T$$$ ($$$1 \le T \le 200$$$) — the number of test cases. Next $$$2T$$$ lines contain test cases — two lines per test case. The first line of each test case contains the single integer $$$n$$$ ($$$3 \le n \le 1000$$$) — the length of the permutation $$$p$$$. The second line co... | ["YES\n2 3 4\nYES\n3 5 6\nNO"] | #include <stdio.h>
int main()
{
int T = 0;
scanf("%d", &T);
int i;
int n = 0;
int j,p,q,r;
int temp1, temp2;
int count;
for(i=0; i<T; i++){
int x;
count = 0;
scanf("%d",&n);
int values[n];
int index[n];
scanf("%d",&values[count++]);
index[0] = 1;
scanf("%d",&temp1);
for(j=0; j<n-2; j++){
... | |
You are given a permutation $$$p_1, p_2, \dots, p_n$$$. Recall that sequence of $$$n$$$ integers is called a permutation if it contains all integers from $$$1$$$ to $$$n$$$ exactly once.Find three indices $$$i$$$, $$$j$$$ and $$$k$$$ such that: $$$1 \le i < j < k \le n$$$; $$$p_i < p_j$$$ and $$$p_j > p_... | For each test case: if there are such indices $$$i$$$, $$$j$$$ and $$$k$$$, print YES (case insensitive) and the indices themselves; if there are no such indices, print NO (case insensitive). If there are multiple valid triples of indices, print any of them. | C | dd55e29ac9756325530ad2f4479d9f6d | e0b4213e700f1d4dfbe3a331d8c371c7 | GNU C11 | standard output | 256 megabytes | train_002.jsonl | [
"data structures",
"brute force"
] | 1594565100 | ["3\n4\n2 1 4 3\n6\n4 6 1 2 5 3\n5\n5 3 1 2 4"] | null | PASSED | 900 | standard input | 2 seconds | The first line contains a single integer $$$T$$$ ($$$1 \le T \le 200$$$) — the number of test cases. Next $$$2T$$$ lines contain test cases — two lines per test case. The first line of each test case contains the single integer $$$n$$$ ($$$3 \le n \le 1000$$$) — the length of the permutation $$$p$$$. The second line co... | ["YES\n2 3 4\nYES\n3 5 6\nNO"] | #include<stdio.h>
int main()
{
int t;
scanf("%d",&t);
while(t--)
{
int n,i,k;
scanf("%d",&n);
int A[n];
for(i=0;i<n;i++)
{
scanf("%d",&A[i]);
}
for(i=1;i<n-1;i++)
{
if(A[i]>A[i-1]&&A[i]>A[i+1])
{
... | |
You are given a permutation $$$p_1, p_2, \dots, p_n$$$. Recall that sequence of $$$n$$$ integers is called a permutation if it contains all integers from $$$1$$$ to $$$n$$$ exactly once.Find three indices $$$i$$$, $$$j$$$ and $$$k$$$ such that: $$$1 \le i < j < k \le n$$$; $$$p_i < p_j$$$ and $$$p_j > p_... | For each test case: if there are such indices $$$i$$$, $$$j$$$ and $$$k$$$, print YES (case insensitive) and the indices themselves; if there are no such indices, print NO (case insensitive). If there are multiple valid triples of indices, print any of them. | C | dd55e29ac9756325530ad2f4479d9f6d | 9c0b09a13dd05a01b30136da74837818 | GNU C11 | standard output | 256 megabytes | train_002.jsonl | [
"data structures",
"brute force"
] | 1594565100 | ["3\n4\n2 1 4 3\n6\n4 6 1 2 5 3\n5\n5 3 1 2 4"] | null | PASSED | 900 | standard input | 2 seconds | The first line contains a single integer $$$T$$$ ($$$1 \le T \le 200$$$) — the number of test cases. Next $$$2T$$$ lines contain test cases — two lines per test case. The first line of each test case contains the single integer $$$n$$$ ($$$3 \le n \le 1000$$$) — the length of the permutation $$$p$$$. The second line co... | ["YES\n2 3 4\nYES\n3 5 6\nNO"] | #include<stdio.h>
#include<stdlib.h>
int main()
{
int t;
scanf("%d", &t);
while (t--)
{
int n, a[1000], f = 0, i;
scanf("%d", &n);
for (i = 0; i<n; i++)
{
scanf("%d", &a[i]);
}
for (i = 1; i<n - 1; i++)
{
if ((a[i] > a[i - 1]) && (a[i] > a[i + 1]))
{
printf("YES\n");
printf("%d %d ... | |
You are given a permutation $$$p_1, p_2, \dots, p_n$$$. Recall that sequence of $$$n$$$ integers is called a permutation if it contains all integers from $$$1$$$ to $$$n$$$ exactly once.Find three indices $$$i$$$, $$$j$$$ and $$$k$$$ such that: $$$1 \le i < j < k \le n$$$; $$$p_i < p_j$$$ and $$$p_j > p_... | For each test case: if there are such indices $$$i$$$, $$$j$$$ and $$$k$$$, print YES (case insensitive) and the indices themselves; if there are no such indices, print NO (case insensitive). If there are multiple valid triples of indices, print any of them. | C | dd55e29ac9756325530ad2f4479d9f6d | f547b04a57e5b73d6dd8f8e77ac27802 | GNU C11 | standard output | 256 megabytes | train_002.jsonl | [
"data structures",
"brute force"
] | 1594565100 | ["3\n4\n2 1 4 3\n6\n4 6 1 2 5 3\n5\n5 3 1 2 4"] | null | PASSED | 900 | standard input | 2 seconds | The first line contains a single integer $$$T$$$ ($$$1 \le T \le 200$$$) — the number of test cases. Next $$$2T$$$ lines contain test cases — two lines per test case. The first line of each test case contains the single integer $$$n$$$ ($$$3 \le n \le 1000$$$) — the length of the permutation $$$p$$$. The second line co... | ["YES\n2 3 4\nYES\n3 5 6\nNO"] | #include<stdio.h>
#include<malloc.h>
#include<math.h>
int main()
{
int size,flag=0,i,cases,j,k;
scanf("%d",&cases);
int *arr;
for(i=0;i<cases;i++)
{
flag=0;
scanf("%d",&size);
arr=(int*)malloc(size*sizeof(int));
for(j=0;j<size;j++)
scanf("%d",&arr[j]);
... | |
You are given a permutation $$$p_1, p_2, \dots, p_n$$$. Recall that sequence of $$$n$$$ integers is called a permutation if it contains all integers from $$$1$$$ to $$$n$$$ exactly once.Find three indices $$$i$$$, $$$j$$$ and $$$k$$$ such that: $$$1 \le i < j < k \le n$$$; $$$p_i < p_j$$$ and $$$p_j > p_... | For each test case: if there are such indices $$$i$$$, $$$j$$$ and $$$k$$$, print YES (case insensitive) and the indices themselves; if there are no such indices, print NO (case insensitive). If there are multiple valid triples of indices, print any of them. | C | dd55e29ac9756325530ad2f4479d9f6d | c832967c7edf8020ebb91c8deaa5a7cb | GNU C11 | standard output | 256 megabytes | train_002.jsonl | [
"data structures",
"brute force"
] | 1594565100 | ["3\n4\n2 1 4 3\n6\n4 6 1 2 5 3\n5\n5 3 1 2 4"] | null | PASSED | 900 | standard input | 2 seconds | The first line contains a single integer $$$T$$$ ($$$1 \le T \le 200$$$) — the number of test cases. Next $$$2T$$$ lines contain test cases — two lines per test case. The first line of each test case contains the single integer $$$n$$$ ($$$3 \le n \le 1000$$$) — the length of the permutation $$$p$$$. The second line co... | ["YES\n2 3 4\nYES\n3 5 6\nNO"] | #include<stdio.h>
int main(void)
{
int i,j,k,n,t,x,y,z,array[1000];
scanf("%d",&t);
for(i=0;i<t;i++)
{
int freq[1000]={0};
scanf("%d",&n);
for(j=0;j<n;j++)
scanf("%d",&array[j]);
for(j=1;j<n-1;j++)
{
x=-1;
y=-1;
z=-1... | |
You are given a permutation $$$p_1, p_2, \dots, p_n$$$. Recall that sequence of $$$n$$$ integers is called a permutation if it contains all integers from $$$1$$$ to $$$n$$$ exactly once.Find three indices $$$i$$$, $$$j$$$ and $$$k$$$ such that: $$$1 \le i < j < k \le n$$$; $$$p_i < p_j$$$ and $$$p_j > p_... | For each test case: if there are such indices $$$i$$$, $$$j$$$ and $$$k$$$, print YES (case insensitive) and the indices themselves; if there are no such indices, print NO (case insensitive). If there are multiple valid triples of indices, print any of them. | C | dd55e29ac9756325530ad2f4479d9f6d | eff2333cf7b738955725576c31865b0c | GNU C11 | standard output | 256 megabytes | train_002.jsonl | [
"data structures",
"brute force"
] | 1594565100 | ["3\n4\n2 1 4 3\n6\n4 6 1 2 5 3\n5\n5 3 1 2 4"] | null | PASSED | 900 | standard input | 2 seconds | The first line contains a single integer $$$T$$$ ($$$1 \le T \le 200$$$) — the number of test cases. Next $$$2T$$$ lines contain test cases — two lines per test case. The first line of each test case contains the single integer $$$n$$$ ($$$3 \le n \le 1000$$$) — the length of the permutation $$$p$$$. The second line co... | ["YES\n2 3 4\nYES\n3 5 6\nNO"] | int main()
{
int t;
scanf("%d",&t);
while(t--)
{
int n,i,j,k;
scanf("%d",&n);
int a[n];
for(i=0; i<n; i++)
scanf("%d",&a[i]);
for(i=1; i<n-1; i++)
{
if(i<=n/2)
{
j= check_left(a,i);
//pr... | |
The heat during the last few days has been really intense. Scientists from all over the Berland study how the temperatures and weather change, and they claim that this summer is abnormally hot. But any scientific claim sounds a lot more reasonable if there are some numbers involved, so they have decided to actually cal... | Print one real number — the heat intensity value, i. e., the maximum of average temperatures over all segments of not less than $$$k$$$ consecutive days. Your answer will be considered correct if the following condition holds: $$$|res - res_0| < 10^{-6}$$$, where $$$res$$$ is your answer, and $$$res_0$$$ is the answ... | C | 7bdb68ab0752f8df94b4d5c7df759dfb | 18dc8540a25b7993a9105e115e0e71d4 | GNU C | standard output | 256 megabytes | train_002.jsonl | [
"implementation",
"brute force",
"math"
] | 1530628500 | ["4 3\n3 4 1 2"] | null | PASSED | 1,300 | standard input | 4 seconds | The first line contains two integers $$$n$$$ and $$$k$$$ ($$$1 \le k \le n \le 5000$$$) — the number of days in the given period, and the minimum number of days in a segment we consider when calculating heat intensity value, respectively. The second line contains $$$n$$$ integers $$$a_1$$$, $$$a_2$$$, ..., $$$a_n$$$ ($... | ["2.666666666666667"] | #include <stdio.h>
#include <stdlib.h>
int main(void)
{
int n, k, x;
int max = 0, maxn = 1;
scanf("%d %d", &n, &k);
int s[n + 1];
s[0] = 0;
for (int i = 1; i <= n; i++){
scanf("%d", &x);
s[i] = s[i - 1] + x;
}
/*for (int i = 0; i <= n; i++){
printf("%d ", s[i]... | |
The heat during the last few days has been really intense. Scientists from all over the Berland study how the temperatures and weather change, and they claim that this summer is abnormally hot. But any scientific claim sounds a lot more reasonable if there are some numbers involved, so they have decided to actually cal... | Print one real number — the heat intensity value, i. e., the maximum of average temperatures over all segments of not less than $$$k$$$ consecutive days. Your answer will be considered correct if the following condition holds: $$$|res - res_0| < 10^{-6}$$$, where $$$res$$$ is your answer, and $$$res_0$$$ is the answ... | C | 7bdb68ab0752f8df94b4d5c7df759dfb | 5de9b7f230518b93173ae2e4713f740c | GNU C | standard output | 256 megabytes | train_002.jsonl | [
"implementation",
"brute force",
"math"
] | 1530628500 | ["4 3\n3 4 1 2"] | null | PASSED | 1,300 | standard input | 4 seconds | The first line contains two integers $$$n$$$ and $$$k$$$ ($$$1 \le k \le n \le 5000$$$) — the number of days in the given period, and the minimum number of days in a segment we consider when calculating heat intensity value, respectively. The second line contains $$$n$$$ integers $$$a_1$$$, $$$a_2$$$, ..., $$$a_n$$$ ($... | ["2.666666666666667"] | #include <stdio.h>
int main(void)
{
int n,k,num[5001],cum[5001]={0};
double max=0, con[5001],temp;
int i,j;
scanf("%d%d%d",&n,&k,&num[0]);
cum[0]=num[0];
for(i=1;i<n;++i){
scanf("%d",&num[i]);
cum[i] = cum[i-1]+num[i];
}
cum[-1]=0;
for(i=0;i<n;++i){
for(j=i+k-1;j<n;++j){
temp = ((cum[j]-cum[i-1])*1.0... | |
The heat during the last few days has been really intense. Scientists from all over the Berland study how the temperatures and weather change, and they claim that this summer is abnormally hot. But any scientific claim sounds a lot more reasonable if there are some numbers involved, so they have decided to actually cal... | Print one real number — the heat intensity value, i. e., the maximum of average temperatures over all segments of not less than $$$k$$$ consecutive days. Your answer will be considered correct if the following condition holds: $$$|res - res_0| < 10^{-6}$$$, where $$$res$$$ is your answer, and $$$res_0$$$ is the answ... | C | 7bdb68ab0752f8df94b4d5c7df759dfb | 3a6ac8e00b92146c8d3f5aa7bb627004 | GNU C | standard output | 256 megabytes | train_002.jsonl | [
"implementation",
"brute force",
"math"
] | 1530628500 | ["4 3\n3 4 1 2"] | null | PASSED | 1,300 | standard input | 4 seconds | The first line contains two integers $$$n$$$ and $$$k$$$ ($$$1 \le k \le n \le 5000$$$) — the number of days in the given period, and the minimum number of days in a segment we consider when calculating heat intensity value, respectively. The second line contains $$$n$$$ integers $$$a_1$$$, $$$a_2$$$, ..., $$$a_n$$$ ($... | ["2.666666666666667"] | #include<stdio.h>
int a[5007],n,k;
int x[5007];
void run(){
int i,j;
double l,r;
while(scanf("%d%d",&n,&k)!=EOF){
for(i=0;i<n;i++){
scanf("%d",&a[i]);
}
for(i=0;i<n;i++){
x[i]=0;
}
x[0]=a[0];
for(i=1;i<n;i++){
x[i]=x[i-1]+a[i];
}
r=0;
for(i=0;i<n;i++){
for(j=i;j<n;j++){
if(j-i+1<k){... | |
The heat during the last few days has been really intense. Scientists from all over the Berland study how the temperatures and weather change, and they claim that this summer is abnormally hot. But any scientific claim sounds a lot more reasonable if there are some numbers involved, so they have decided to actually cal... | Print one real number — the heat intensity value, i. e., the maximum of average temperatures over all segments of not less than $$$k$$$ consecutive days. Your answer will be considered correct if the following condition holds: $$$|res - res_0| < 10^{-6}$$$, where $$$res$$$ is your answer, and $$$res_0$$$ is the answ... | C | 7bdb68ab0752f8df94b4d5c7df759dfb | 90c039c754e9079d5345bcc1415b6b42 | GNU C | standard output | 256 megabytes | train_002.jsonl | [
"implementation",
"brute force",
"math"
] | 1530628500 | ["4 3\n3 4 1 2"] | null | PASSED | 1,300 | standard input | 4 seconds | The first line contains two integers $$$n$$$ and $$$k$$$ ($$$1 \le k \le n \le 5000$$$) — the number of days in the given period, and the minimum number of days in a segment we consider when calculating heat intensity value, respectively. The second line contains $$$n$$$ integers $$$a_1$$$, $$$a_2$$$, ..., $$$a_n$$$ ($... | ["2.666666666666667"] | #include<stdio.h>
int a[5007],n,k;
int x[5007];
void run(){
int i,j;
double l,r;
while(scanf("%d%d",&n,&k)!=EOF){
for(i=0;i<n;i++){
scanf("%d",&a[i]);
}
x[0]=a[0];
for(i=1;i<n;i++){
x[i]=x[i-1]+a[i];
}
r=0;
for(i=0;i<n;i++){
for(j=i;j<n;j++){
if(j-i+1<k){
continue;
}
l=(double... | |
The heat during the last few days has been really intense. Scientists from all over the Berland study how the temperatures and weather change, and they claim that this summer is abnormally hot. But any scientific claim sounds a lot more reasonable if there are some numbers involved, so they have decided to actually cal... | Print one real number — the heat intensity value, i. e., the maximum of average temperatures over all segments of not less than $$$k$$$ consecutive days. Your answer will be considered correct if the following condition holds: $$$|res - res_0| < 10^{-6}$$$, where $$$res$$$ is your answer, and $$$res_0$$$ is the answ... | C | 7bdb68ab0752f8df94b4d5c7df759dfb | 1947f6478e60865c9c3f79f1db7bd6d2 | GNU C | standard output | 256 megabytes | train_002.jsonl | [
"implementation",
"brute force",
"math"
] | 1530628500 | ["4 3\n3 4 1 2"] | null | PASSED | 1,300 | standard input | 4 seconds | The first line contains two integers $$$n$$$ and $$$k$$$ ($$$1 \le k \le n \le 5000$$$) — the number of days in the given period, and the minimum number of days in a segment we consider when calculating heat intensity value, respectively. The second line contains $$$n$$$ integers $$$a_1$$$, $$$a_2$$$, ..., $$$a_n$$$ ($... | ["2.666666666666667"] | #include<stdio.h>
int main()
{
int n,k,i,j;
scanf("%d%d",&n,&k);
int a[n];
for(i=0;i<n;i++)
scanf("%d",&a[i]);
int p1=0,p2=k;
float max=0.0,avg,sum=0.0;
while(p1<=n-k){
p2=p1+k-1;
sum=0.0;
for(j=p1;j<=p2;j++){
sum+=a[j];
... | |
The heat during the last few days has been really intense. Scientists from all over the Berland study how the temperatures and weather change, and they claim that this summer is abnormally hot. But any scientific claim sounds a lot more reasonable if there are some numbers involved, so they have decided to actually cal... | Print one real number — the heat intensity value, i. e., the maximum of average temperatures over all segments of not less than $$$k$$$ consecutive days. Your answer will be considered correct if the following condition holds: $$$|res - res_0| < 10^{-6}$$$, where $$$res$$$ is your answer, and $$$res_0$$$ is the answ... | C | 7bdb68ab0752f8df94b4d5c7df759dfb | 9648482a4aacc24369e051fcd2e41107 | GNU C | standard output | 256 megabytes | train_002.jsonl | [
"implementation",
"brute force",
"math"
] | 1530628500 | ["4 3\n3 4 1 2"] | null | PASSED | 1,300 | standard input | 4 seconds | The first line contains two integers $$$n$$$ and $$$k$$$ ($$$1 \le k \le n \le 5000$$$) — the number of days in the given period, and the minimum number of days in a segment we consider when calculating heat intensity value, respectively. The second line contains $$$n$$$ integers $$$a_1$$$, $$$a_2$$$, ..., $$$a_n$$$ ($... | ["2.666666666666667"] | #define _USE_MATH_DEFINES
#include <stdio.h>
#include <math.h>
#include <stdlib.h>
#include <string.h>
#include <ctype.h>
#include <stdbool.h>
#include <float.h>
#include <limits.h>
#include <malloc.h>
#include <memory.h>
#include <complex.h>
#include <errno.h>
#include <time.h>
#define Max(X,Y) ((X)>(Y) ? (X) : (Y))
#... | |
The heat during the last few days has been really intense. Scientists from all over the Berland study how the temperatures and weather change, and they claim that this summer is abnormally hot. But any scientific claim sounds a lot more reasonable if there are some numbers involved, so they have decided to actually cal... | Print one real number — the heat intensity value, i. e., the maximum of average temperatures over all segments of not less than $$$k$$$ consecutive days. Your answer will be considered correct if the following condition holds: $$$|res - res_0| < 10^{-6}$$$, where $$$res$$$ is your answer, and $$$res_0$$$ is the answ... | C | 7bdb68ab0752f8df94b4d5c7df759dfb | b8daa7c57a7cd4684c1793f9248ff165 | GNU C | standard output | 256 megabytes | train_002.jsonl | [
"implementation",
"brute force",
"math"
] | 1530628500 | ["4 3\n3 4 1 2"] | null | PASSED | 1,300 | standard input | 4 seconds | The first line contains two integers $$$n$$$ and $$$k$$$ ($$$1 \le k \le n \le 5000$$$) — the number of days in the given period, and the minimum number of days in a segment we consider when calculating heat intensity value, respectively. The second line contains $$$n$$$ integers $$$a_1$$$, $$$a_2$$$, ..., $$$a_n$$$ ($... | ["2.666666666666667"] | #include<stdio.h>
#include<string.h>
#define sc(x) {register char c7=getchar(),v7=1;for(x=0;c7<48||c7>57;c7=getchar())if(c7==45)v7=-1;for(;c7>=48&&c7<=57;x=(x<<1)+(x<<3)+c7-48,c7=getchar());x*=v7;}
int a[5678], _s[5678], *s = _s+1;
int main()
{
int n, k, now, i, j, ub, up, cnt;
double avr, sum;
sc(n)sc(k)
for(i=0; ... | |
The heat during the last few days has been really intense. Scientists from all over the Berland study how the temperatures and weather change, and they claim that this summer is abnormally hot. But any scientific claim sounds a lot more reasonable if there are some numbers involved, so they have decided to actually cal... | Print one real number — the heat intensity value, i. e., the maximum of average temperatures over all segments of not less than $$$k$$$ consecutive days. Your answer will be considered correct if the following condition holds: $$$|res - res_0| < 10^{-6}$$$, where $$$res$$$ is your answer, and $$$res_0$$$ is the answ... | C | 7bdb68ab0752f8df94b4d5c7df759dfb | 72f8759d99049bc697f2ac24ff6598ef | GNU C | standard output | 256 megabytes | train_002.jsonl | [
"implementation",
"brute force",
"math"
] | 1530628500 | ["4 3\n3 4 1 2"] | null | PASSED | 1,300 | standard input | 4 seconds | The first line contains two integers $$$n$$$ and $$$k$$$ ($$$1 \le k \le n \le 5000$$$) — the number of days in the given period, and the minimum number of days in a segment we consider when calculating heat intensity value, respectively. The second line contains $$$n$$$ integers $$$a_1$$$, $$$a_2$$$, ..., $$$a_n$$$ ($... | ["2.666666666666667"] | #include <stdio.h>
#include <stdlib.h>
double sum[10000];
int main()
{
double n, k, i, j, m;
scanf("%lf%lf", &n, &k);
n++;
m=-100;
for(i=1; i<n; i++)
{
scanf("%lf", &sum[(int)i]);
sum[(int)i]+=sum[(int)i-1];
}
for(i=k; i<n; i++)
{
for(j=i; j<n; j++)
... | |
The heat during the last few days has been really intense. Scientists from all over the Berland study how the temperatures and weather change, and they claim that this summer is abnormally hot. But any scientific claim sounds a lot more reasonable if there are some numbers involved, so they have decided to actually cal... | Print one real number — the heat intensity value, i. e., the maximum of average temperatures over all segments of not less than $$$k$$$ consecutive days. Your answer will be considered correct if the following condition holds: $$$|res - res_0| < 10^{-6}$$$, where $$$res$$$ is your answer, and $$$res_0$$$ is the answ... | C | 7bdb68ab0752f8df94b4d5c7df759dfb | 724131238bd59bd4536b5dd9b62fc05c | GNU C | standard output | 256 megabytes | train_002.jsonl | [
"implementation",
"brute force",
"math"
] | 1530628500 | ["4 3\n3 4 1 2"] | null | PASSED | 1,300 | standard input | 4 seconds | The first line contains two integers $$$n$$$ and $$$k$$$ ($$$1 \le k \le n \le 5000$$$) — the number of days in the given period, and the minimum number of days in a segment we consider when calculating heat intensity value, respectively. The second line contains $$$n$$$ integers $$$a_1$$$, $$$a_2$$$, ..., $$$a_n$$$ ($... | ["2.666666666666667"] | #include<stdio.h>
#include<stdlib.h>
int main()
{
int n,k,i,j,l;
scanf("%d %d",&n,&k);
int *a=(int*)malloc(sizeof(int)*n);
for(i=0;i<n;i++)
scanf("%d",&a[i]);
double max=0;
for(i=k;i<=n;i++)
{
double sum=0;
for(j=0;j<n-i+1;j++)
{
if(j==0)
{
for(l=0;l<i;l++)
sum+=a[l];
}
els... | |
The heat during the last few days has been really intense. Scientists from all over the Berland study how the temperatures and weather change, and they claim that this summer is abnormally hot. But any scientific claim sounds a lot more reasonable if there are some numbers involved, so they have decided to actually cal... | Print one real number — the heat intensity value, i. e., the maximum of average temperatures over all segments of not less than $$$k$$$ consecutive days. Your answer will be considered correct if the following condition holds: $$$|res - res_0| < 10^{-6}$$$, where $$$res$$$ is your answer, and $$$res_0$$$ is the answ... | C | 7bdb68ab0752f8df94b4d5c7df759dfb | da662a6b843a0a3e125bdf50994a8b4c | GNU C | standard output | 256 megabytes | train_002.jsonl | [
"implementation",
"brute force",
"math"
] | 1530628500 | ["4 3\n3 4 1 2"] | null | PASSED | 1,300 | standard input | 4 seconds | The first line contains two integers $$$n$$$ and $$$k$$$ ($$$1 \le k \le n \le 5000$$$) — the number of days in the given period, and the minimum number of days in a segment we consider when calculating heat intensity value, respectively. The second line contains $$$n$$$ integers $$$a_1$$$, $$$a_2$$$, ..., $$$a_n$$$ ($... | ["2.666666666666667"] | #include<stdio.h>
int main()
{
double n, k;
double num[5000]={0,}, sum[5000]={0,};
scanf("%lf %lf", &n, &k);
for(int i=0; i<n; i++) scanf("%lf", &num[i]);
for(int i=k; i<=n; i++){
int ssum=0;
for(int j=0; j<i; j++){
ssum+=num[j];
}
sum[i]=ssum;
for(int j=0; j<n-i; j++){
ssum=ssum-num[j]+num[j+i];
... | |
The heat during the last few days has been really intense. Scientists from all over the Berland study how the temperatures and weather change, and they claim that this summer is abnormally hot. But any scientific claim sounds a lot more reasonable if there are some numbers involved, so they have decided to actually cal... | Print one real number — the heat intensity value, i. e., the maximum of average temperatures over all segments of not less than $$$k$$$ consecutive days. Your answer will be considered correct if the following condition holds: $$$|res - res_0| < 10^{-6}$$$, where $$$res$$$ is your answer, and $$$res_0$$$ is the answ... | C | 7bdb68ab0752f8df94b4d5c7df759dfb | f353971d302da90ef9c0f502b4d3879d | GNU C | standard output | 256 megabytes | train_002.jsonl | [
"implementation",
"brute force",
"math"
] | 1530628500 | ["4 3\n3 4 1 2"] | null | PASSED | 1,300 | standard input | 4 seconds | The first line contains two integers $$$n$$$ and $$$k$$$ ($$$1 \le k \le n \le 5000$$$) — the number of days in the given period, and the minimum number of days in a segment we consider when calculating heat intensity value, respectively. The second line contains $$$n$$$ integers $$$a_1$$$, $$$a_2$$$, ..., $$$a_n$$$ ($... | ["2.666666666666667"] | #include <stdio.h>
int main(){
int i, k, n, temp[5000], sum[5001], c, dlina,nachalo ;
float max, z;
scanf("%d%d", &n, &k);
for(i=0; i < n; ++i){
scanf("%d", &temp[i]);
}
c = 0;
for(i=0; i < n; ++i){
c += temp[i];
sum[i+1] = c;
}
sum[0]=0;
max = 0;
for(dlina = n; dlina >= k; dlina--){
for( na... | |
The heat during the last few days has been really intense. Scientists from all over the Berland study how the temperatures and weather change, and they claim that this summer is abnormally hot. But any scientific claim sounds a lot more reasonable if there are some numbers involved, so they have decided to actually cal... | Print one real number — the heat intensity value, i. e., the maximum of average temperatures over all segments of not less than $$$k$$$ consecutive days. Your answer will be considered correct if the following condition holds: $$$|res - res_0| < 10^{-6}$$$, where $$$res$$$ is your answer, and $$$res_0$$$ is the answ... | C | 7bdb68ab0752f8df94b4d5c7df759dfb | 9e59f4ee0c26e9ff22d07c5fba626c63 | GNU C | standard output | 256 megabytes | train_002.jsonl | [
"implementation",
"brute force",
"math"
] | 1530628500 | ["4 3\n3 4 1 2"] | null | PASSED | 1,300 | standard input | 4 seconds | The first line contains two integers $$$n$$$ and $$$k$$$ ($$$1 \le k \le n \le 5000$$$) — the number of days in the given period, and the minimum number of days in a segment we consider when calculating heat intensity value, respectively. The second line contains $$$n$$$ integers $$$a_1$$$, $$$a_2$$$, ..., $$$a_n$$$ ($... | ["2.666666666666667"] | #include <stdio.h>
int main()
{
int i, j, l, n, k;
float av, max=0, sum;
scanf("%d %d", &n, &k);
int arr[n];
for(i=0; i<n; i++)
scanf("%d", &arr[i]);
for(i=0; i<n; i++)
{
sum=0;
av=0;
for(j=i; j<n; j++)
{
sum+=arr[j];
if(j-i>=k-1)
av=sum/(j-i+1);
if(av>max)
max=av;
}
}
printf("%0.8... | |
The heat during the last few days has been really intense. Scientists from all over the Berland study how the temperatures and weather change, and they claim that this summer is abnormally hot. But any scientific claim sounds a lot more reasonable if there are some numbers involved, so they have decided to actually cal... | Print one real number — the heat intensity value, i. e., the maximum of average temperatures over all segments of not less than $$$k$$$ consecutive days. Your answer will be considered correct if the following condition holds: $$$|res - res_0| < 10^{-6}$$$, where $$$res$$$ is your answer, and $$$res_0$$$ is the answ... | C | 7bdb68ab0752f8df94b4d5c7df759dfb | e8b459abdae42bb0476d5ad96d2ca7ea | GNU C | standard output | 256 megabytes | train_002.jsonl | [
"implementation",
"brute force",
"math"
] | 1530628500 | ["4 3\n3 4 1 2"] | null | PASSED | 1,300 | standard input | 4 seconds | The first line contains two integers $$$n$$$ and $$$k$$$ ($$$1 \le k \le n \le 5000$$$) — the number of days in the given period, and the minimum number of days in a segment we consider when calculating heat intensity value, respectively. The second line contains $$$n$$$ integers $$$a_1$$$, $$$a_2$$$, ..., $$$a_n$$$ ($... | ["2.666666666666667"] | #include<stdio.h>
#include<string.h>
#include<stdlib.h>
double calc_hiv(int *arr,int i,int k);
int main(){
int n,k;
scanf("%d%d",&n,&k);
int arr[n];
for(int i=0;i<n;i++){
scanf("%d",&arr[i]);
}
double hiv=0;
double sum=0,temphiv=0;
for(int i=0;i<n;i++){
sum=0;
for(int j=i;j<n;j++){
... | |
The heat during the last few days has been really intense. Scientists from all over the Berland study how the temperatures and weather change, and they claim that this summer is abnormally hot. But any scientific claim sounds a lot more reasonable if there are some numbers involved, so they have decided to actually cal... | Print one real number — the heat intensity value, i. e., the maximum of average temperatures over all segments of not less than $$$k$$$ consecutive days. Your answer will be considered correct if the following condition holds: $$$|res - res_0| < 10^{-6}$$$, where $$$res$$$ is your answer, and $$$res_0$$$ is the answ... | C | 7bdb68ab0752f8df94b4d5c7df759dfb | 596ff2e844a8de30ae9b1b33e0454c7e | GNU C | standard output | 256 megabytes | train_002.jsonl | [
"implementation",
"brute force",
"math"
] | 1530628500 | ["4 3\n3 4 1 2"] | null | PASSED | 1,300 | standard input | 4 seconds | The first line contains two integers $$$n$$$ and $$$k$$$ ($$$1 \le k \le n \le 5000$$$) — the number of days in the given period, and the minimum number of days in a segment we consider when calculating heat intensity value, respectively. The second line contains $$$n$$$ integers $$$a_1$$$, $$$a_2$$$, ..., $$$a_n$$$ ($... | ["2.666666666666667"] | #include<stdio.h>
#define SIZE 5010
int tree[SIZE * 8];
int start_i, tree_size;
double ans = 0;
int make_tree(int cur_idx) {
if (cur_idx >= start_i) {
return tree[cur_idx];
}
return tree[cur_idx] = make_tree(cur_idx * 2) + make_tree(cur_idx * 2 + 1);
}
int getSum(int cur_idx, int ql, int qr, int cl, int cr) {
i... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.