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 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
Recently n students from city S moved to city P to attend a programming camp.They moved there by train. In the evening, all students in the train decided that they want to drink some tea. Of course, no two people can use the same teapot simultaneously, so the students had to form a queue to get their tea.i-th student c... | For each test case print n integers. i-th of them must be equal to the second when i-th student gets his tea, or 0 if he leaves without tea. | C | 471f80e349e70339eedd20d45b16e253 | 70c5372e1bd99c0b8d99a2c0032342ec | GNU C | standard output | 256 megabytes | train_001.jsonl | [
"implementation"
] | 1517582100 | ["2\n2\n1 3\n1 4\n3\n1 5\n1 1\n2 3"] | NoteThe example contains 2 tests: During 1-st second, students 1 and 2 come to the queue, and student 1 gets his tea. Student 2 gets his tea during 2-nd second. During 1-st second, students 1 and 2 come to the queue, student 1 gets his tea, and student 2 leaves without tea. During 2-nd second, student 3 comes and get... | PASSED | 1,200 | standard input | 1 second | The first line contains one integer t — the number of test cases to solve (1 ≤ t ≤ 1000). Then t test cases follow. The first line of each test case contains one integer n (1 ≤ n ≤ 1000) — the number of students. Then n lines follow. Each line contains two integer li, ri (1 ≤ li ≤ ri ≤ 5000) — the second i-th student c... | ["1 2 \n1 0 2"] | #include<stdio.h>
int main(){
int t,n,i,time,l,r;
scanf("%d",&t);
while(t--){
scanf("%d%d%d",&n,&l,&r);
time=l;
printf("%d ",time);
time++;
for(i=1;i<n;i++){
scanf("%d%d",&l,&r);
if(time>r)printf("0 ");
else{
if(time<l)time=l;
printf("%d ",time);
time++;
}
}
printf("\n");
}
re... | |
Recently n students from city S moved to city P to attend a programming camp.They moved there by train. In the evening, all students in the train decided that they want to drink some tea. Of course, no two people can use the same teapot simultaneously, so the students had to form a queue to get their tea.i-th student c... | For each test case print n integers. i-th of them must be equal to the second when i-th student gets his tea, or 0 if he leaves without tea. | C | 471f80e349e70339eedd20d45b16e253 | 7f81735673de7b65c4a51feccfba2dce | GNU C | standard output | 256 megabytes | train_001.jsonl | [
"implementation"
] | 1517582100 | ["2\n2\n1 3\n1 4\n3\n1 5\n1 1\n2 3"] | NoteThe example contains 2 tests: During 1-st second, students 1 and 2 come to the queue, and student 1 gets his tea. Student 2 gets his tea during 2-nd second. During 1-st second, students 1 and 2 come to the queue, student 1 gets his tea, and student 2 leaves without tea. During 2-nd second, student 3 comes and get... | PASSED | 1,200 | standard input | 1 second | The first line contains one integer t — the number of test cases to solve (1 ≤ t ≤ 1000). Then t test cases follow. The first line of each test case contains one integer n (1 ≤ n ≤ 1000) — the number of students. Then n lines follow. Each line contains two integer li, ri (1 ≤ li ≤ ri ≤ 5000) — the second i-th student c... | ["1 2 \n1 0 2"] | #include <stdio.h>
int main( void )
{
int t, n, l, r;
scanf( "%d", &t );
while( t > 0 ) {
scanf( "%d", &n );
int time = 0;
while( n > 0 ) {
scanf( "%d %d", &l, &r );
if( time <= l ) {
printf( "%d ", l );
time = l + 1;
... | |
Recently n students from city S moved to city P to attend a programming camp.They moved there by train. In the evening, all students in the train decided that they want to drink some tea. Of course, no two people can use the same teapot simultaneously, so the students had to form a queue to get their tea.i-th student c... | For each test case print n integers. i-th of them must be equal to the second when i-th student gets his tea, or 0 if he leaves without tea. | C | 471f80e349e70339eedd20d45b16e253 | 5035d01e06f003ff38300d993ce8da65 | GNU C | standard output | 256 megabytes | train_001.jsonl | [
"implementation"
] | 1517582100 | ["2\n2\n1 3\n1 4\n3\n1 5\n1 1\n2 3"] | NoteThe example contains 2 tests: During 1-st second, students 1 and 2 come to the queue, and student 1 gets his tea. Student 2 gets his tea during 2-nd second. During 1-st second, students 1 and 2 come to the queue, student 1 gets his tea, and student 2 leaves without tea. During 2-nd second, student 3 comes and get... | PASSED | 1,200 | standard input | 1 second | The first line contains one integer t — the number of test cases to solve (1 ≤ t ≤ 1000). Then t test cases follow. The first line of each test case contains one integer n (1 ≤ n ≤ 1000) — the number of students. Then n lines follow. Each line contains two integer li, ri (1 ≤ li ≤ ri ≤ 5000) — the second i-th student c... | ["1 2 \n1 0 2"] | #include <stdio.h>
#include <stdlib.h>
int main()
{
int t;
scanf("%d",&t);
while(t--)
{
int n,l[5000],r[5000],count,answer[5000];
scanf("%d",&n);
for(int i=0;i<n;i++){
scanf("%d %d",&l[i],&r[i]);
answer[i]=0;
}
answer[0]=l[0];
coun... | |
Recently n students from city S moved to city P to attend a programming camp.They moved there by train. In the evening, all students in the train decided that they want to drink some tea. Of course, no two people can use the same teapot simultaneously, so the students had to form a queue to get their tea.i-th student c... | For each test case print n integers. i-th of them must be equal to the second when i-th student gets his tea, or 0 if he leaves without tea. | C | 471f80e349e70339eedd20d45b16e253 | a82932a55cfc56902abdd1f37372ad67 | GNU C | standard output | 256 megabytes | train_001.jsonl | [
"implementation"
] | 1517582100 | ["2\n2\n1 3\n1 4\n3\n1 5\n1 1\n2 3"] | NoteThe example contains 2 tests: During 1-st second, students 1 and 2 come to the queue, and student 1 gets his tea. Student 2 gets his tea during 2-nd second. During 1-st second, students 1 and 2 come to the queue, student 1 gets his tea, and student 2 leaves without tea. During 2-nd second, student 3 comes and get... | PASSED | 1,200 | standard input | 1 second | The first line contains one integer t — the number of test cases to solve (1 ≤ t ≤ 1000). Then t test cases follow. The first line of each test case contains one integer n (1 ≤ n ≤ 1000) — the number of students. Then n lines follow. Each line contains two integer li, ri (1 ≤ li ≤ ri ≤ 5000) — the second i-th student c... | ["1 2 \n1 0 2"] | #include<stdio.h>
int main(){
int t,n,i,time,l,r;
scanf("%d",&t);
while(t--){
scanf("%d%d%d",&n,&l,&r);
time=l;
printf("%d ",time);
time++;
for(i=1;i<n;i++){
scanf("%d%d",&l,&r);
if(time>r)printf("0 ");
else{
if(time<l)time=l;
printf("%d ",time);
time++;
}
}
printf("\n");
}
re... | |
Recently n students from city S moved to city P to attend a programming camp.They moved there by train. In the evening, all students in the train decided that they want to drink some tea. Of course, no two people can use the same teapot simultaneously, so the students had to form a queue to get their tea.i-th student c... | For each test case print n integers. i-th of them must be equal to the second when i-th student gets his tea, or 0 if he leaves without tea. | C | 471f80e349e70339eedd20d45b16e253 | b94fcc54e08ddc2212f4789cad5769c3 | GNU C | standard output | 256 megabytes | train_001.jsonl | [
"implementation"
] | 1517582100 | ["2\n2\n1 3\n1 4\n3\n1 5\n1 1\n2 3"] | NoteThe example contains 2 tests: During 1-st second, students 1 and 2 come to the queue, and student 1 gets his tea. Student 2 gets his tea during 2-nd second. During 1-st second, students 1 and 2 come to the queue, student 1 gets his tea, and student 2 leaves without tea. During 2-nd second, student 3 comes and get... | PASSED | 1,200 | standard input | 1 second | The first line contains one integer t — the number of test cases to solve (1 ≤ t ≤ 1000). Then t test cases follow. The first line of each test case contains one integer n (1 ≤ n ≤ 1000) — the number of students. Then n lines follow. Each line contains two integer li, ri (1 ≤ li ≤ ri ≤ 5000) — the second i-th student c... | ["1 2 \n1 0 2"] | #include <stdio.h>
int main()
{
int test;
scanf("%d" ,&test);
for(int j =0 ; j< test; j++){
int n;
scanf("%d" ,&n);
int arrival[n] , wait[n];
for(int i=0; i<n ; i++){
scanf("%d %d", &arrival[i] ,&wait[i]);
}
int timer = arrival[0] ,zero= 0;
for(int i=0; i<n ; i++){
if(timer >= arriv... | |
Recently n students from city S moved to city P to attend a programming camp.They moved there by train. In the evening, all students in the train decided that they want to drink some tea. Of course, no two people can use the same teapot simultaneously, so the students had to form a queue to get their tea.i-th student c... | For each test case print n integers. i-th of them must be equal to the second when i-th student gets his tea, or 0 if he leaves without tea. | C | 471f80e349e70339eedd20d45b16e253 | 0d7bfc333e150ff12c348a94a4bf88ab | GNU C | standard output | 256 megabytes | train_001.jsonl | [
"implementation"
] | 1517582100 | ["2\n2\n1 3\n1 4\n3\n1 5\n1 1\n2 3"] | NoteThe example contains 2 tests: During 1-st second, students 1 and 2 come to the queue, and student 1 gets his tea. Student 2 gets his tea during 2-nd second. During 1-st second, students 1 and 2 come to the queue, student 1 gets his tea, and student 2 leaves without tea. During 2-nd second, student 3 comes and get... | PASSED | 1,200 | standard input | 1 second | The first line contains one integer t — the number of test cases to solve (1 ≤ t ≤ 1000). Then t test cases follow. The first line of each test case contains one integer n (1 ≤ n ≤ 1000) — the number of students. Then n lines follow. Each line contains two integer li, ri (1 ≤ li ≤ ri ≤ 5000) — the second i-th student c... | ["1 2 \n1 0 2"] | #include<stdio.h>
int main(){
int t,n,i,time,l,r;
scanf("%d",&t);
while(t--){
scanf("%d%d%d",&n,&l,&r);
time=l;
printf("%d ",time);
time++;
for(i=1;i<n;i++){
scanf("%d%d",&l,&r);
if(time>r)printf("0 ");
else{
if(time<l)time=l;
printf("%d ",time);
time++;
}
}
printf("\n");
}
re... | |
Recently n students from city S moved to city P to attend a programming camp.They moved there by train. In the evening, all students in the train decided that they want to drink some tea. Of course, no two people can use the same teapot simultaneously, so the students had to form a queue to get their tea.i-th student c... | For each test case print n integers. i-th of them must be equal to the second when i-th student gets his tea, or 0 if he leaves without tea. | C | 471f80e349e70339eedd20d45b16e253 | 218fd2d87e3ba29b22f3160152153233 | GNU C | standard output | 256 megabytes | train_001.jsonl | [
"implementation"
] | 1517582100 | ["2\n2\n1 3\n1 4\n3\n1 5\n1 1\n2 3"] | NoteThe example contains 2 tests: During 1-st second, students 1 and 2 come to the queue, and student 1 gets his tea. Student 2 gets his tea during 2-nd second. During 1-st second, students 1 and 2 come to the queue, student 1 gets his tea, and student 2 leaves without tea. During 2-nd second, student 3 comes and get... | PASSED | 1,200 | standard input | 1 second | The first line contains one integer t — the number of test cases to solve (1 ≤ t ≤ 1000). Then t test cases follow. The first line of each test case contains one integer n (1 ≤ n ≤ 1000) — the number of students. Then n lines follow. Each line contains two integer li, ri (1 ≤ li ≤ ri ≤ 5000) — the second i-th student c... | ["1 2 \n1 0 2"] | #include <stdio.h>
struct student {
int arrive;
int depart;
};
struct student s[1000];
int max(int a, int b) {
if (a > b)
return a;
return b;
}
void print_queue(int n) {
int time = 0;
for (int i = 0; i < n; i++) {
if (time >= s[i].depart)
printf("0 ");
else {
time = max(time+1, s[i].arrive);
... | |
Recently n students from city S moved to city P to attend a programming camp.They moved there by train. In the evening, all students in the train decided that they want to drink some tea. Of course, no two people can use the same teapot simultaneously, so the students had to form a queue to get their tea.i-th student c... | For each test case print n integers. i-th of them must be equal to the second when i-th student gets his tea, or 0 if he leaves without tea. | C | 471f80e349e70339eedd20d45b16e253 | d5c9d825ee47246adf3e2c89f253436d | GNU C | standard output | 256 megabytes | train_001.jsonl | [
"implementation"
] | 1517582100 | ["2\n2\n1 3\n1 4\n3\n1 5\n1 1\n2 3"] | NoteThe example contains 2 tests: During 1-st second, students 1 and 2 come to the queue, and student 1 gets his tea. Student 2 gets his tea during 2-nd second. During 1-st second, students 1 and 2 come to the queue, student 1 gets his tea, and student 2 leaves without tea. During 2-nd second, student 3 comes and get... | PASSED | 1,200 | standard input | 1 second | The first line contains one integer t — the number of test cases to solve (1 ≤ t ≤ 1000). Then t test cases follow. The first line of each test case contains one integer n (1 ≤ n ≤ 1000) — the number of students. Then n lines follow. Each line contains two integer li, ri (1 ≤ li ≤ ri ≤ 5000) — the second i-th student c... | ["1 2 \n1 0 2"] | #include <stdio.h>
int main()
{
int t,n,l,r;
int i,a[1005],k;
scanf("%d",&t);
while(t--)
{
k=0;
scanf("%d",&n);
for(i=0;i<n;i++)
{
scanf("%d%d",&l,&r);
if(k<l)
k=l;
if(k>r)
a[i]=0;
else
... | |
Recently n students from city S moved to city P to attend a programming camp.They moved there by train. In the evening, all students in the train decided that they want to drink some tea. Of course, no two people can use the same teapot simultaneously, so the students had to form a queue to get their tea.i-th student c... | For each test case print n integers. i-th of them must be equal to the second when i-th student gets his tea, or 0 if he leaves without tea. | C | 471f80e349e70339eedd20d45b16e253 | 7967e632216bd3186e6e337b32c6e41a | GNU C | standard output | 256 megabytes | train_001.jsonl | [
"implementation"
] | 1517582100 | ["2\n2\n1 3\n1 4\n3\n1 5\n1 1\n2 3"] | NoteThe example contains 2 tests: During 1-st second, students 1 and 2 come to the queue, and student 1 gets his tea. Student 2 gets his tea during 2-nd second. During 1-st second, students 1 and 2 come to the queue, student 1 gets his tea, and student 2 leaves without tea. During 2-nd second, student 3 comes and get... | PASSED | 1,200 | standard input | 1 second | The first line contains one integer t — the number of test cases to solve (1 ≤ t ≤ 1000). Then t test cases follow. The first line of each test case contains one integer n (1 ≤ n ≤ 1000) — the number of students. Then n lines follow. Each line contains two integer li, ri (1 ≤ li ≤ ri ≤ 5000) — the second i-th student c... | ["1 2 \n1 0 2"] | #include<stdio.h>
#include<math.h>
#include<string.h>
#include<stdlib.h>
int main()
{
int t,n,i,a,b,temp;
scanf("%d",&t);
while(t--)
{
scanf("%d",&n);
temp=-1;
for(i=0;i<n;i++)
{
scanf("%d %d",&a,&b);
if(temp<=a)
{
prin... | |
Recently n students from city S moved to city P to attend a programming camp.They moved there by train. In the evening, all students in the train decided that they want to drink some tea. Of course, no two people can use the same teapot simultaneously, so the students had to form a queue to get their tea.i-th student c... | For each test case print n integers. i-th of them must be equal to the second when i-th student gets his tea, or 0 if he leaves without tea. | C | 471f80e349e70339eedd20d45b16e253 | f01eafb399124a81e15b0920981bd441 | GNU C | standard output | 256 megabytes | train_001.jsonl | [
"implementation"
] | 1517582100 | ["2\n2\n1 3\n1 4\n3\n1 5\n1 1\n2 3"] | NoteThe example contains 2 tests: During 1-st second, students 1 and 2 come to the queue, and student 1 gets his tea. Student 2 gets his tea during 2-nd second. During 1-st second, students 1 and 2 come to the queue, student 1 gets his tea, and student 2 leaves without tea. During 2-nd second, student 3 comes and get... | PASSED | 1,200 | standard input | 1 second | The first line contains one integer t — the number of test cases to solve (1 ≤ t ≤ 1000). Then t test cases follow. The first line of each test case contains one integer n (1 ≤ n ≤ 1000) — the number of students. Then n lines follow. Each line contains two integer li, ri (1 ≤ li ≤ ri ≤ 5000) — the second i-th student c... | ["1 2 \n1 0 2"] | //set many funcs template
#include<stdio.h>
#include<string.h>
#include<stdlib.h>
#include<stdbool.h>
#define inf 1072114514
#define llinf 4154118101919364364
#define mod 1000000007
#define pi 3.1415926535897932384
int max(int a,int b){if(a>b){return a;}return b;}
int min(int a,int b){if(a<b){return a;}return b;}
int ... | |
Recently n students from city S moved to city P to attend a programming camp.They moved there by train. In the evening, all students in the train decided that they want to drink some tea. Of course, no two people can use the same teapot simultaneously, so the students had to form a queue to get their tea.i-th student c... | For each test case print n integers. i-th of them must be equal to the second when i-th student gets his tea, or 0 if he leaves without tea. | C | 471f80e349e70339eedd20d45b16e253 | f92ffcaa55344b0b80b0ddc689ecb55b | GNU C | standard output | 256 megabytes | train_001.jsonl | [
"implementation"
] | 1517582100 | ["2\n2\n1 3\n1 4\n3\n1 5\n1 1\n2 3"] | NoteThe example contains 2 tests: During 1-st second, students 1 and 2 come to the queue, and student 1 gets his tea. Student 2 gets his tea during 2-nd second. During 1-st second, students 1 and 2 come to the queue, student 1 gets his tea, and student 2 leaves without tea. During 2-nd second, student 3 comes and get... | PASSED | 1,200 | standard input | 1 second | The first line contains one integer t — the number of test cases to solve (1 ≤ t ≤ 1000). Then t test cases follow. The first line of each test case contains one integer n (1 ≤ n ≤ 1000) — the number of students. Then n lines follow. Each line contains two integer li, ri (1 ≤ li ≤ ri ≤ 5000) — the second i-th student c... | ["1 2 \n1 0 2"] | #include <stdio.h>
int main()
{
int t;
scanf("%d",&t);
while(t--)
{
int n;
scanf("%d",&n);
int a[n],b[n];
for(int i=0;i<n;i++)
{
scanf("%d%d",&a[i],&b[i]);
}
int c=1;
for(int i=0;i<n;i++)
{
if(b[i]<c)
... | |
Recently n students from city S moved to city P to attend a programming camp.They moved there by train. In the evening, all students in the train decided that they want to drink some tea. Of course, no two people can use the same teapot simultaneously, so the students had to form a queue to get their tea.i-th student c... | For each test case print n integers. i-th of them must be equal to the second when i-th student gets his tea, or 0 if he leaves without tea. | C | 471f80e349e70339eedd20d45b16e253 | 966d70f5cf74428ba58b9417814a71cc | GNU C | standard output | 256 megabytes | train_001.jsonl | [
"implementation"
] | 1517582100 | ["2\n2\n1 3\n1 4\n3\n1 5\n1 1\n2 3"] | NoteThe example contains 2 tests: During 1-st second, students 1 and 2 come to the queue, and student 1 gets his tea. Student 2 gets his tea during 2-nd second. During 1-st second, students 1 and 2 come to the queue, student 1 gets his tea, and student 2 leaves without tea. During 2-nd second, student 3 comes and get... | PASSED | 1,200 | standard input | 1 second | The first line contains one integer t — the number of test cases to solve (1 ≤ t ≤ 1000). Then t test cases follow. The first line of each test case contains one integer n (1 ≤ n ≤ 1000) — the number of students. Then n lines follow. Each line contains two integer li, ri (1 ≤ li ≤ ri ≤ 5000) — the second i-th student c... | ["1 2 \n1 0 2"] | #include<stdio.h>
#include<string.h>
#include<math.h>
#include<ctype.h>
#define mod 100000007
#define N 200001
int main()
{
int t,n,i,time,l,r;
scanf("%d",&t);
while(t--)
{
scanf("%d%d%d",&n,&l,&r);
time=l;
printf("%d ",time);
time++;
for(i=1; i<n; i++)
... | |
Recently n students from city S moved to city P to attend a programming camp.They moved there by train. In the evening, all students in the train decided that they want to drink some tea. Of course, no two people can use the same teapot simultaneously, so the students had to form a queue to get their tea.i-th student c... | For each test case print n integers. i-th of them must be equal to the second when i-th student gets his tea, or 0 if he leaves without tea. | C | 471f80e349e70339eedd20d45b16e253 | 0591b9ded6d1d6a2729a1b90008c9407 | GNU C | standard output | 256 megabytes | train_001.jsonl | [
"implementation"
] | 1517582100 | ["2\n2\n1 3\n1 4\n3\n1 5\n1 1\n2 3"] | NoteThe example contains 2 tests: During 1-st second, students 1 and 2 come to the queue, and student 1 gets his tea. Student 2 gets his tea during 2-nd second. During 1-st second, students 1 and 2 come to the queue, student 1 gets his tea, and student 2 leaves without tea. During 2-nd second, student 3 comes and get... | PASSED | 1,200 | standard input | 1 second | The first line contains one integer t — the number of test cases to solve (1 ≤ t ≤ 1000). Then t test cases follow. The first line of each test case contains one integer n (1 ≤ n ≤ 1000) — the number of students. Then n lines follow. Each line contains two integer li, ri (1 ≤ li ≤ ri ≤ 5000) — the second i-th student c... | ["1 2 \n1 0 2"] | #include <stdio.h>
#define N 1000
int main() {
int t;
scanf("%d", &t);
while (t-- > 0) {
static int tt[N], rr[N];
int n, i, j, time, l;
scanf("%d", &n);
time = 0;
for (i = 0, j = 0; i < n; i++) {
scanf("%d%d", &l, &rr[i]);
while (time < l && j < i) {
tt[j] = 0;
if (time <= rr[j])
tt[... | |
Recently n students from city S moved to city P to attend a programming camp.They moved there by train. In the evening, all students in the train decided that they want to drink some tea. Of course, no two people can use the same teapot simultaneously, so the students had to form a queue to get their tea.i-th student c... | For each test case print n integers. i-th of them must be equal to the second when i-th student gets his tea, or 0 if he leaves without tea. | C | 471f80e349e70339eedd20d45b16e253 | dc98a059b051d431e5c6f86d4a3ab51b | GNU C | standard output | 256 megabytes | train_001.jsonl | [
"implementation"
] | 1517582100 | ["2\n2\n1 3\n1 4\n3\n1 5\n1 1\n2 3"] | NoteThe example contains 2 tests: During 1-st second, students 1 and 2 come to the queue, and student 1 gets his tea. Student 2 gets his tea during 2-nd second. During 1-st second, students 1 and 2 come to the queue, student 1 gets his tea, and student 2 leaves without tea. During 2-nd second, student 3 comes and get... | PASSED | 1,200 | standard input | 1 second | The first line contains one integer t — the number of test cases to solve (1 ≤ t ≤ 1000). Then t test cases follow. The first line of each test case contains one integer n (1 ≤ n ≤ 1000) — the number of students. Then n lines follow. Each line contains two integer li, ri (1 ≤ li ≤ ri ≤ 5000) — the second i-th student c... | ["1 2 \n1 0 2"] | #include<stdio.h>
#include<stdlib.h>
void main(){
long long t,k=0,i,j,a,b,count;
scanf("%lld",&t);
long long n[t],ans[t][1100];
while(t--){
count=1;
scanf("%lld",&n[k]);
for(i=0;i<n[k];i++){
scanf("%lld %lld",&a,&b);
if(count>=a){
if(count-a>(b-a)){
ans[k][i]=0;}
e... | |
Recently n students from city S moved to city P to attend a programming camp.They moved there by train. In the evening, all students in the train decided that they want to drink some tea. Of course, no two people can use the same teapot simultaneously, so the students had to form a queue to get their tea.i-th student c... | For each test case print n integers. i-th of them must be equal to the second when i-th student gets his tea, or 0 if he leaves without tea. | C | 471f80e349e70339eedd20d45b16e253 | 2a8518d1fce73fac084c0454048e6d8d | GNU C | standard output | 256 megabytes | train_001.jsonl | [
"implementation"
] | 1517582100 | ["2\n2\n1 3\n1 4\n3\n1 5\n1 1\n2 3"] | NoteThe example contains 2 tests: During 1-st second, students 1 and 2 come to the queue, and student 1 gets his tea. Student 2 gets his tea during 2-nd second. During 1-st second, students 1 and 2 come to the queue, student 1 gets his tea, and student 2 leaves without tea. During 2-nd second, student 3 comes and get... | PASSED | 1,200 | standard input | 1 second | The first line contains one integer t — the number of test cases to solve (1 ≤ t ≤ 1000). Then t test cases follow. The first line of each test case contains one integer n (1 ≤ n ≤ 1000) — the number of students. Then n lines follow. Each line contains two integer li, ri (1 ≤ li ≤ ri ≤ 5000) — the second i-th student c... | ["1 2 \n1 0 2"] | #include<stdio.h>
int main()
{ long long int t,n,l[5009],r[5009],i,p;
scanf("%lld",&t);
while(t--)
{ scanf("%lld",&n);
for(i=0;i<n;++i)
scanf("%lld%lld",&l[i],&r[i]);
p=1; i=0;
while(i<n)
{ while(p<l[i])
p++;
if(r[i]>=p)
{ printf("%lld ",p);
... | |
Recently n students from city S moved to city P to attend a programming camp.They moved there by train. In the evening, all students in the train decided that they want to drink some tea. Of course, no two people can use the same teapot simultaneously, so the students had to form a queue to get their tea.i-th student c... | For each test case print n integers. i-th of them must be equal to the second when i-th student gets his tea, or 0 if he leaves without tea. | C | 471f80e349e70339eedd20d45b16e253 | c5a72f578ca6eceb98899e52d3b2e54f | GNU C | standard output | 256 megabytes | train_001.jsonl | [
"implementation"
] | 1517582100 | ["2\n2\n1 3\n1 4\n3\n1 5\n1 1\n2 3"] | NoteThe example contains 2 tests: During 1-st second, students 1 and 2 come to the queue, and student 1 gets his tea. Student 2 gets his tea during 2-nd second. During 1-st second, students 1 and 2 come to the queue, student 1 gets his tea, and student 2 leaves without tea. During 2-nd second, student 3 comes and get... | PASSED | 1,200 | standard input | 1 second | The first line contains one integer t — the number of test cases to solve (1 ≤ t ≤ 1000). Then t test cases follow. The first line of each test case contains one integer n (1 ≤ n ≤ 1000) — the number of students. Then n lines follow. Each line contains two integer li, ri (1 ≤ li ≤ ri ≤ 5000) — the second i-th student c... | ["1 2 \n1 0 2"] | #include <stdio.h>
int main(void)
{
int t, n;
scanf("%d", &t);
for(int i1 = 0; i1 < t; i1++)
{
scanf("%d", &n);
int time = 1;
for(int j = 0; j < n; j++)
{
int l, r;
scanf("%d%d", &l, &r);
if (l >= time)
{
ti... | |
Recently n students from city S moved to city P to attend a programming camp.They moved there by train. In the evening, all students in the train decided that they want to drink some tea. Of course, no two people can use the same teapot simultaneously, so the students had to form a queue to get their tea.i-th student c... | For each test case print n integers. i-th of them must be equal to the second when i-th student gets his tea, or 0 if he leaves without tea. | C | 471f80e349e70339eedd20d45b16e253 | 0fd84bf9f65f0411c1446517dd163a6d | GNU C | standard output | 256 megabytes | train_001.jsonl | [
"implementation"
] | 1517582100 | ["2\n2\n1 3\n1 4\n3\n1 5\n1 1\n2 3"] | NoteThe example contains 2 tests: During 1-st second, students 1 and 2 come to the queue, and student 1 gets his tea. Student 2 gets his tea during 2-nd second. During 1-st second, students 1 and 2 come to the queue, student 1 gets his tea, and student 2 leaves without tea. During 2-nd second, student 3 comes and get... | PASSED | 1,200 | standard input | 1 second | The first line contains one integer t — the number of test cases to solve (1 ≤ t ≤ 1000). Then t test cases follow. The first line of each test case contains one integer n (1 ≤ n ≤ 1000) — the number of students. Then n lines follow. Each line contains two integer li, ri (1 ≤ li ≤ ri ≤ 5000) — the second i-th student c... | ["1 2 \n1 0 2"] | #include<stdio.h>
int main()
{
int m,n,i,j,k,p,q,t;
scanf("%d",&q);
while(q)
{
int a[1010];
int b[1010];
int c[1010];
q--;
scanf("%d",&t);
for(i=0;i<t;i++)
scanf("%d%d",&a[i],&b[i]);
i=0;m=0;
while(i!=t)
{
if... | |
Recently n students from city S moved to city P to attend a programming camp.They moved there by train. In the evening, all students in the train decided that they want to drink some tea. Of course, no two people can use the same teapot simultaneously, so the students had to form a queue to get their tea.i-th student c... | For each test case print n integers. i-th of them must be equal to the second when i-th student gets his tea, or 0 if he leaves without tea. | C | 471f80e349e70339eedd20d45b16e253 | c78cd513bf1be42dcf83d58dc02265ed | GNU C | standard output | 256 megabytes | train_001.jsonl | [
"implementation"
] | 1517582100 | ["2\n2\n1 3\n1 4\n3\n1 5\n1 1\n2 3"] | NoteThe example contains 2 tests: During 1-st second, students 1 and 2 come to the queue, and student 1 gets his tea. Student 2 gets his tea during 2-nd second. During 1-st second, students 1 and 2 come to the queue, student 1 gets his tea, and student 2 leaves without tea. During 2-nd second, student 3 comes and get... | PASSED | 1,200 | standard input | 1 second | The first line contains one integer t — the number of test cases to solve (1 ≤ t ≤ 1000). Then t test cases follow. The first line of each test case contains one integer n (1 ≤ n ≤ 1000) — the number of students. Then n lines follow. Each line contains two integer li, ri (1 ≤ li ≤ ri ≤ 5000) — the second i-th student c... | ["1 2 \n1 0 2"] | #include<stdio.h>
int main(void)
{
int t,n;
scanf("%d", &t);
int i,j,k,l;
for(i=0; i<t; ++i){
scanf("%d", &n);
int a[n],b[n];
for(j=0; j<n; ++j){
scanf("%d%d", &a[j], &b[j]);
}
int sec=1;
for(k=0; k<n; ++k){
if(a[k]>sec){
... | |
Recently n students from city S moved to city P to attend a programming camp.They moved there by train. In the evening, all students in the train decided that they want to drink some tea. Of course, no two people can use the same teapot simultaneously, so the students had to form a queue to get their tea.i-th student c... | For each test case print n integers. i-th of them must be equal to the second when i-th student gets his tea, or 0 if he leaves without tea. | C | 471f80e349e70339eedd20d45b16e253 | f0cec32315a21fc47184dda4fb4f8f6d | GNU C | standard output | 256 megabytes | train_001.jsonl | [
"implementation"
] | 1517582100 | ["2\n2\n1 3\n1 4\n3\n1 5\n1 1\n2 3"] | NoteThe example contains 2 tests: During 1-st second, students 1 and 2 come to the queue, and student 1 gets his tea. Student 2 gets his tea during 2-nd second. During 1-st second, students 1 and 2 come to the queue, student 1 gets his tea, and student 2 leaves without tea. During 2-nd second, student 3 comes and get... | PASSED | 1,200 | standard input | 1 second | The first line contains one integer t — the number of test cases to solve (1 ≤ t ≤ 1000). Then t test cases follow. The first line of each test case contains one integer n (1 ≤ n ≤ 1000) — the number of students. Then n lines follow. Each line contains two integer li, ri (1 ≤ li ≤ ri ≤ 5000) — the second i-th student c... | ["1 2 \n1 0 2"] | #include<stdio.h>
struct note
{
int i;
int l;
int r;
int t;
}que[1500];
int main()
{
int t;
scanf("%d",&t);
while (t--)
{
int k;
struct note temp;
int n,i,j,a[1500],b[1500],c[1500];
scanf("%d",&n);
for (i=1;i<=n;i++)
{
que[i].i=... | |
Recently n students from city S moved to city P to attend a programming camp.They moved there by train. In the evening, all students in the train decided that they want to drink some tea. Of course, no two people can use the same teapot simultaneously, so the students had to form a queue to get their tea.i-th student c... | For each test case print n integers. i-th of them must be equal to the second when i-th student gets his tea, or 0 if he leaves without tea. | C | 471f80e349e70339eedd20d45b16e253 | 40af697ba3a82c77626fb9b6671885ae | GNU C | standard output | 256 megabytes | train_001.jsonl | [
"implementation"
] | 1517582100 | ["2\n2\n1 3\n1 4\n3\n1 5\n1 1\n2 3"] | NoteThe example contains 2 tests: During 1-st second, students 1 and 2 come to the queue, and student 1 gets his tea. Student 2 gets his tea during 2-nd second. During 1-st second, students 1 and 2 come to the queue, student 1 gets his tea, and student 2 leaves without tea. During 2-nd second, student 3 comes and get... | PASSED | 1,200 | standard input | 1 second | The first line contains one integer t — the number of test cases to solve (1 ≤ t ≤ 1000). Then t test cases follow. The first line of each test case contains one integer n (1 ≤ n ≤ 1000) — the number of students. Then n lines follow. Each line contains two integer li, ri (1 ≤ li ≤ ri ≤ 5000) — the second i-th student c... | ["1 2 \n1 0 2"] | #include<stdio.h>
#include<string.h>
int main()
{
int t,i;
scanf("%d\n",&t);
for(i=1;i<=t;i++)
{
int n,a[1005],c[1005],b[1005];
memset(c,0,sizeof(c));
memset(a,0,sizeof(a));
memset(b,0,sizeof(b));
scanf("%d\n",&n);
int j,k,s=1,d=0;
for(j=1;j<=n;j++)
{
scanf("%d %d",&a[j],&b[j]);
}
for(j=1;j<=... | |
Recently n students from city S moved to city P to attend a programming camp.They moved there by train. In the evening, all students in the train decided that they want to drink some tea. Of course, no two people can use the same teapot simultaneously, so the students had to form a queue to get their tea.i-th student c... | For each test case print n integers. i-th of them must be equal to the second when i-th student gets his tea, or 0 if he leaves without tea. | C | 471f80e349e70339eedd20d45b16e253 | afd4e09e50a67bbc57385b04e701440d | GNU C | standard output | 256 megabytes | train_001.jsonl | [
"implementation"
] | 1517582100 | ["2\n2\n1 3\n1 4\n3\n1 5\n1 1\n2 3"] | NoteThe example contains 2 tests: During 1-st second, students 1 and 2 come to the queue, and student 1 gets his tea. Student 2 gets his tea during 2-nd second. During 1-st second, students 1 and 2 come to the queue, student 1 gets his tea, and student 2 leaves without tea. During 2-nd second, student 3 comes and get... | PASSED | 1,200 | standard input | 1 second | The first line contains one integer t — the number of test cases to solve (1 ≤ t ≤ 1000). Then t test cases follow. The first line of each test case contains one integer n (1 ≤ n ≤ 1000) — the number of students. Then n lines follow. Each line contains two integer li, ri (1 ≤ li ≤ ri ≤ 5000) — the second i-th student c... | ["1 2 \n1 0 2"] | #include<stdio.h>
#include<string.h>
int main()
{
int t,i;
scanf("%d\n",&t);
for(i=1;i<=t;i++)
{
int n,a[1005],c[1005],b[1005];
memset(c,0,sizeof(c));
memset(a,0,sizeof(a));
memset(b,0,sizeof(b));
scanf("%d\n",&n);
int j,k,s=1,d=0;
for(j=1;j<=n;j++)
{
scanf("%d %d",&a[j],&b[j]);
}
for(j=1;j<=... | |
Recently n students from city S moved to city P to attend a programming camp.They moved there by train. In the evening, all students in the train decided that they want to drink some tea. Of course, no two people can use the same teapot simultaneously, so the students had to form a queue to get their tea.i-th student c... | For each test case print n integers. i-th of them must be equal to the second when i-th student gets his tea, or 0 if he leaves without tea. | C | 471f80e349e70339eedd20d45b16e253 | 5ccffece787b3130dbfe7d9bde7abb47 | GNU C | standard output | 256 megabytes | train_001.jsonl | [
"implementation"
] | 1517582100 | ["2\n2\n1 3\n1 4\n3\n1 5\n1 1\n2 3"] | NoteThe example contains 2 tests: During 1-st second, students 1 and 2 come to the queue, and student 1 gets his tea. Student 2 gets his tea during 2-nd second. During 1-st second, students 1 and 2 come to the queue, student 1 gets his tea, and student 2 leaves without tea. During 2-nd second, student 3 comes and get... | PASSED | 1,200 | standard input | 1 second | The first line contains one integer t — the number of test cases to solve (1 ≤ t ≤ 1000). Then t test cases follow. The first line of each test case contains one integer n (1 ≤ n ≤ 1000) — the number of students. Then n lines follow. Each line contains two integer li, ri (1 ≤ li ≤ ri ≤ 5000) — the second i-th student c... | ["1 2 \n1 0 2"] | #include<stdio.h>
int main()
{
int T;
scanf("%d",&T);
while(T--)
{
int n;
scanf("%d",&n);
int a[2100],b[2100];
for(int i=1;i<=n;i++)
{
scanf("%d %d",&a[i],&b[i]);
}
printf("%d",a[1]);
int time=a[1];
for(int i=2;i<=n;i++)
{
if(a[i]>time)
{
printf(" %d",a[i]);
time=a[i];
}
e... | |
Recently n students from city S moved to city P to attend a programming camp.They moved there by train. In the evening, all students in the train decided that they want to drink some tea. Of course, no two people can use the same teapot simultaneously, so the students had to form a queue to get their tea.i-th student c... | For each test case print n integers. i-th of them must be equal to the second when i-th student gets his tea, or 0 if he leaves without tea. | C | 471f80e349e70339eedd20d45b16e253 | 9a1623dd341a6e86e28c235a97e4fe6c | GNU C | standard output | 256 megabytes | train_001.jsonl | [
"implementation"
] | 1517582100 | ["2\n2\n1 3\n1 4\n3\n1 5\n1 1\n2 3"] | NoteThe example contains 2 tests: During 1-st second, students 1 and 2 come to the queue, and student 1 gets his tea. Student 2 gets his tea during 2-nd second. During 1-st second, students 1 and 2 come to the queue, student 1 gets his tea, and student 2 leaves without tea. During 2-nd second, student 3 comes and get... | PASSED | 1,200 | standard input | 1 second | The first line contains one integer t — the number of test cases to solve (1 ≤ t ≤ 1000). Then t test cases follow. The first line of each test case contains one integer n (1 ≤ n ≤ 1000) — the number of students. Then n lines follow. Each line contains two integer li, ri (1 ≤ li ≤ ri ≤ 5000) — the second i-th student c... | ["1 2 \n1 0 2"] | #include<stdio.h>
int main()
{
int t,i;
scanf("%d",&t);
for(i=0;i<t;i++)
{
int n,j;
scanf("%d",&n);
int l[n],r[n];
for(j=0;j<n;j++)
scanf("%d %d",&l[j],&r[j]);
int s=0;
for(j=0;j<n;j++)
{
if(s<l[j])
s=l[j];
... | |
Recently n students from city S moved to city P to attend a programming camp.They moved there by train. In the evening, all students in the train decided that they want to drink some tea. Of course, no two people can use the same teapot simultaneously, so the students had to form a queue to get their tea.i-th student c... | For each test case print n integers. i-th of them must be equal to the second when i-th student gets his tea, or 0 if he leaves without tea. | C | 471f80e349e70339eedd20d45b16e253 | fdb922776599ffcfaecedaaf06746902 | GNU C | standard output | 256 megabytes | train_001.jsonl | [
"implementation"
] | 1517582100 | ["2\n2\n1 3\n1 4\n3\n1 5\n1 1\n2 3"] | NoteThe example contains 2 tests: During 1-st second, students 1 and 2 come to the queue, and student 1 gets his tea. Student 2 gets his tea during 2-nd second. During 1-st second, students 1 and 2 come to the queue, student 1 gets his tea, and student 2 leaves without tea. During 2-nd second, student 3 comes and get... | PASSED | 1,200 | standard input | 1 second | The first line contains one integer t — the number of test cases to solve (1 ≤ t ≤ 1000). Then t test cases follow. The first line of each test case contains one integer n (1 ≤ n ≤ 1000) — the number of students. Then n lines follow. Each line contains two integer li, ri (1 ≤ li ≤ ri ≤ 5000) — the second i-th student c... | ["1 2 \n1 0 2"] | #include<stdio.h>
#include<stdlib.h>
#define N 1002
int max(int a,int b){
if(a>b)return a;
else return b;
}
struct event{
int id;
int l;
int r;
};
static int cmp(const void *a,const void *b){
if( (*(struct event *)a).l==(*(struct event *)b).l){
return (*(struct event *)a).id - (*(struct ... | |
Recently n students from city S moved to city P to attend a programming camp.They moved there by train. In the evening, all students in the train decided that they want to drink some tea. Of course, no two people can use the same teapot simultaneously, so the students had to form a queue to get their tea.i-th student c... | For each test case print n integers. i-th of them must be equal to the second when i-th student gets his tea, or 0 if he leaves without tea. | C | 471f80e349e70339eedd20d45b16e253 | e9920a912474a2bfbb277066e4aa8b6f | GNU C | standard output | 256 megabytes | train_001.jsonl | [
"implementation"
] | 1517582100 | ["2\n2\n1 3\n1 4\n3\n1 5\n1 1\n2 3"] | NoteThe example contains 2 tests: During 1-st second, students 1 and 2 come to the queue, and student 1 gets his tea. Student 2 gets his tea during 2-nd second. During 1-st second, students 1 and 2 come to the queue, student 1 gets his tea, and student 2 leaves without tea. During 2-nd second, student 3 comes and get... | PASSED | 1,200 | standard input | 1 second | The first line contains one integer t — the number of test cases to solve (1 ≤ t ≤ 1000). Then t test cases follow. The first line of each test case contains one integer n (1 ≤ n ≤ 1000) — the number of students. Then n lines follow. Each line contains two integer li, ri (1 ≤ li ≤ ri ≤ 5000) — the second i-th student c... | ["1 2 \n1 0 2"] | #include <stdio.h>
int main()
{
int c,s,i,j,k,l,m;
int a[2000][2];
scanf("%d",&c);
for(i=0;i<c;i++)
{
scanf("%d",&s);
for(j=0;j<s;j++)
{
for(k=0;k<2;k++)
{
scanf("%d",&a[j][k]);
}
}
for(j=0,m=1;j<s;j++)
{
l=a[j][0];
if(l>m)
{
m=l;
}
if(l<=m&&m<=a[j][1])
{
printf("... | |
Recently n students from city S moved to city P to attend a programming camp.They moved there by train. In the evening, all students in the train decided that they want to drink some tea. Of course, no two people can use the same teapot simultaneously, so the students had to form a queue to get their tea.i-th student c... | For each test case print n integers. i-th of them must be equal to the second when i-th student gets his tea, or 0 if he leaves without tea. | C | 471f80e349e70339eedd20d45b16e253 | 493e1fe31f370045b30a93b5ae3237cf | GNU C | standard output | 256 megabytes | train_001.jsonl | [
"implementation"
] | 1517582100 | ["2\n2\n1 3\n1 4\n3\n1 5\n1 1\n2 3"] | NoteThe example contains 2 tests: During 1-st second, students 1 and 2 come to the queue, and student 1 gets his tea. Student 2 gets his tea during 2-nd second. During 1-st second, students 1 and 2 come to the queue, student 1 gets his tea, and student 2 leaves without tea. During 2-nd second, student 3 comes and get... | PASSED | 1,200 | standard input | 1 second | The first line contains one integer t — the number of test cases to solve (1 ≤ t ≤ 1000). Then t test cases follow. The first line of each test case contains one integer n (1 ≤ n ≤ 1000) — the number of students. Then n lines follow. Each line contains two integer li, ri (1 ≤ li ≤ ri ≤ 5000) — the second i-th student c... | ["1 2 \n1 0 2"] | #include<stdio.h>
int main(void){
int t;
scanf("%d",&t);
for(int j = 0; j < t ; j++){
int n;
scanf("%d",&n);
int t1,t2,cur_t = 0;
for(int i = 0; i < n ; i++){
scanf("%d %d",&t1,&t2);
if(cur_t <= t1){
cur_t = t1;
}
if(t2 >= cur_t){
printf("%d ",cur_t);
cur_t++;
}
else{
prin... | |
Recently n students from city S moved to city P to attend a programming camp.They moved there by train. In the evening, all students in the train decided that they want to drink some tea. Of course, no two people can use the same teapot simultaneously, so the students had to form a queue to get their tea.i-th student c... | For each test case print n integers. i-th of them must be equal to the second when i-th student gets his tea, or 0 if he leaves without tea. | C | 471f80e349e70339eedd20d45b16e253 | 1a29ccb602b5f95664837d8880f571d3 | GNU C | standard output | 256 megabytes | train_001.jsonl | [
"implementation"
] | 1517582100 | ["2\n2\n1 3\n1 4\n3\n1 5\n1 1\n2 3"] | NoteThe example contains 2 tests: During 1-st second, students 1 and 2 come to the queue, and student 1 gets his tea. Student 2 gets his tea during 2-nd second. During 1-st second, students 1 and 2 come to the queue, student 1 gets his tea, and student 2 leaves without tea. During 2-nd second, student 3 comes and get... | PASSED | 1,200 | standard input | 1 second | The first line contains one integer t — the number of test cases to solve (1 ≤ t ≤ 1000). Then t test cases follow. The first line of each test case contains one integer n (1 ≤ n ≤ 1000) — the number of students. Then n lines follow. Each line contains two integer li, ri (1 ≤ li ≤ ri ≤ 5000) — the second i-th student c... | ["1 2 \n1 0 2"] | #include<stdio.h>
struct student{
int arrive,leave;
}a[1005];
int t,n,x[1005];
int main()
{
scanf("%d",&t);
while(t--)
{
scanf("%d",&n);
for(int i=0;i<n;i++)
scanf("%d%d",&a[i].arrive,&a[i].leave);
int time=1;
for(int i=0;i<n;i++)
{
if(a[i].arrive>=time)
{
time=a[i].arrive+1;
x[i]=a[i].arr... | |
Recently n students from city S moved to city P to attend a programming camp.They moved there by train. In the evening, all students in the train decided that they want to drink some tea. Of course, no two people can use the same teapot simultaneously, so the students had to form a queue to get their tea.i-th student c... | For each test case print n integers. i-th of them must be equal to the second when i-th student gets his tea, or 0 if he leaves without tea. | C | 471f80e349e70339eedd20d45b16e253 | 5f373897c4298f17771761cac04c096b | GNU C | standard output | 256 megabytes | train_001.jsonl | [
"implementation"
] | 1517582100 | ["2\n2\n1 3\n1 4\n3\n1 5\n1 1\n2 3"] | NoteThe example contains 2 tests: During 1-st second, students 1 and 2 come to the queue, and student 1 gets his tea. Student 2 gets his tea during 2-nd second. During 1-st second, students 1 and 2 come to the queue, student 1 gets his tea, and student 2 leaves without tea. During 2-nd second, student 3 comes and get... | PASSED | 1,200 | standard input | 1 second | The first line contains one integer t — the number of test cases to solve (1 ≤ t ≤ 1000). Then t test cases follow. The first line of each test case contains one integer n (1 ≤ n ≤ 1000) — the number of students. Then n lines follow. Each line contains two integer li, ri (1 ≤ li ≤ ri ≤ 5000) — the second i-th student c... | ["1 2 \n1 0 2"] | #include<stdio.h>
int main()
{
int t;
scanf("%d",&t);
while(t)
{
int n;
scanf("%d",&n);
int mat[n][2];
for(int i=0; i<n; i++)
{
scanf("%d %d",&mat[i][0],&mat[i][1]);
}
if(n==1)
printf("%d\n",mat[0][0]);
else
{
... | |
After the lessons n groups of schoolchildren went outside and decided to visit Polycarpus to celebrate his birthday. We know that the i-th group consists of si friends (1 ≤ si ≤ 4), and they want to go to Polycarpus together. They decided to get there by taxi. Each car can carry at most four passengers. What minimum nu... | Print the single number — the minimum number of taxis necessary to drive all children to Polycarpus. | C | 371100da1b044ad500ac4e1c09fa8dcb | 11f21e96b662d0333fa15a3fe379cd9f | GNU C | standard output | 256 megabytes | train_001.jsonl | [
"implementation",
"*special",
"greedy"
] | 1330804800 | ["5\n1 2 4 3 3", "8\n2 3 4 4 2 1 3 1"] | NoteIn the first test we can sort the children into four cars like this: the third group (consisting of four children), the fourth group (consisting of three children), the fifth group (consisting of three children), the first and the second group (consisting of one and two children, correspondingly). There are oth... | PASSED | 1,100 | standard input | 3 seconds | The first line contains integer n (1 ≤ n ≤ 105) — the number of groups of schoolchildren. The second line contains a sequence of integers s1, s2, ..., sn (1 ≤ si ≤ 4). The integers are separated by a space, si is the number of children in the i-th group. | ["4", "5"] | #include <stdio.h>
int main(){
int s,n,i,k,o,d,t;
k=0;
o=0; d=0; t=0;
scanf("%i\n", &n);
for (i=0; i<n; i++){
scanf("%i", &s);
switch(s){
case 1:
if (t!=0) t--;
else if(t==0) {
o++;
k++;
... | |
After the lessons n groups of schoolchildren went outside and decided to visit Polycarpus to celebrate his birthday. We know that the i-th group consists of si friends (1 ≤ si ≤ 4), and they want to go to Polycarpus together. They decided to get there by taxi. Each car can carry at most four passengers. What minimum nu... | Print the single number — the minimum number of taxis necessary to drive all children to Polycarpus. | C | 371100da1b044ad500ac4e1c09fa8dcb | c9ef56d053c7a2141cdf67e2629e43e5 | GNU C | standard output | 256 megabytes | train_001.jsonl | [
"implementation",
"*special",
"greedy"
] | 1330804800 | ["5\n1 2 4 3 3", "8\n2 3 4 4 2 1 3 1"] | NoteIn the first test we can sort the children into four cars like this: the third group (consisting of four children), the fourth group (consisting of three children), the fifth group (consisting of three children), the first and the second group (consisting of one and two children, correspondingly). There are oth... | PASSED | 1,100 | standard input | 3 seconds | The first line contains integer n (1 ≤ n ≤ 105) — the number of groups of schoolchildren. The second line contains a sequence of integers s1, s2, ..., sn (1 ≤ si ≤ 4). The integers are separated by a space, si is the number of children in the i-th group. | ["4", "5"] | #include<stdio.h>
int main()
{
int n,b[4],i,count=0,c;
scanf("%d",&n);
int a[n];
for(i=0;i<4;i++){
b[i]=0;
}
for(i=0;i<n;i++)
{
scanf("%d",&a[i]);
if(a[i]==4)
{
b[3]++ ;
}
else if(a[i]==3)
{
b[2]++ ;
}
... | |
After the lessons n groups of schoolchildren went outside and decided to visit Polycarpus to celebrate his birthday. We know that the i-th group consists of si friends (1 ≤ si ≤ 4), and they want to go to Polycarpus together. They decided to get there by taxi. Each car can carry at most four passengers. What minimum nu... | Print the single number — the minimum number of taxis necessary to drive all children to Polycarpus. | C | 371100da1b044ad500ac4e1c09fa8dcb | 462f254f7e9b4420c844fae3091b0c70 | GNU C | standard output | 256 megabytes | train_001.jsonl | [
"implementation",
"*special",
"greedy"
] | 1330804800 | ["5\n1 2 4 3 3", "8\n2 3 4 4 2 1 3 1"] | NoteIn the first test we can sort the children into four cars like this: the third group (consisting of four children), the fourth group (consisting of three children), the fifth group (consisting of three children), the first and the second group (consisting of one and two children, correspondingly). There are oth... | PASSED | 1,100 | standard input | 3 seconds | The first line contains integer n (1 ≤ n ≤ 105) — the number of groups of schoolchildren. The second line contains a sequence of integers s1, s2, ..., sn (1 ≤ si ≤ 4). The integers are separated by a space, si is the number of children in the i-th group. | ["4", "5"] | #include<stdio.h>
int main ()
{
long n,c1=0,c2=0,c3=0,c4=0,mod1,mod2,mod3,c;
scanf("%ld",&n);
for(long i=0;i<n;i++){scanf("%d",&c);if(c==1)c1++;else if(c==2)c2++;else if(c==3)c3++;else c4++;}
while(c1!=0&&c3!=0){c1--;c3--;c4++;}
mod3=c1%4; mod1=c1%2;
c4+=(c1-mod3)/4;c1=mod3;
c2+=(c1-mod1)/... | |
After the lessons n groups of schoolchildren went outside and decided to visit Polycarpus to celebrate his birthday. We know that the i-th group consists of si friends (1 ≤ si ≤ 4), and they want to go to Polycarpus together. They decided to get there by taxi. Each car can carry at most four passengers. What minimum nu... | Print the single number — the minimum number of taxis necessary to drive all children to Polycarpus. | C | 371100da1b044ad500ac4e1c09fa8dcb | 56c40c8d5388a0cc4617f5c326256297 | GNU C | standard output | 256 megabytes | train_001.jsonl | [
"implementation",
"*special",
"greedy"
] | 1330804800 | ["5\n1 2 4 3 3", "8\n2 3 4 4 2 1 3 1"] | NoteIn the first test we can sort the children into four cars like this: the third group (consisting of four children), the fourth group (consisting of three children), the fifth group (consisting of three children), the first and the second group (consisting of one and two children, correspondingly). There are oth... | PASSED | 1,100 | standard input | 3 seconds | The first line contains integer n (1 ≤ n ≤ 105) — the number of groups of schoolchildren. The second line contains a sequence of integers s1, s2, ..., sn (1 ≤ si ≤ 4). The integers are separated by a space, si is the number of children in the i-th group. | ["4", "5"] | #include<stdio.h>
int main ()
{
int i ,n ,x, count[4]={0} , taxi = 0;
scanf("%d",&n);
//scanning the input
for(i=0;i<n;i++)
{
scanf("%d",&x);
count[x-1]++;
}
taxi=count[3]+count[2];
if(count[2]>count[0])
count[0]=0 ;
else
count[0]-=count... | |
After the lessons n groups of schoolchildren went outside and decided to visit Polycarpus to celebrate his birthday. We know that the i-th group consists of si friends (1 ≤ si ≤ 4), and they want to go to Polycarpus together. They decided to get there by taxi. Each car can carry at most four passengers. What minimum nu... | Print the single number — the minimum number of taxis necessary to drive all children to Polycarpus. | C | 371100da1b044ad500ac4e1c09fa8dcb | e134b2875a95814e4276379728edec40 | GNU C | standard output | 256 megabytes | train_001.jsonl | [
"implementation",
"*special",
"greedy"
] | 1330804800 | ["5\n1 2 4 3 3", "8\n2 3 4 4 2 1 3 1"] | NoteIn the first test we can sort the children into four cars like this: the third group (consisting of four children), the fourth group (consisting of three children), the fifth group (consisting of three children), the first and the second group (consisting of one and two children, correspondingly). There are oth... | PASSED | 1,100 | standard input | 3 seconds | The first line contains integer n (1 ≤ n ≤ 105) — the number of groups of schoolchildren. The second line contains a sequence of integers s1, s2, ..., sn (1 ≤ si ≤ 4). The integers are separated by a space, si is the number of children in the i-th group. | ["4", "5"] | #include<stdio.h>
int A[5],n,x,w;
int main(){
scanf("%d",&n);
while(n--){
scanf("%d",&x);
A[x]++;
}w = A[1] - A[3] + 2 * (A[2] & 1);
printf("%d",A[4] + A[2] / 2 + A[3] + (A[1] > A[3] ? w / 4 + (w % 4 != 0) : (A[2] & 1)));
return 0;
} | |
An infinitely long railway has a train consisting of n cars, numbered from 1 to n (the numbers of all the cars are distinct) and positioned in arbitrary order. David Blaine wants to sort the railway cars in the order of increasing numbers. In one move he can make one of the cars disappear from its place and teleport it... | Print a single integer — the minimum number of actions needed to sort the railway cars. | C | 277948a70c75840445e1826f2b23a897 | 52f4d4ca666ec6fed801bb2543a3636a | GNU C | standard output | 256 megabytes | train_001.jsonl | [
"constructive algorithms",
"greedy"
] | 1449677100 | ["5\n4 1 2 5 3", "4\n4 1 3 2"] | NoteIn the first sample you need first to teleport the 4-th car, and then the 5-th car to the end of the train. | PASSED | 1,600 | standard input | 2 seconds | The first line of the input contains integer n (1 ≤ n ≤ 100 000) — the number of cars in the train. The second line contains n integers pi (1 ≤ pi ≤ n, pi ≠ pj if i ≠ j) — the sequence of the numbers of the cars in the train. | ["2", "2"] | #include <stdio.h>
#include <string.h>
#include <stdlib.h>
int max(int a, int b){
return (a>b)?a:b;
}
int main(void) {
int n;
scanf("%d",&n);
int arr[n+1];
int i;
for(i=0;i<=n;i++){
arr[i]=0;
}
for(i=0;i<n;i++){
int curr;
scanf("%d",&curr);
arr[curr] = a... | |
An infinitely long railway has a train consisting of n cars, numbered from 1 to n (the numbers of all the cars are distinct) and positioned in arbitrary order. David Blaine wants to sort the railway cars in the order of increasing numbers. In one move he can make one of the cars disappear from its place and teleport it... | Print a single integer — the minimum number of actions needed to sort the railway cars. | C | 277948a70c75840445e1826f2b23a897 | 5c7f9c227581274c0926f38d6e7d653d | GNU C | standard output | 256 megabytes | train_001.jsonl | [
"constructive algorithms",
"greedy"
] | 1449677100 | ["5\n4 1 2 5 3", "4\n4 1 3 2"] | NoteIn the first sample you need first to teleport the 4-th car, and then the 5-th car to the end of the train. | PASSED | 1,600 | standard input | 2 seconds | The first line of the input contains integer n (1 ≤ n ≤ 100 000) — the number of cars in the train. The second line contains n integers pi (1 ≤ pi ≤ n, pi ≠ pj if i ≠ j) — the sequence of the numbers of the cars in the train. | ["2", "2"] | #include<stdio.h>
int main()
{
int i,n,x;
scanf("%d",&n);
int a[n+1];
for(i=0;i<=n;i++)
a[i]=0;
for(i=0;i<n;i++)
{
scanf("%d",&x);
if(a[x-1]==0)
a[x]=1;
else
a[x]=a[x-1]+1;
}x=0;
for(i=0;i<=n;i++)
if(a[i]>x)
x=a[i];
printf("%d",n-x... | |
An infinitely long railway has a train consisting of n cars, numbered from 1 to n (the numbers of all the cars are distinct) and positioned in arbitrary order. David Blaine wants to sort the railway cars in the order of increasing numbers. In one move he can make one of the cars disappear from its place and teleport it... | Print a single integer — the minimum number of actions needed to sort the railway cars. | C | 277948a70c75840445e1826f2b23a897 | 5abfa0b8a77388c8f7e49f8df21983ec | GNU C | standard output | 256 megabytes | train_001.jsonl | [
"constructive algorithms",
"greedy"
] | 1449677100 | ["5\n4 1 2 5 3", "4\n4 1 3 2"] | NoteIn the first sample you need first to teleport the 4-th car, and then the 5-th car to the end of the train. | PASSED | 1,600 | standard input | 2 seconds | The first line of the input contains integer n (1 ≤ n ≤ 100 000) — the number of cars in the train. The second line contains n integers pi (1 ≤ pi ≤ n, pi ≠ pj if i ≠ j) — the sequence of the numbers of the cars in the train. | ["2", "2"] | #include "stdio.h"
#include "stdlib.h"
#include "math.h"
main(n,i,k,max,cur) {
scanf("%d", &n);
int pos[1000001];
for(i=1; i<n; ++i) {
scanf("%d ", &k);
pos[k] = i;
}
scanf("%d", &k);
pos[k] = i;
for(i=1, cur=1, max=cur; i<n; ++i) {
if(pos[i] < pos[i+1]) ++cur, ma... | |
An infinitely long railway has a train consisting of n cars, numbered from 1 to n (the numbers of all the cars are distinct) and positioned in arbitrary order. David Blaine wants to sort the railway cars in the order of increasing numbers. In one move he can make one of the cars disappear from its place and teleport it... | Print a single integer — the minimum number of actions needed to sort the railway cars. | C | 277948a70c75840445e1826f2b23a897 | 2762c940680388ee0233645ed0228880 | GNU C | standard output | 256 megabytes | train_001.jsonl | [
"constructive algorithms",
"greedy"
] | 1449677100 | ["5\n4 1 2 5 3", "4\n4 1 3 2"] | NoteIn the first sample you need first to teleport the 4-th car, and then the 5-th car to the end of the train. | PASSED | 1,600 | standard input | 2 seconds | The first line of the input contains integer n (1 ≤ n ≤ 100 000) — the number of cars in the train. The second line contains n integers pi (1 ≤ pi ≤ n, pi ≠ pj if i ≠ j) — the sequence of the numbers of the cars in the train. | ["2", "2"] | #include <stdio.h>
int a[100001],b[100001];
int main()
{
int n ,i;
scanf("%d",&n);
for (i = 1; i <= n; i++)
{
scanf("%d",&a[i]);
b[a[i]] = i;
}
int ans = 1; int max = 1;
for (i = 2; i <= n; i++)
{
if (b[i]>b[i-1]) ans++;
else
{
if (ans>max) max=ans;
ans = 1;
}
}
if (ans>max) max=ans;
pri... | |
An infinitely long railway has a train consisting of n cars, numbered from 1 to n (the numbers of all the cars are distinct) and positioned in arbitrary order. David Blaine wants to sort the railway cars in the order of increasing numbers. In one move he can make one of the cars disappear from its place and teleport it... | Print a single integer — the minimum number of actions needed to sort the railway cars. | C | 277948a70c75840445e1826f2b23a897 | b61309a4bf268a57bdff19706adf45a2 | GNU C | standard output | 256 megabytes | train_001.jsonl | [
"constructive algorithms",
"greedy"
] | 1449677100 | ["5\n4 1 2 5 3", "4\n4 1 3 2"] | NoteIn the first sample you need first to teleport the 4-th car, and then the 5-th car to the end of the train. | PASSED | 1,600 | standard input | 2 seconds | The first line of the input contains integer n (1 ≤ n ≤ 100 000) — the number of cars in the train. The second line contains n integers pi (1 ≤ pi ≤ n, pi ≠ pj if i ≠ j) — the sequence of the numbers of the cars in the train. | ["2", "2"] | /* Problem: 605A - Sorting Railway Cars */
/* Solver: Gusztav Szmolik */
#include <stdio.h>
unsigned int q[100000];
int main ()
{
unsigned int n;
unsigned int i;
unsigned int p;
unsigned int sc;
unsigned int sx;
unsigned int nm;
if (scanf("%u",&n) != 1)
return -1;
if ... | |
An infinitely long railway has a train consisting of n cars, numbered from 1 to n (the numbers of all the cars are distinct) and positioned in arbitrary order. David Blaine wants to sort the railway cars in the order of increasing numbers. In one move he can make one of the cars disappear from its place and teleport it... | Print a single integer — the minimum number of actions needed to sort the railway cars. | C | 277948a70c75840445e1826f2b23a897 | 673c564b4cef08921af0befbcd47e1b8 | GNU C | standard output | 256 megabytes | train_001.jsonl | [
"constructive algorithms",
"greedy"
] | 1449677100 | ["5\n4 1 2 5 3", "4\n4 1 3 2"] | NoteIn the first sample you need first to teleport the 4-th car, and then the 5-th car to the end of the train. | PASSED | 1,600 | standard input | 2 seconds | The first line of the input contains integer n (1 ≤ n ≤ 100 000) — the number of cars in the train. The second line contains n integers pi (1 ≤ pi ≤ n, pi ≠ pj if i ≠ j) — the sequence of the numbers of the cars in the train. | ["2", "2"] | #include "stdio.h"
int n,i,p,mx;
int a[100005];
int main(){
scanf("%d",&n);
for(i = 0; i < n; i++){
scanf("%d",&p);
a[p] = 1+a[p-1];
if(a[p]>mx) mx = a[p];
}
printf("%d\n",n-mx);
} | |
An infinitely long railway has a train consisting of n cars, numbered from 1 to n (the numbers of all the cars are distinct) and positioned in arbitrary order. David Blaine wants to sort the railway cars in the order of increasing numbers. In one move he can make one of the cars disappear from its place and teleport it... | Print a single integer — the minimum number of actions needed to sort the railway cars. | C | 277948a70c75840445e1826f2b23a897 | d533dbeba3c175e7edfaf538188ec932 | GNU C | standard output | 256 megabytes | train_001.jsonl | [
"constructive algorithms",
"greedy"
] | 1449677100 | ["5\n4 1 2 5 3", "4\n4 1 3 2"] | NoteIn the first sample you need first to teleport the 4-th car, and then the 5-th car to the end of the train. | PASSED | 1,600 | standard input | 2 seconds | The first line of the input contains integer n (1 ≤ n ≤ 100 000) — the number of cars in the train. The second line contains n integers pi (1 ≤ pi ≤ n, pi ≠ pj if i ≠ j) — the sequence of the numbers of the cars in the train. | ["2", "2"] | #include <stdio.h>
int main()
{
int n;
scanf("%d", &n);
int r = 1;
int ps[100000];
for (int i = 0; i < n; i++)
{
ps[i] = 0;
}
for (int i = 0; i < n; i++)
{
int p;
scanf("%d", &p);
ps[p] = 1 + ps[p - 1];
if ... | |
An infinitely long railway has a train consisting of n cars, numbered from 1 to n (the numbers of all the cars are distinct) and positioned in arbitrary order. David Blaine wants to sort the railway cars in the order of increasing numbers. In one move he can make one of the cars disappear from its place and teleport it... | Print a single integer — the minimum number of actions needed to sort the railway cars. | C | 277948a70c75840445e1826f2b23a897 | 9cd488c773c146e4e733607aa2c1e4dc | GNU C | standard output | 256 megabytes | train_001.jsonl | [
"constructive algorithms",
"greedy"
] | 1449677100 | ["5\n4 1 2 5 3", "4\n4 1 3 2"] | NoteIn the first sample you need first to teleport the 4-th car, and then the 5-th car to the end of the train. | PASSED | 1,600 | standard input | 2 seconds | The first line of the input contains integer n (1 ≤ n ≤ 100 000) — the number of cars in the train. The second line contains n integers pi (1 ≤ pi ≤ n, pi ≠ pj if i ≠ j) — the sequence of the numbers of the cars in the train. | ["2", "2"] | #include<stdio.h>
int dp[100009];
int max(int a,int b)
{
return (a>b?a:b);
}
int main()
{
int n,i,count=0;
int a[100009];
scanf("%d",&n);
for(i=1;i<=n;i++)
scanf("%d",&a[i]);
for(i=1;i<=n;i++)
{
dp[a[i]]=dp[a[i]-1]+1;
}
for(i=1;i<=n;i++)
count=max(count,dp[i]);
... | |
An infinitely long railway has a train consisting of n cars, numbered from 1 to n (the numbers of all the cars are distinct) and positioned in arbitrary order. David Blaine wants to sort the railway cars in the order of increasing numbers. In one move he can make one of the cars disappear from its place and teleport it... | Print a single integer — the minimum number of actions needed to sort the railway cars. | C | 277948a70c75840445e1826f2b23a897 | 0f85f3088d3e449cbb3e4c86bd264afb | GNU C | standard output | 256 megabytes | train_001.jsonl | [
"constructive algorithms",
"greedy"
] | 1449677100 | ["5\n4 1 2 5 3", "4\n4 1 3 2"] | NoteIn the first sample you need first to teleport the 4-th car, and then the 5-th car to the end of the train. | PASSED | 1,600 | standard input | 2 seconds | The first line of the input contains integer n (1 ≤ n ≤ 100 000) — the number of cars in the train. The second line contains n integers pi (1 ≤ pi ≤ n, pi ≠ pj if i ≠ j) — the sequence of the numbers of the cars in the train. | ["2", "2"] | #pragma warning(disable:4996)
#include <stdio.h>
int dat[100000];
int rev[100000];
int ln[100000];
int main() {
int n;
scanf("%d", &n);
for (int i = 0; i < n; i++) {
int x;
scanf("%d", &x);
x--;
dat[i] = x;
rev[x] = i;
}
ln[0] = 1; int M = 1;
for (int i... | |
Wilbur the pig is tinkering with arrays again. He has the array a1, a2, ..., an initially consisting of n zeros. At one step, he can choose any index i and either add 1 to all elements ai, ai + 1, ... , an or subtract 1 from all elements ai, ai + 1, ..., an. His goal is to end up with the array b1, b2, ..., bn. Of cour... | Print the minimum number of steps that Wilbur needs to make in order to achieve ai = bi for all i. | C | 97a226f47973fcb39c40e16f66654b5f | 8a8353c632b2acf487a1df0aeeed73c9 | GNU C11 | standard output | 256 megabytes | train_001.jsonl | [
"implementation",
"greedy"
] | 1447605300 | ["5\n1 2 3 4 5", "4\n1 2 2 1"] | NoteIn the first sample, Wilbur may successively choose indices 1, 2, 3, 4, and 5, and add 1 to corresponding suffixes.In the second sample, Wilbur first chooses indices 1 and 2 and adds 1 to corresponding suffixes, then he chooses index 4 and subtract 1. | PASSED | 1,100 | standard input | 2 seconds | The first line of the input contains a single integer n (1 ≤ n ≤ 200 000) — the length of the array ai. Initially ai = 0 for every position i, so this array is not given in the input. The second line of the input contains n integers b1, b2, ..., bn ( - 109 ≤ bi ≤ 109). | ["5", "3"] | #include <stdio.h>
#include <stdlib.h>
long long n , i , t ,a[200005];
int main(void) {
scanf("%llu",&n);
scanf("%llu",&a[0]);
for ( i = 1 ; i < n ; i++){
scanf("%llu",&a[i]);
t+=abs(a[i]-a[i-1]);
}
printf("%llu",t+abs(a[0]));
return 0;
}
| |
Wilbur the pig is tinkering with arrays again. He has the array a1, a2, ..., an initially consisting of n zeros. At one step, he can choose any index i and either add 1 to all elements ai, ai + 1, ... , an or subtract 1 from all elements ai, ai + 1, ..., an. His goal is to end up with the array b1, b2, ..., bn. Of cour... | Print the minimum number of steps that Wilbur needs to make in order to achieve ai = bi for all i. | C | 97a226f47973fcb39c40e16f66654b5f | f41e8a25d577cc6a24df00e83e038138 | GNU C11 | standard output | 256 megabytes | train_001.jsonl | [
"implementation",
"greedy"
] | 1447605300 | ["5\n1 2 3 4 5", "4\n1 2 2 1"] | NoteIn the first sample, Wilbur may successively choose indices 1, 2, 3, 4, and 5, and add 1 to corresponding suffixes.In the second sample, Wilbur first chooses indices 1 and 2 and adds 1 to corresponding suffixes, then he chooses index 4 and subtract 1. | PASSED | 1,100 | standard input | 2 seconds | The first line of the input contains a single integer n (1 ≤ n ≤ 200 000) — the length of the array ai. Initially ai = 0 for every position i, so this array is not given in the input. The second line of the input contains n integers b1, b2, ..., bn ( - 109 ≤ bi ≤ 109). | ["5", "3"] | #include<stdio.h>
#include<stdlib.h>
#include<math.h>
int main()
{
int n;
long long int res=0;
scanf("%d",&n);
int arr[n];
for(int i=0;i<n;i++)
{
scanf("%d",&arr[i]);
if(i==0)
res = abs(arr[i]);
else
res += abs(arr[i]-arr[i-1]);
}
printf("%... | |
Wilbur the pig is tinkering with arrays again. He has the array a1, a2, ..., an initially consisting of n zeros. At one step, he can choose any index i and either add 1 to all elements ai, ai + 1, ... , an or subtract 1 from all elements ai, ai + 1, ..., an. His goal is to end up with the array b1, b2, ..., bn. Of cour... | Print the minimum number of steps that Wilbur needs to make in order to achieve ai = bi for all i. | C | 97a226f47973fcb39c40e16f66654b5f | 4e2f720800cac58915806dbd5b72599e | GNU C11 | standard output | 256 megabytes | train_001.jsonl | [
"implementation",
"greedy"
] | 1447605300 | ["5\n1 2 3 4 5", "4\n1 2 2 1"] | NoteIn the first sample, Wilbur may successively choose indices 1, 2, 3, 4, and 5, and add 1 to corresponding suffixes.In the second sample, Wilbur first chooses indices 1 and 2 and adds 1 to corresponding suffixes, then he chooses index 4 and subtract 1. | PASSED | 1,100 | standard input | 2 seconds | The first line of the input contains a single integer n (1 ≤ n ≤ 200 000) — the length of the array ai. Initially ai = 0 for every position i, so this array is not given in the input. The second line of the input contains n integers b1, b2, ..., bn ( - 109 ≤ bi ≤ 109). | ["5", "3"] | #include <stdio.h>
#include <conio.h>
#include <math.h>
main()
{
int n;
scanf("%d",&n);
long long i,t,k;
long long b[n+1];
k=0;
for (i=0;i<n;i++)
scanf("%I64d",&b[i]);
b[-1]=0;
for(i=0;i<n;i++)
{t=abs(b[i]-b[i-1]);
k=k+t;
}
printf("%I64d",k);
} | |
Wilbur the pig is tinkering with arrays again. He has the array a1, a2, ..., an initially consisting of n zeros. At one step, he can choose any index i and either add 1 to all elements ai, ai + 1, ... , an or subtract 1 from all elements ai, ai + 1, ..., an. His goal is to end up with the array b1, b2, ..., bn. Of cour... | Print the minimum number of steps that Wilbur needs to make in order to achieve ai = bi for all i. | C | 97a226f47973fcb39c40e16f66654b5f | 4cdfc70da8e76d1fc34f0223ed460f22 | GNU C11 | standard output | 256 megabytes | train_001.jsonl | [
"implementation",
"greedy"
] | 1447605300 | ["5\n1 2 3 4 5", "4\n1 2 2 1"] | NoteIn the first sample, Wilbur may successively choose indices 1, 2, 3, 4, and 5, and add 1 to corresponding suffixes.In the second sample, Wilbur first chooses indices 1 and 2 and adds 1 to corresponding suffixes, then he chooses index 4 and subtract 1. | PASSED | 1,100 | standard input | 2 seconds | The first line of the input contains a single integer n (1 ≤ n ≤ 200 000) — the length of the array ai. Initially ai = 0 for every position i, so this array is not given in the input. The second line of the input contains n integers b1, b2, ..., bn ( - 109 ≤ bi ≤ 109). | ["5", "3"] | #include<stdio.h>
#include<stdlib.h>
int main()
{
int n,i;
long long total=0;
scanf("%d",&n);
int b[n];
for(i=0;i<n;i++)
{
scanf("%d",&b[i]);
if(i==0)
total=abs(b[i]);
else
{
total+=abs(b[i]-b[i-1]);
}
}
printf("%lld",total);
}
| |
Wilbur the pig is tinkering with arrays again. He has the array a1, a2, ..., an initially consisting of n zeros. At one step, he can choose any index i and either add 1 to all elements ai, ai + 1, ... , an or subtract 1 from all elements ai, ai + 1, ..., an. His goal is to end up with the array b1, b2, ..., bn. Of cour... | Print the minimum number of steps that Wilbur needs to make in order to achieve ai = bi for all i. | C | 97a226f47973fcb39c40e16f66654b5f | 98650b73d6462fd5533020d3d82adc43 | GNU C11 | standard output | 256 megabytes | train_001.jsonl | [
"implementation",
"greedy"
] | 1447605300 | ["5\n1 2 3 4 5", "4\n1 2 2 1"] | NoteIn the first sample, Wilbur may successively choose indices 1, 2, 3, 4, and 5, and add 1 to corresponding suffixes.In the second sample, Wilbur first chooses indices 1 and 2 and adds 1 to corresponding suffixes, then he chooses index 4 and subtract 1. | PASSED | 1,100 | standard input | 2 seconds | The first line of the input contains a single integer n (1 ≤ n ≤ 200 000) — the length of the array ai. Initially ai = 0 for every position i, so this array is not given in the input. The second line of the input contains n integers b1, b2, ..., bn ( - 109 ≤ bi ≤ 109). | ["5", "3"] | #include <stdio.h>
int main()
{
long long int arr[200006];
long long int i, j, n,p=0, x=0;
scanf("%I64d", &n);
for(i=0; i<n; i++){
scanf("%I64d", &arr[i]);
if(arr[i]>p){
j=arr[i]-p;
x+=j;
p+=j;
}else{
j=p-arr[i];
x+=j;
... | |
There are $$$n$$$ students standing in a circle in some order. The index of the $$$i$$$-th student is $$$p_i$$$. It is guaranteed that all indices of students are distinct integers from $$$1$$$ to $$$n$$$ (i. e. they form a permutation).Students want to start a round dance. A clockwise round dance can be started if the... | For each query, print the answer on it. If a round dance can be started with the given order of students, print "YES". Otherwise print "NO". | C | b27436086ead93397be748d8ebdbf19a | a588b26f0f9f9c7258cf5502a3797c79 | GNU C11 | standard output | 256 megabytes | train_001.jsonl | [
"implementation"
] | 1565706900 | ["5\n4\n1 2 3 4\n3\n1 3 2\n5\n1 2 3 5 4\n1\n1\n5\n3 2 1 5 4"] | null | PASSED | 1,000 | standard input | 2 seconds | The first line of the input contains one integer $$$q$$$ ($$$1 \le q \le 200$$$) — the number of queries. Then $$$q$$$ queries follow. The first line of the query contains one integer $$$n$$$ ($$$1 \le n \le 200$$$) — the number of students. The second line of the query contains a permutation of indices $$$p_1, p_2, \d... | ["YES\nYES\nNO\nYES\nYES"] | #include <stdio.h>
#define MAX 500
int main() {
int q, n;
scanf("%d", &q);
for (int i = 0; i < q; i++) {
scanf("%d", &n);
int students[MAX] = {0};
int x, j;
for (j = 0; j < n; j++) {
scanf("%d", &students[j]);
if (students[j] == 1) x = j;
... | |
There are $$$n$$$ students standing in a circle in some order. The index of the $$$i$$$-th student is $$$p_i$$$. It is guaranteed that all indices of students are distinct integers from $$$1$$$ to $$$n$$$ (i. e. they form a permutation).Students want to start a round dance. A clockwise round dance can be started if the... | For each query, print the answer on it. If a round dance can be started with the given order of students, print "YES". Otherwise print "NO". | C | b27436086ead93397be748d8ebdbf19a | 827f0a9c2b27f9cb29722bf86b22219b | GNU C11 | standard output | 256 megabytes | train_001.jsonl | [
"implementation"
] | 1565706900 | ["5\n4\n1 2 3 4\n3\n1 3 2\n5\n1 2 3 5 4\n1\n1\n5\n3 2 1 5 4"] | null | PASSED | 1,000 | standard input | 2 seconds | The first line of the input contains one integer $$$q$$$ ($$$1 \le q \le 200$$$) — the number of queries. Then $$$q$$$ queries follow. The first line of the query contains one integer $$$n$$$ ($$$1 \le n \le 200$$$) — the number of students. The second line of the query contains a permutation of indices $$$p_1, p_2, \d... | ["YES\nYES\nNO\nYES\nYES"] | #include<stdio.h>
#include<stdlib.h>
int main()
{
int n,a[200],i,t,c=0;
scanf("%d",&t);
while(t--)
{
scanf("%d",&n);
for(i=0; i<n; i++)
scanf("%d",&a[i]);
if(abs(a[0]-a[n-1])!=1)
c++;
for(i=0; i<n-1; i++)
if(abs(a[i]-a[i+1])!=1)
... | |
There are $$$n$$$ students standing in a circle in some order. The index of the $$$i$$$-th student is $$$p_i$$$. It is guaranteed that all indices of students are distinct integers from $$$1$$$ to $$$n$$$ (i. e. they form a permutation).Students want to start a round dance. A clockwise round dance can be started if the... | For each query, print the answer on it. If a round dance can be started with the given order of students, print "YES". Otherwise print "NO". | C | b27436086ead93397be748d8ebdbf19a | 9f50afe7365c266f15ff90ae123c2249 | GNU C11 | standard output | 256 megabytes | train_001.jsonl | [
"implementation"
] | 1565706900 | ["5\n4\n1 2 3 4\n3\n1 3 2\n5\n1 2 3 5 4\n1\n1\n5\n3 2 1 5 4"] | null | PASSED | 1,000 | standard input | 2 seconds | The first line of the input contains one integer $$$q$$$ ($$$1 \le q \le 200$$$) — the number of queries. Then $$$q$$$ queries follow. The first line of the query contains one integer $$$n$$$ ($$$1 \le n \le 200$$$) — the number of students. The second line of the query contains a permutation of indices $$$p_1, p_2, \d... | ["YES\nYES\nNO\nYES\nYES"] | #include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <math.h>
int main()
{
int t,c,d;
int n;
int a[201], i;
scanf("%d", &t);
while (t--)
{
c = 0;
d = 0;
scanf("%d", &n);
for (i = 0; i < n; i++)
{
scanf("%d", &a[i]);
}
for (i = 0; i < n - 1; i++)
{
if (a[i] > a[i + 1])
... | |
There are $$$n$$$ students standing in a circle in some order. The index of the $$$i$$$-th student is $$$p_i$$$. It is guaranteed that all indices of students are distinct integers from $$$1$$$ to $$$n$$$ (i. e. they form a permutation).Students want to start a round dance. A clockwise round dance can be started if the... | For each query, print the answer on it. If a round dance can be started with the given order of students, print "YES". Otherwise print "NO". | C | b27436086ead93397be748d8ebdbf19a | 3cade0be60dc37ddb3d66abba6d9ace1 | GNU C11 | standard output | 256 megabytes | train_001.jsonl | [
"implementation"
] | 1565706900 | ["5\n4\n1 2 3 4\n3\n1 3 2\n5\n1 2 3 5 4\n1\n1\n5\n3 2 1 5 4"] | null | PASSED | 1,000 | standard input | 2 seconds | The first line of the input contains one integer $$$q$$$ ($$$1 \le q \le 200$$$) — the number of queries. Then $$$q$$$ queries follow. The first line of the query contains one integer $$$n$$$ ($$$1 \le n \le 200$$$) — the number of students. The second line of the query contains a permutation of indices $$$p_1, p_2, \d... | ["YES\nYES\nNO\nYES\nYES"] | #include<stdio.h>
int main()
{
int q,w;
scanf("%d",&q);
for(w=1;w<=q;w++){
int a,m=0,k=0,j,t=0,i;
scanf("%d",&a);
int aa[a];
for(i=0;i<a;i++)
{
scanf("%d",&aa[i]);
}
for(i=1;i<a;i++)
{
if(aa[i]-aa[i-1]!=1)
m++;
}
for(i=1;i<a;i++)
{
if(aa[i-1]... | |
There are $$$n$$$ students standing in a circle in some order. The index of the $$$i$$$-th student is $$$p_i$$$. It is guaranteed that all indices of students are distinct integers from $$$1$$$ to $$$n$$$ (i. e. they form a permutation).Students want to start a round dance. A clockwise round dance can be started if the... | For each query, print the answer on it. If a round dance can be started with the given order of students, print "YES". Otherwise print "NO". | C | b27436086ead93397be748d8ebdbf19a | 2b1e629219f37076c520a31676b380e8 | GNU C11 | standard output | 256 megabytes | train_001.jsonl | [
"implementation"
] | 1565706900 | ["5\n4\n1 2 3 4\n3\n1 3 2\n5\n1 2 3 5 4\n1\n1\n5\n3 2 1 5 4"] | null | PASSED | 1,000 | standard input | 2 seconds | The first line of the input contains one integer $$$q$$$ ($$$1 \le q \le 200$$$) — the number of queries. Then $$$q$$$ queries follow. The first line of the query contains one integer $$$n$$$ ($$$1 \le n \le 200$$$) — the number of students. The second line of the query contains a permutation of indices $$$p_1, p_2, \d... | ["YES\nYES\nNO\nYES\nYES"] | #include <stdio.h>
int Q,n,a,x,c,b,j;
int main()
{
scanf("%d",&Q);
while(Q--)
{
scanf("%d%d",&n,&a);
x=a;c=0;
for(j=1;j<n;j++)
{
scanf("%d",&b);
if(abs(a-b)>1)c++;
a=b;
}
if(abs(x-a)>1)c++;
if(c>1)printf("%s\n","NO")... | |
There are $$$n$$$ students standing in a circle in some order. The index of the $$$i$$$-th student is $$$p_i$$$. It is guaranteed that all indices of students are distinct integers from $$$1$$$ to $$$n$$$ (i. e. they form a permutation).Students want to start a round dance. A clockwise round dance can be started if the... | For each query, print the answer on it. If a round dance can be started with the given order of students, print "YES". Otherwise print "NO". | C | b27436086ead93397be748d8ebdbf19a | 3fa6045f9b1ed2e2ca17fb3520c1ecd7 | GNU C11 | standard output | 256 megabytes | train_001.jsonl | [
"implementation"
] | 1565706900 | ["5\n4\n1 2 3 4\n3\n1 3 2\n5\n1 2 3 5 4\n1\n1\n5\n3 2 1 5 4"] | null | PASSED | 1,000 | standard input | 2 seconds | The first line of the input contains one integer $$$q$$$ ($$$1 \le q \le 200$$$) — the number of queries. Then $$$q$$$ queries follow. The first line of the query contains one integer $$$n$$$ ($$$1 \le n \le 200$$$) — the number of students. The second line of the query contains a permutation of indices $$$p_1, p_2, \d... | ["YES\nYES\nNO\nYES\nYES"] | #include <stdio.h>
int main() {
int girada, n, i, j, horario=1, antihorario=1, pessoa[205];
scanf("%d", &girada);
for (i=0; i<girada; i++) {
horario=1;
antihorario=1;
scanf("%d", &n);
for (j=0; j<n; j++) {
scanf("%d", &pessoa[j]);
if (j>0) {
//if pra saber se eh horario
if (pessoa[j]... | |
There are $$$n$$$ students standing in a circle in some order. The index of the $$$i$$$-th student is $$$p_i$$$. It is guaranteed that all indices of students are distinct integers from $$$1$$$ to $$$n$$$ (i. e. they form a permutation).Students want to start a round dance. A clockwise round dance can be started if the... | For each query, print the answer on it. If a round dance can be started with the given order of students, print "YES". Otherwise print "NO". | C | b27436086ead93397be748d8ebdbf19a | d065a26f3668720eadae78203e078400 | GNU C11 | standard output | 256 megabytes | train_001.jsonl | [
"implementation"
] | 1565706900 | ["5\n4\n1 2 3 4\n3\n1 3 2\n5\n1 2 3 5 4\n1\n1\n5\n3 2 1 5 4"] | null | PASSED | 1,000 | standard input | 2 seconds | The first line of the input contains one integer $$$q$$$ ($$$1 \le q \le 200$$$) — the number of queries. Then $$$q$$$ queries follow. The first line of the query contains one integer $$$n$$$ ($$$1 \le n \le 200$$$) — the number of students. The second line of the query contains a permutation of indices $$$p_1, p_2, \d... | ["YES\nYES\nNO\nYES\nYES"] | #include <stdio.h>
int eh_horario(int pessoa[], int pessoa_size, int pos) {
if (pos == pessoa_size-1) {
return 1;
} else if (pessoa[pos+1] == pessoa[pos] + 1) {
return eh_horario(pessoa, pessoa_size, pos+1);
} else if (pessoa[pos] == pessoa_size && pessoa[pos+1] == 1) {
return eh_horario(pessoa, pessoa_size, ... | |
There are $$$n$$$ students standing in a circle in some order. The index of the $$$i$$$-th student is $$$p_i$$$. It is guaranteed that all indices of students are distinct integers from $$$1$$$ to $$$n$$$ (i. e. they form a permutation).Students want to start a round dance. A clockwise round dance can be started if the... | For each query, print the answer on it. If a round dance can be started with the given order of students, print "YES". Otherwise print "NO". | C | b27436086ead93397be748d8ebdbf19a | 058324a1b79b38e8fc83a2444b4bd0e0 | GNU C11 | standard output | 256 megabytes | train_001.jsonl | [
"implementation"
] | 1565706900 | ["5\n4\n1 2 3 4\n3\n1 3 2\n5\n1 2 3 5 4\n1\n1\n5\n3 2 1 5 4"] | null | PASSED | 1,000 | standard input | 2 seconds | The first line of the input contains one integer $$$q$$$ ($$$1 \le q \le 200$$$) — the number of queries. Then $$$q$$$ queries follow. The first line of the query contains one integer $$$n$$$ ($$$1 \le n \le 200$$$) — the number of students. The second line of the query contains a permutation of indices $$$p_1, p_2, \d... | ["YES\nYES\nNO\nYES\nYES"] | #include <stdio.h>
int main(void) {
// your code goes here
int q,i,n;
scanf("%d", &q);
while(q--)
{
scanf("%d", &n);
int a,b,c=0;
scanf("%d", &b);
for(i=1;i<n;i++)
{scanf("%d", &a);
if(abs(a-b)>1&&abs(a-b)!=n-1)
c++;
b=a;}
if(c>0)
printf("NO\n");
else
... | |
There are $$$n$$$ students standing in a circle in some order. The index of the $$$i$$$-th student is $$$p_i$$$. It is guaranteed that all indices of students are distinct integers from $$$1$$$ to $$$n$$$ (i. e. they form a permutation).Students want to start a round dance. A clockwise round dance can be started if the... | For each query, print the answer on it. If a round dance can be started with the given order of students, print "YES". Otherwise print "NO". | C | b27436086ead93397be748d8ebdbf19a | 61be75868771b38bce608537bf130cf9 | GNU C11 | standard output | 256 megabytes | train_001.jsonl | [
"implementation"
] | 1565706900 | ["5\n4\n1 2 3 4\n3\n1 3 2\n5\n1 2 3 5 4\n1\n1\n5\n3 2 1 5 4"] | null | PASSED | 1,000 | standard input | 2 seconds | The first line of the input contains one integer $$$q$$$ ($$$1 \le q \le 200$$$) — the number of queries. Then $$$q$$$ queries follow. The first line of the query contains one integer $$$n$$$ ($$$1 \le n \le 200$$$) — the number of students. The second line of the query contains a permutation of indices $$$p_1, p_2, \d... | ["YES\nYES\nNO\nYES\nYES"] | #include<stdio.h>
int main()
{
int t,i,j,n,temp,test,diff,check;
scanf("%d",&t);
while(t--)
{
scanf("%d",&n);
int arr[n];
for(i=0;i<n;i++){
scanf("%d",&arr[i]);
}
temp=arr[0];
test=0;
for(i=1;i<n;i++){
diff=abs(temp-arr[... | |
There are $$$n$$$ students standing in a circle in some order. The index of the $$$i$$$-th student is $$$p_i$$$. It is guaranteed that all indices of students are distinct integers from $$$1$$$ to $$$n$$$ (i. e. they form a permutation).Students want to start a round dance. A clockwise round dance can be started if the... | For each query, print the answer on it. If a round dance can be started with the given order of students, print "YES". Otherwise print "NO". | C | b27436086ead93397be748d8ebdbf19a | fe022c08e69a9a75cd15bb0f26c8af6c | GNU C11 | standard output | 256 megabytes | train_001.jsonl | [
"implementation"
] | 1565706900 | ["5\n4\n1 2 3 4\n3\n1 3 2\n5\n1 2 3 5 4\n1\n1\n5\n3 2 1 5 4"] | null | PASSED | 1,000 | standard input | 2 seconds | The first line of the input contains one integer $$$q$$$ ($$$1 \le q \le 200$$$) — the number of queries. Then $$$q$$$ queries follow. The first line of the query contains one integer $$$n$$$ ($$$1 \le n \le 200$$$) — the number of students. The second line of the query contains a permutation of indices $$$p_1, p_2, \d... | ["YES\nYES\nNO\nYES\nYES"] | #include<stdio.h>
int main()
{
int n, q, i, j, c, a[201];
scanf("%d", &n);
for(i=1;i<=n;i++)
{
scanf("%d",&q);
for(j=0;j<q;j++)
{
scanf("%d", &a[j]);
}
if(q==1)
printf("YES\n");
else if(a[0]... | |
There are $$$n$$$ students standing in a circle in some order. The index of the $$$i$$$-th student is $$$p_i$$$. It is guaranteed that all indices of students are distinct integers from $$$1$$$ to $$$n$$$ (i. e. they form a permutation).Students want to start a round dance. A clockwise round dance can be started if the... | For each query, print the answer on it. If a round dance can be started with the given order of students, print "YES". Otherwise print "NO". | C | b27436086ead93397be748d8ebdbf19a | f6f0cbe7a9b41fb62317916c4e519da1 | GNU C11 | standard output | 256 megabytes | train_001.jsonl | [
"implementation"
] | 1565706900 | ["5\n4\n1 2 3 4\n3\n1 3 2\n5\n1 2 3 5 4\n1\n1\n5\n3 2 1 5 4"] | null | PASSED | 1,000 | standard input | 2 seconds | The first line of the input contains one integer $$$q$$$ ($$$1 \le q \le 200$$$) — the number of queries. Then $$$q$$$ queries follow. The first line of the query contains one integer $$$n$$$ ($$$1 \le n \le 200$$$) — the number of students. The second line of the query contains a permutation of indices $$$p_1, p_2, \d... | ["YES\nYES\nNO\nYES\nYES"] | #include<stdio.h>
int main(void){
int T;
scanf("%d",&T);
while(T--){
int n,no1=0,no2=0,out=0;
int i,a[250];
scanf("%d",&n);
for(i=1;i<=n;i++)
scanf("%d",&a[i]);
if(n>2){
for(i=1;i<=n-1;i++){
if(a[i]>=a[i+1]){
no1++;
}
if(a[i]<=a[i+1]){ /*no2 ... | |
There are $$$n$$$ students standing in a circle in some order. The index of the $$$i$$$-th student is $$$p_i$$$. It is guaranteed that all indices of students are distinct integers from $$$1$$$ to $$$n$$$ (i. e. they form a permutation).Students want to start a round dance. A clockwise round dance can be started if the... | For each query, print the answer on it. If a round dance can be started with the given order of students, print "YES". Otherwise print "NO". | C | b27436086ead93397be748d8ebdbf19a | 927af0eeecead3df3b09a6d99032d4d6 | GNU C11 | standard output | 256 megabytes | train_001.jsonl | [
"implementation"
] | 1565706900 | ["5\n4\n1 2 3 4\n3\n1 3 2\n5\n1 2 3 5 4\n1\n1\n5\n3 2 1 5 4"] | null | PASSED | 1,000 | standard input | 2 seconds | The first line of the input contains one integer $$$q$$$ ($$$1 \le q \le 200$$$) — the number of queries. Then $$$q$$$ queries follow. The first line of the query contains one integer $$$n$$$ ($$$1 \le n \le 200$$$) — the number of students. The second line of the query contains a permutation of indices $$$p_1, p_2, \d... | ["YES\nYES\nNO\nYES\nYES"] | #include<stdio.h>
#include<stdlib.h>
main()
{int i,j,n,x,*p;
scanf("%d",&n);
for(j=0;j<n;j++)
{ scanf("%d",&x);
int a[x],t=0;
p=&a[0];
for(i=0;i<x;i++)
{
scanf("%d",p+i);
}
for(i=0;i<x;i++)
if(abs(*(p+i)-*(p+i+1))==1 || abs(*(p+i)-*(p+i+1))==x-1)
t++;
if(t==x-1)
printf... | |
There are $$$n$$$ students standing in a circle in some order. The index of the $$$i$$$-th student is $$$p_i$$$. It is guaranteed that all indices of students are distinct integers from $$$1$$$ to $$$n$$$ (i. e. they form a permutation).Students want to start a round dance. A clockwise round dance can be started if the... | For each query, print the answer on it. If a round dance can be started with the given order of students, print "YES". Otherwise print "NO". | C | b27436086ead93397be748d8ebdbf19a | df134b1a571a44bb868b3db681ad9c20 | GNU C11 | standard output | 256 megabytes | train_001.jsonl | [
"implementation"
] | 1565706900 | ["5\n4\n1 2 3 4\n3\n1 3 2\n5\n1 2 3 5 4\n1\n1\n5\n3 2 1 5 4"] | null | PASSED | 1,000 | standard input | 2 seconds | The first line of the input contains one integer $$$q$$$ ($$$1 \le q \le 200$$$) — the number of queries. Then $$$q$$$ queries follow. The first line of the query contains one integer $$$n$$$ ($$$1 \le n \le 200$$$) — the number of students. The second line of the query contains a permutation of indices $$$p_1, p_2, \d... | ["YES\nYES\nNO\nYES\nYES"] | #include<stdio.h>
int main()
{
int ar[205]= {0},ar1[205]= {0},a,b,c,d,i,j;
scanf("%d",&a);
while(a--)
{
scanf("%d",&b);
for(i=1; i<=b; i++)
{
scanf("%d",&ar[i]);
}
int l=0;
for(i=1; i<=b*2; i++)
{
c=b;
int k=0;
... | |
There are $$$n$$$ students standing in a circle in some order. The index of the $$$i$$$-th student is $$$p_i$$$. It is guaranteed that all indices of students are distinct integers from $$$1$$$ to $$$n$$$ (i. e. they form a permutation).Students want to start a round dance. A clockwise round dance can be started if the... | For each query, print the answer on it. If a round dance can be started with the given order of students, print "YES". Otherwise print "NO". | C | b27436086ead93397be748d8ebdbf19a | abdc8d6647094e869094f315dfece112 | GNU C11 | standard output | 256 megabytes | train_001.jsonl | [
"implementation"
] | 1565706900 | ["5\n4\n1 2 3 4\n3\n1 3 2\n5\n1 2 3 5 4\n1\n1\n5\n3 2 1 5 4"] | null | PASSED | 1,000 | standard input | 2 seconds | The first line of the input contains one integer $$$q$$$ ($$$1 \le q \le 200$$$) — the number of queries. Then $$$q$$$ queries follow. The first line of the query contains one integer $$$n$$$ ($$$1 \le n \le 200$$$) — the number of students. The second line of the query contains a permutation of indices $$$p_1, p_2, \d... | ["YES\nYES\nNO\nYES\nYES"] | #include<stdio.h>
int main()
{
int q,i,n,p[201],j,c1,c2;
scanf("%d",&q);
for(i=0;i<q;i++)
{
c1=0,c2=0;
scanf("%d",&n);
for(j=0;j<n;j++)scanf("%d",&p[j]);
for(j=0;j<n;j++)
{
if(j!=n-1)
{
if(p[j]+1==p[j+1])c1++;
... | |
There are $$$n$$$ students standing in a circle in some order. The index of the $$$i$$$-th student is $$$p_i$$$. It is guaranteed that all indices of students are distinct integers from $$$1$$$ to $$$n$$$ (i. e. they form a permutation).Students want to start a round dance. A clockwise round dance can be started if the... | For each query, print the answer on it. If a round dance can be started with the given order of students, print "YES". Otherwise print "NO". | C | b27436086ead93397be748d8ebdbf19a | a9c304b549d0ba92eab1a6d70a935bdc | GNU C11 | standard output | 256 megabytes | train_001.jsonl | [
"implementation"
] | 1565706900 | ["5\n4\n1 2 3 4\n3\n1 3 2\n5\n1 2 3 5 4\n1\n1\n5\n3 2 1 5 4"] | null | PASSED | 1,000 | standard input | 2 seconds | The first line of the input contains one integer $$$q$$$ ($$$1 \le q \le 200$$$) — the number of queries. Then $$$q$$$ queries follow. The first line of the query contains one integer $$$n$$$ ($$$1 \le n \le 200$$$) — the number of students. The second line of the query contains a permutation of indices $$$p_1, p_2, \d... | ["YES\nYES\nNO\nYES\nYES"] | #include<stdio.h>
#include<stdlib.h>
#include<math.h>
int main()
{
int totalrep,nbrelem,nbr[200],tem=0;
scanf("%d",&totalrep);
for (int i = 0; i < totalrep; i++) {
scanf("%d",&nbrelem);
for (int j = 0; j < nbrelem; j++) {
scanf("%d",&nbr[j]);
}
if (nbrelem<=3) {
printf("YES... | |
There are $$$n$$$ students standing in a circle in some order. The index of the $$$i$$$-th student is $$$p_i$$$. It is guaranteed that all indices of students are distinct integers from $$$1$$$ to $$$n$$$ (i. e. they form a permutation).Students want to start a round dance. A clockwise round dance can be started if the... | For each query, print the answer on it. If a round dance can be started with the given order of students, print "YES". Otherwise print "NO". | C | b27436086ead93397be748d8ebdbf19a | 04da8244635681ad05387f27f6533894 | GNU C11 | standard output | 256 megabytes | train_001.jsonl | [
"implementation"
] | 1565706900 | ["5\n4\n1 2 3 4\n3\n1 3 2\n5\n1 2 3 5 4\n1\n1\n5\n3 2 1 5 4"] | null | PASSED | 1,000 | standard input | 2 seconds | The first line of the input contains one integer $$$q$$$ ($$$1 \le q \le 200$$$) — the number of queries. Then $$$q$$$ queries follow. The first line of the query contains one integer $$$n$$$ ($$$1 \le n \le 200$$$) — the number of students. The second line of the query contains a permutation of indices $$$p_1, p_2, \d... | ["YES\nYES\nNO\nYES\nYES"] | #include<stdio.h>
//顺时针圆圈舞
int isClockwise(int a[], int n){
for (int j = 0; j < n; j++){
int flag = 0;
for (int i = 0; i < n; i++){
if (a[i + j + 1] - a[i + j] != 1){
break;
}
else
flag++;
}
if (flag == n - 1)
return 1;
}
return 0;
}
//逆时针圆圈舞
int isCounterclockwise(int a[], int n){
f... | |
There are $$$n$$$ students standing in a circle in some order. The index of the $$$i$$$-th student is $$$p_i$$$. It is guaranteed that all indices of students are distinct integers from $$$1$$$ to $$$n$$$ (i. e. they form a permutation).Students want to start a round dance. A clockwise round dance can be started if the... | For each query, print the answer on it. If a round dance can be started with the given order of students, print "YES". Otherwise print "NO". | C | b27436086ead93397be748d8ebdbf19a | 67bf23b6a1d1fe2b98d8f0112869613d | GNU C11 | standard output | 256 megabytes | train_001.jsonl | [
"implementation"
] | 1565706900 | ["5\n4\n1 2 3 4\n3\n1 3 2\n5\n1 2 3 5 4\n1\n1\n5\n3 2 1 5 4"] | null | PASSED | 1,000 | standard input | 2 seconds | The first line of the input contains one integer $$$q$$$ ($$$1 \le q \le 200$$$) — the number of queries. Then $$$q$$$ queries follow. The first line of the query contains one integer $$$n$$$ ($$$1 \le n \le 200$$$) — the number of students. The second line of the query contains a permutation of indices $$$p_1, p_2, \d... | ["YES\nYES\nNO\nYES\nYES"] | #include <stdio.h>
int main()
{
int q, n, i, c, j, k; scanf("%d",&q);
while(q--)
{
scanf("%d",&n); int p[n]; c=0; j=0; k=0;
for(i=0;i<n;i++)
{
scanf("%d",&p[i]);
if(i!=0)
{
if(p[i]-p[i-1]==-1) k=-1;
else if(p[i]-p[i... | |
There are $$$n$$$ students standing in a circle in some order. The index of the $$$i$$$-th student is $$$p_i$$$. It is guaranteed that all indices of students are distinct integers from $$$1$$$ to $$$n$$$ (i. e. they form a permutation).Students want to start a round dance. A clockwise round dance can be started if the... | For each query, print the answer on it. If a round dance can be started with the given order of students, print "YES". Otherwise print "NO". | C | b27436086ead93397be748d8ebdbf19a | d5fece700927264bc89d57e392c45ee5 | GNU C11 | standard output | 256 megabytes | train_001.jsonl | [
"implementation"
] | 1565706900 | ["5\n4\n1 2 3 4\n3\n1 3 2\n5\n1 2 3 5 4\n1\n1\n5\n3 2 1 5 4"] | null | PASSED | 1,000 | standard input | 2 seconds | The first line of the input contains one integer $$$q$$$ ($$$1 \le q \le 200$$$) — the number of queries. Then $$$q$$$ queries follow. The first line of the query contains one integer $$$n$$$ ($$$1 \le n \le 200$$$) — the number of students. The second line of the query contains a permutation of indices $$$p_1, p_2, \d... | ["YES\nYES\nNO\nYES\nYES"] | #include<stdio.h>
int main()
{
int t,m;
scanf("%d",&t);
m=t-1;
int arr[t];
while(t--)
{
arr[t]=0;
int n,con=0;
scanf("%d",&n);
int ar[n*2];
for(int i=0;i<n;i++)
{
scanf("%d",&ar[i]);
ar[n+i]=ar[i];
}
if(n==1)
arr[t]=1;
else
{
if(ar[n-2]-ar... | |
There are $$$n$$$ students standing in a circle in some order. The index of the $$$i$$$-th student is $$$p_i$$$. It is guaranteed that all indices of students are distinct integers from $$$1$$$ to $$$n$$$ (i. e. they form a permutation).Students want to start a round dance. A clockwise round dance can be started if the... | For each query, print the answer on it. If a round dance can be started with the given order of students, print "YES". Otherwise print "NO". | C | b27436086ead93397be748d8ebdbf19a | 944d780b359afc22bfcaad62bd456218 | GNU C11 | standard output | 256 megabytes | train_001.jsonl | [
"implementation"
] | 1565706900 | ["5\n4\n1 2 3 4\n3\n1 3 2\n5\n1 2 3 5 4\n1\n1\n5\n3 2 1 5 4"] | null | PASSED | 1,000 | standard input | 2 seconds | The first line of the input contains one integer $$$q$$$ ($$$1 \le q \le 200$$$) — the number of queries. Then $$$q$$$ queries follow. The first line of the query contains one integer $$$n$$$ ($$$1 \le n \le 200$$$) — the number of students. The second line of the query contains a permutation of indices $$$p_1, p_2, \d... | ["YES\nYES\nNO\nYES\nYES"] | #include<stdio.h>
int main(){
int T,i;
scanf("%d",&T);
for(i=0;i<T;i++)
{
int n,j,p,k,s=0;
scanf("%d",&n);
int arr[n],flag=1;
for(j=0;j<n;j++)
scanf("%d",&arr[j]);
for(j=0;j<n;j++)
{
if(arr[j]==1)
{
k=j;
}
}
if(k<n-1&&k>0)
{
p=k;
... | |
There are $$$n$$$ students standing in a circle in some order. The index of the $$$i$$$-th student is $$$p_i$$$. It is guaranteed that all indices of students are distinct integers from $$$1$$$ to $$$n$$$ (i. e. they form a permutation).Students want to start a round dance. A clockwise round dance can be started if the... | For each query, print the answer on it. If a round dance can be started with the given order of students, print "YES". Otherwise print "NO". | C | b27436086ead93397be748d8ebdbf19a | b523993ff2760de2bd68d7f9a25c0a4c | GNU C11 | standard output | 256 megabytes | train_001.jsonl | [
"implementation"
] | 1565706900 | ["5\n4\n1 2 3 4\n3\n1 3 2\n5\n1 2 3 5 4\n1\n1\n5\n3 2 1 5 4"] | null | PASSED | 1,000 | standard input | 2 seconds | The first line of the input contains one integer $$$q$$$ ($$$1 \le q \le 200$$$) — the number of queries. Then $$$q$$$ queries follow. The first line of the query contains one integer $$$n$$$ ($$$1 \le n \le 200$$$) — the number of students. The second line of the query contains a permutation of indices $$$p_1, p_2, \d... | ["YES\nYES\nNO\nYES\nYES"] | #include <stdio.h>
typedef long long ll;
#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define min(l,r) ((l)<(r)?l:r)
int n,t;
int a[202];
int main(){
scanf("%d", &t);
rep(i,t){
scanf("%d", &n);
rep(i,n) scanf("%d", a+i);
int ok = 1;
if(n == 1){
if(a[0] == ... | |
There are $$$n$$$ students standing in a circle in some order. The index of the $$$i$$$-th student is $$$p_i$$$. It is guaranteed that all indices of students are distinct integers from $$$1$$$ to $$$n$$$ (i. e. they form a permutation).Students want to start a round dance. A clockwise round dance can be started if the... | For each query, print the answer on it. If a round dance can be started with the given order of students, print "YES". Otherwise print "NO". | C | b27436086ead93397be748d8ebdbf19a | 3c615c84dcb5c44ffdd96182f8f96848 | GNU C11 | standard output | 256 megabytes | train_001.jsonl | [
"implementation"
] | 1565706900 | ["5\n4\n1 2 3 4\n3\n1 3 2\n5\n1 2 3 5 4\n1\n1\n5\n3 2 1 5 4"] | null | PASSED | 1,000 | standard input | 2 seconds | The first line of the input contains one integer $$$q$$$ ($$$1 \le q \le 200$$$) — the number of queries. Then $$$q$$$ queries follow. The first line of the query contains one integer $$$n$$$ ($$$1 \le n \le 200$$$) — the number of students. The second line of the query contains a permutation of indices $$$p_1, p_2, \d... | ["YES\nYES\nNO\nYES\nYES"] | #include <stdio.h>
#include <math.h>
int a[210];
void solve() {
int n;
scanf("%d", &n);
for (int i = 0; i < n; i++) scanf("%d", &a[i]);
int cnt = 0;
for (int i = 0; i < n - 1; i++) {
if (abs(a[i] - a[i + 1]) != 1) cnt++;
}
if (abs(a[n - 1] - a[0]) != 1) cnt++;
printf("%s\n", (c... | |
There are $$$n$$$ students standing in a circle in some order. The index of the $$$i$$$-th student is $$$p_i$$$. It is guaranteed that all indices of students are distinct integers from $$$1$$$ to $$$n$$$ (i. e. they form a permutation).Students want to start a round dance. A clockwise round dance can be started if the... | For each query, print the answer on it. If a round dance can be started with the given order of students, print "YES". Otherwise print "NO". | C | b27436086ead93397be748d8ebdbf19a | 546e136f0e4e246a7908955c560487f0 | GNU C11 | standard output | 256 megabytes | train_001.jsonl | [
"implementation"
] | 1565706900 | ["5\n4\n1 2 3 4\n3\n1 3 2\n5\n1 2 3 5 4\n1\n1\n5\n3 2 1 5 4"] | null | PASSED | 1,000 | standard input | 2 seconds | The first line of the input contains one integer $$$q$$$ ($$$1 \le q \le 200$$$) — the number of queries. Then $$$q$$$ queries follow. The first line of the query contains one integer $$$n$$$ ($$$1 \le n \le 200$$$) — the number of students. The second line of the query contains a permutation of indices $$$p_1, p_2, \d... | ["YES\nYES\nNO\nYES\nYES"] | #include <stdio.h>
#include <stdlib.h>
int a[210], n;
int main(){
int q;
scanf("%d", &q);
while(q--){
int cnt = 0, ok = 1;
scanf("%d", &n);
for(int i = 0; i < n; i++) scanf("%d", &a[i]);
for(int i = 0; i < n - 1; i++){
if(abs(a[i] - a[i + 1]) != 1) cnt++;
... | |
There are $$$n$$$ students standing in a circle in some order. The index of the $$$i$$$-th student is $$$p_i$$$. It is guaranteed that all indices of students are distinct integers from $$$1$$$ to $$$n$$$ (i. e. they form a permutation).Students want to start a round dance. A clockwise round dance can be started if the... | For each query, print the answer on it. If a round dance can be started with the given order of students, print "YES". Otherwise print "NO". | C | b27436086ead93397be748d8ebdbf19a | a09cbe6663d92d9078e8a92065e22320 | GNU C11 | standard output | 256 megabytes | train_001.jsonl | [
"implementation"
] | 1565706900 | ["5\n4\n1 2 3 4\n3\n1 3 2\n5\n1 2 3 5 4\n1\n1\n5\n3 2 1 5 4"] | null | PASSED | 1,000 | standard input | 2 seconds | The first line of the input contains one integer $$$q$$$ ($$$1 \le q \le 200$$$) — the number of queries. Then $$$q$$$ queries follow. The first line of the query contains one integer $$$n$$$ ($$$1 \le n \le 200$$$) — the number of students. The second line of the query contains a permutation of indices $$$p_1, p_2, \d... | ["YES\nYES\nNO\nYES\nYES"] | #include<stdio.h>
int main(void){
int T;
scanf("%d",&T);
while(T--){
int n,no1=0,no2=0,out=0;
int i,a[250];
scanf("%d",&n);
for(i=1;i<=n;i++)
scanf("%d",&a[i]);
if(n>2){
for(i=1;i<=n-1;i++){
if(a[i]!=a[i+1]+1){
no1++;
}
if(a[i]!=a[i+1]-1){ /*no2 ... | |
There are $$$n$$$ students standing in a circle in some order. The index of the $$$i$$$-th student is $$$p_i$$$. It is guaranteed that all indices of students are distinct integers from $$$1$$$ to $$$n$$$ (i. e. they form a permutation).Students want to start a round dance. A clockwise round dance can be started if the... | For each query, print the answer on it. If a round dance can be started with the given order of students, print "YES". Otherwise print "NO". | C | b27436086ead93397be748d8ebdbf19a | 487b00f96666d183572fecf31124f79b | GNU C11 | standard output | 256 megabytes | train_001.jsonl | [
"implementation"
] | 1565706900 | ["5\n4\n1 2 3 4\n3\n1 3 2\n5\n1 2 3 5 4\n1\n1\n5\n3 2 1 5 4"] | null | PASSED | 1,000 | standard input | 2 seconds | The first line of the input contains one integer $$$q$$$ ($$$1 \le q \le 200$$$) — the number of queries. Then $$$q$$$ queries follow. The first line of the query contains one integer $$$n$$$ ($$$1 \le n \le 200$$$) — the number of students. The second line of the query contains a permutation of indices $$$p_1, p_2, \d... | ["YES\nYES\nNO\nYES\nYES"] |
#include<stdio.h>
int query[205];
int main() {
int T;
scanf("%d", &T);
while (T--) {
int num;
scanf("%d", &num);
int fst,up=0,down=0;
scanf("%d", &query[1]);
for (int i = 2; i <= num; i++) {
scanf("%d", &query[i]);
if (query[i] - query[i - 1] > 0) up++;
else down++;
}
if (query[1] - query[nu... | |
There are $$$n$$$ students standing in a circle in some order. The index of the $$$i$$$-th student is $$$p_i$$$. It is guaranteed that all indices of students are distinct integers from $$$1$$$ to $$$n$$$ (i. e. they form a permutation).Students want to start a round dance. A clockwise round dance can be started if the... | For each query, print the answer on it. If a round dance can be started with the given order of students, print "YES". Otherwise print "NO". | C | b27436086ead93397be748d8ebdbf19a | 24070494961b1e1656ba86d0165a1907 | GNU C11 | standard output | 256 megabytes | train_001.jsonl | [
"implementation"
] | 1565706900 | ["5\n4\n1 2 3 4\n3\n1 3 2\n5\n1 2 3 5 4\n1\n1\n5\n3 2 1 5 4"] | null | PASSED | 1,000 | standard input | 2 seconds | The first line of the input contains one integer $$$q$$$ ($$$1 \le q \le 200$$$) — the number of queries. Then $$$q$$$ queries follow. The first line of the query contains one integer $$$n$$$ ($$$1 \le n \le 200$$$) — the number of students. The second line of the query contains a permutation of indices $$$p_1, p_2, \d... | ["YES\nYES\nNO\nYES\nYES"] | #include<stdio.h>
int main()
{
int i , q , n;
scanf("%d",&q);
while(q>0)
{
int flag = 0 ;
scanf("%d",&n);
int arr[n];
for(i=1;i<=n;i++)
{
scanf("%d",&arr[i]);
}
for(i=1;i<=n-1;i++)
{
if( (arr[i+1]==arr[i]+1) || ... | |
There are $$$n$$$ students standing in a circle in some order. The index of the $$$i$$$-th student is $$$p_i$$$. It is guaranteed that all indices of students are distinct integers from $$$1$$$ to $$$n$$$ (i. e. they form a permutation).Students want to start a round dance. A clockwise round dance can be started if the... | For each query, print the answer on it. If a round dance can be started with the given order of students, print "YES". Otherwise print "NO". | C | b27436086ead93397be748d8ebdbf19a | 5844cd7df660308a3161b127e531e276 | GNU C11 | standard output | 256 megabytes | train_001.jsonl | [
"implementation"
] | 1565706900 | ["5\n4\n1 2 3 4\n3\n1 3 2\n5\n1 2 3 5 4\n1\n1\n5\n3 2 1 5 4"] | null | PASSED | 1,000 | standard input | 2 seconds | The first line of the input contains one integer $$$q$$$ ($$$1 \le q \le 200$$$) — the number of queries. Then $$$q$$$ queries follow. The first line of the query contains one integer $$$n$$$ ($$$1 \le n \le 200$$$) — the number of students. The second line of the query contains a permutation of indices $$$p_1, p_2, \d... | ["YES\nYES\nNO\nYES\nYES"] | #include<stdio.h>
#include<math.h>
int main()
{
int n, a[202];
int i=0,j=0,flag=0;
int t=0,temp=0,m;
scanf("%d",&m);
for(j=0;j<m;j++){
scanf("%d",&n);
for(i=0;i<n;i++)
scanf("%d",&a[i]);
flag=0;
i=0;
temp=0;
while(flag<n)
{
t=i+1;
if( t>=n)
{//i=i%n;
t=t%n;
}
if(abs(... | |
There are $$$n$$$ students standing in a circle in some order. The index of the $$$i$$$-th student is $$$p_i$$$. It is guaranteed that all indices of students are distinct integers from $$$1$$$ to $$$n$$$ (i. e. they form a permutation).Students want to start a round dance. A clockwise round dance can be started if the... | For each query, print the answer on it. If a round dance can be started with the given order of students, print "YES". Otherwise print "NO". | C | b27436086ead93397be748d8ebdbf19a | 8e8ba3f4597d851021d37311c7ae9b55 | GNU C11 | standard output | 256 megabytes | train_001.jsonl | [
"implementation"
] | 1565706900 | ["5\n4\n1 2 3 4\n3\n1 3 2\n5\n1 2 3 5 4\n1\n1\n5\n3 2 1 5 4"] | null | PASSED | 1,000 | standard input | 2 seconds | The first line of the input contains one integer $$$q$$$ ($$$1 \le q \le 200$$$) — the number of queries. Then $$$q$$$ queries follow. The first line of the query contains one integer $$$n$$$ ($$$1 \le n \le 200$$$) — the number of students. The second line of the query contains a permutation of indices $$$p_1, p_2, \d... | ["YES\nYES\nNO\nYES\nYES"] | #include <stdio.h>
int main() {
int n;
scanf("%d",&n);
while(n--){
int i,p, c =0, cc =0;
scanf("%d",&p);
int a[p];
for(i =0; i < p; i++)
scanf("%d",&a[i]);
for(i =0; i< p-1; i++){
if(a[i] == a[i+1] + 1)
c++;
else if(a[i+1] == a[i]+1)
... | |
There are $$$n$$$ students standing in a circle in some order. The index of the $$$i$$$-th student is $$$p_i$$$. It is guaranteed that all indices of students are distinct integers from $$$1$$$ to $$$n$$$ (i. e. they form a permutation).Students want to start a round dance. A clockwise round dance can be started if the... | For each query, print the answer on it. If a round dance can be started with the given order of students, print "YES". Otherwise print "NO". | C | b27436086ead93397be748d8ebdbf19a | b55f3903b2380eb96ea0042f3fbad471 | GNU C11 | standard output | 256 megabytes | train_001.jsonl | [
"implementation"
] | 1565706900 | ["5\n4\n1 2 3 4\n3\n1 3 2\n5\n1 2 3 5 4\n1\n1\n5\n3 2 1 5 4"] | null | PASSED | 1,000 | standard input | 2 seconds | The first line of the input contains one integer $$$q$$$ ($$$1 \le q \le 200$$$) — the number of queries. Then $$$q$$$ queries follow. The first line of the query contains one integer $$$n$$$ ($$$1 \le n \le 200$$$) — the number of students. The second line of the query contains a permutation of indices $$$p_1, p_2, \d... | ["YES\nYES\nNO\nYES\nYES"] | #include<stdio.h>
int main()
{
int t,i,n,k,j=1,l=1,z=0;
scanf("%d",&t);
for(i=0;i<t;i++)
{
scanf("%d",&n);
int A[n];
for(k=0;k<n;k++)
{
scanf("%d",&A[k]);
if(A[k]-A[k-1]==1&&j==1)
{
j=1;
l=0;
... | |
There are $$$n$$$ students standing in a circle in some order. The index of the $$$i$$$-th student is $$$p_i$$$. It is guaranteed that all indices of students are distinct integers from $$$1$$$ to $$$n$$$ (i. e. they form a permutation).Students want to start a round dance. A clockwise round dance can be started if the... | For each query, print the answer on it. If a round dance can be started with the given order of students, print "YES". Otherwise print "NO". | C | b27436086ead93397be748d8ebdbf19a | 817900c3884eb85b9bb9497161215dbb | GNU C11 | standard output | 256 megabytes | train_001.jsonl | [
"implementation"
] | 1565706900 | ["5\n4\n1 2 3 4\n3\n1 3 2\n5\n1 2 3 5 4\n1\n1\n5\n3 2 1 5 4"] | null | PASSED | 1,000 | standard input | 2 seconds | The first line of the input contains one integer $$$q$$$ ($$$1 \le q \le 200$$$) — the number of queries. Then $$$q$$$ queries follow. The first line of the query contains one integer $$$n$$$ ($$$1 \le n \le 200$$$) — the number of students. The second line of the query contains a permutation of indices $$$p_1, p_2, \d... | ["YES\nYES\nNO\nYES\nYES"] | #include <stdio.h>
int main(void) {
int q;
//printf("Enter the number of queries " );
scanf("%d",&q);
int i,j;
int n,flag=0;
for(i=0;i<q;i++)
{
flag=0;
// printf("Enter the number of students");
scanf("%d",&n);
int p[n];
//printf("Enter the index of the students");
for(j=0; j<n; j++)
{
scanf... | |
There are $$$n$$$ students standing in a circle in some order. The index of the $$$i$$$-th student is $$$p_i$$$. It is guaranteed that all indices of students are distinct integers from $$$1$$$ to $$$n$$$ (i. e. they form a permutation).Students want to start a round dance. A clockwise round dance can be started if the... | For each query, print the answer on it. If a round dance can be started with the given order of students, print "YES". Otherwise print "NO". | C | b27436086ead93397be748d8ebdbf19a | 3380229617cb147e4165b01d3b9fd57b | GNU C11 | standard output | 256 megabytes | train_001.jsonl | [
"implementation"
] | 1565706900 | ["5\n4\n1 2 3 4\n3\n1 3 2\n5\n1 2 3 5 4\n1\n1\n5\n3 2 1 5 4"] | null | PASSED | 1,000 | standard input | 2 seconds | The first line of the input contains one integer $$$q$$$ ($$$1 \le q \le 200$$$) — the number of queries. Then $$$q$$$ queries follow. The first line of the query contains one integer $$$n$$$ ($$$1 \le n \le 200$$$) — the number of students. The second line of the query contains a permutation of indices $$$p_1, p_2, \d... | ["YES\nYES\nNO\nYES\nYES"] | /// IMTMTO...
#include<stdio.h>
#include<stdlib.h>
void test()
{
int n;
scanf("%d",&n);
int a[n],i;
for(i=0;i<n;i++){
scanf("%d",&a[i]);
}
for(i=1;i<n;i++){
if(abs(a[i]-a[i-1])!=1 && abs(a[i]-a[i-1])!=n-1){
printf("NO\n");
r... | |
You are given an n × m rectangular table consisting of lower case English letters. In one operation you can completely remove one column from the table. The remaining parts are combined forming a new table. For example, after removing the second column from the tableabcdedfghijk we obtain the table:acdefghjk A table is... | Print a single number — the minimum number of columns that you need to remove in order to make the table good. | C | a45cfc2855f82f162133930d9834a9f0 | 771b062c62781698a3a6cf5d63311bfa | GNU C | standard output | 256 megabytes | train_001.jsonl | [
"constructive algorithms",
"implementation",
"brute force"
] | 1418833800 | ["1 10\ncodeforces", "4 4\ncase\ncare\ntest\ncode", "5 4\ncode\nforc\nesco\ndefo\nrces"] | NoteIn the first sample the table is already good.In the second sample you may remove the first and third column.In the third sample you have to remove all the columns (note that the table where all rows are empty is considered good by definition).Let strings s and t have equal length. Then, s is lexicographically larg... | PASSED | 1,500 | standard input | 2 seconds | The first line contains two integers — n and m (1 ≤ n, m ≤ 100). Next n lines contain m small English letters each — the characters of the table. | ["0", "2", "4"] | #include <stdio.h>
#include <string.h>
char s[110][110];
int a[110];
int main()
{
int n,m,c=0;
memset(a,0,sizeof(a));
scanf("%d%d",&n,&m);
int i,j,k,l;
for(i=0;i<n;i++) {
scanf(" %s",s[i]);
}
for(i=0;i<m;i++) {
for(j=0;j<n-1;j++) {
if(s[j][i]>s[j+1][i]) ... | |
You are given an n × m rectangular table consisting of lower case English letters. In one operation you can completely remove one column from the table. The remaining parts are combined forming a new table. For example, after removing the second column from the tableabcdedfghijk we obtain the table:acdefghjk A table is... | Print a single number — the minimum number of columns that you need to remove in order to make the table good. | C | a45cfc2855f82f162133930d9834a9f0 | eb6cdebdd72791d6f86540e01d1c8217 | GNU C | standard output | 256 megabytes | train_001.jsonl | [
"constructive algorithms",
"implementation",
"brute force"
] | 1418833800 | ["1 10\ncodeforces", "4 4\ncase\ncare\ntest\ncode", "5 4\ncode\nforc\nesco\ndefo\nrces"] | NoteIn the first sample the table is already good.In the second sample you may remove the first and third column.In the third sample you have to remove all the columns (note that the table where all rows are empty is considered good by definition).Let strings s and t have equal length. Then, s is lexicographically larg... | PASSED | 1,500 | standard input | 2 seconds | The first line contains two integers — n and m (1 ≤ n, m ≤ 100). Next n lines contain m small English letters each — the characters of the table. | ["0", "2", "4"] | #include<stdio.h>
#include<string.h>
int main()
{
char a[105][105];
int i,j,k,l,n,m,vis[101],count=0;
scanf("%d%d",&n,&m);
for(i=0;i<n;i++)
{
scanf("%s",&a[i]);
}
for(i=0;i<101;i++)
vis[i]=0;
for(i=0;i<m;i++)
{
for(j=1;j<n;j++)
{
if(!vis[j]... | |
You are given an n × m rectangular table consisting of lower case English letters. In one operation you can completely remove one column from the table. The remaining parts are combined forming a new table. For example, after removing the second column from the tableabcdedfghijk we obtain the table:acdefghjk A table is... | Print a single number — the minimum number of columns that you need to remove in order to make the table good. | C | a45cfc2855f82f162133930d9834a9f0 | fc698e15f547a38a05feb22eef3411f4 | GNU C | standard output | 256 megabytes | train_001.jsonl | [
"constructive algorithms",
"implementation",
"brute force"
] | 1418833800 | ["1 10\ncodeforces", "4 4\ncase\ncare\ntest\ncode", "5 4\ncode\nforc\nesco\ndefo\nrces"] | NoteIn the first sample the table is already good.In the second sample you may remove the first and third column.In the third sample you have to remove all the columns (note that the table where all rows are empty is considered good by definition).Let strings s and t have equal length. Then, s is lexicographically larg... | PASSED | 1,500 | standard input | 2 seconds | The first line contains two integers — n and m (1 ≤ n, m ≤ 100). Next n lines contain m small English letters each — the characters of the table. | ["0", "2", "4"] | #include <stdio.h>
char Valid[100];
int main()
{
char Map[100][101];
int N, M, i, j, Ans;
scanf("%d %d", &N, &M);
for(i = 0; i < N; ++i)
{
scanf("%s", Map[i]);
}
for(Ans = j = 0; j < M; ++j)
{
int flag = 0;
for(i = 0; i < N - 1; ++i)
{
if(Map... | |
You are given an n × m rectangular table consisting of lower case English letters. In one operation you can completely remove one column from the table. The remaining parts are combined forming a new table. For example, after removing the second column from the tableabcdedfghijk we obtain the table:acdefghjk A table is... | Print a single number — the minimum number of columns that you need to remove in order to make the table good. | C | a45cfc2855f82f162133930d9834a9f0 | c4a85d93656edad4d20496b1fcabdbab | GNU C | standard output | 256 megabytes | train_001.jsonl | [
"constructive algorithms",
"implementation",
"brute force"
] | 1418833800 | ["1 10\ncodeforces", "4 4\ncase\ncare\ntest\ncode", "5 4\ncode\nforc\nesco\ndefo\nrces"] | NoteIn the first sample the table is already good.In the second sample you may remove the first and third column.In the third sample you have to remove all the columns (note that the table where all rows are empty is considered good by definition).Let strings s and t have equal length. Then, s is lexicographically larg... | PASSED | 1,500 | standard input | 2 seconds | The first line contains two integers — n and m (1 ≤ n, m ≤ 100). Next n lines contain m small English letters each — the characters of the table. | ["0", "2", "4"] | /*
* 1.这个程序做到的事情
* 2.这个程序遇到的困难
* 3.接下来要做的事情
*/
#include<stdio.h>
#define N 102
int main() {
int n,m;
scanf("%d%d",&n,&m);
char table[N][N];
int i,j;
for(i=0;i<n;i++){
scanf("%s",table[i]);
}
int delete=0;
int check[N];
int tmp_check[N];
for(i=0;i<n;i++){
check... | |
You are given an n × m rectangular table consisting of lower case English letters. In one operation you can completely remove one column from the table. The remaining parts are combined forming a new table. For example, after removing the second column from the tableabcdedfghijk we obtain the table:acdefghjk A table is... | Print a single number — the minimum number of columns that you need to remove in order to make the table good. | C | a45cfc2855f82f162133930d9834a9f0 | 6e4e20d7ef5760d5b7dc3198f6a30cac | GNU C | standard output | 256 megabytes | train_001.jsonl | [
"constructive algorithms",
"implementation",
"brute force"
] | 1418833800 | ["1 10\ncodeforces", "4 4\ncase\ncare\ntest\ncode", "5 4\ncode\nforc\nesco\ndefo\nrces"] | NoteIn the first sample the table is already good.In the second sample you may remove the first and third column.In the third sample you have to remove all the columns (note that the table where all rows are empty is considered good by definition).Let strings s and t have equal length. Then, s is lexicographically larg... | PASSED | 1,500 | standard input | 2 seconds | The first line contains two integers — n and m (1 ≤ n, m ≤ 100). Next n lines contain m small English letters each — the characters of the table. | ["0", "2", "4"] | /***************
* problem496C.c
**************/
/*******************************************************************************
* MAC0327 -- Aula01 -- 2015.08.03 -- IME/USP -- Prof. Cris
* Aluno: Marcello Souza de Oliveira
* Numero USP: 6432692
* Curso: Bacharelado em Ciencias da Computacao
* Compilador: gcc l... | |
You are given an n × m rectangular table consisting of lower case English letters. In one operation you can completely remove one column from the table. The remaining parts are combined forming a new table. For example, after removing the second column from the tableabcdedfghijk we obtain the table:acdefghjk A table is... | Print a single number — the minimum number of columns that you need to remove in order to make the table good. | C | a45cfc2855f82f162133930d9834a9f0 | b61f9553cc27104739e80d8f109ff14f | GNU C | standard output | 256 megabytes | train_001.jsonl | [
"constructive algorithms",
"implementation",
"brute force"
] | 1418833800 | ["1 10\ncodeforces", "4 4\ncase\ncare\ntest\ncode", "5 4\ncode\nforc\nesco\ndefo\nrces"] | NoteIn the first sample the table is already good.In the second sample you may remove the first and third column.In the third sample you have to remove all the columns (note that the table where all rows are empty is considered good by definition).Let strings s and t have equal length. Then, s is lexicographically larg... | PASSED | 1,500 | standard input | 2 seconds | The first line contains two integers — n and m (1 ≤ n, m ≤ 100). Next n lines contain m small English letters each — the characters of the table. | ["0", "2", "4"] | /***************
* problem496C.c
**************/
/*******************************************************************************
* MAC0327 -- Aula01 -- 2015.08.03 -- IME/USP -- Prof. Cris
* Aluno: Marcello Souza de Oliveira
* Numero USP: 6432692
* Curso: Bacharelado em Ciencias da Computacao
* Compilador: gcc l... | |
You are given an n × m rectangular table consisting of lower case English letters. In one operation you can completely remove one column from the table. The remaining parts are combined forming a new table. For example, after removing the second column from the tableabcdedfghijk we obtain the table:acdefghjk A table is... | Print a single number — the minimum number of columns that you need to remove in order to make the table good. | C | a45cfc2855f82f162133930d9834a9f0 | b27eb3a1b36edd57ca9743919b8229e8 | GNU C | standard output | 256 megabytes | train_001.jsonl | [
"constructive algorithms",
"implementation",
"brute force"
] | 1418833800 | ["1 10\ncodeforces", "4 4\ncase\ncare\ntest\ncode", "5 4\ncode\nforc\nesco\ndefo\nrces"] | NoteIn the first sample the table is already good.In the second sample you may remove the first and third column.In the third sample you have to remove all the columns (note that the table where all rows are empty is considered good by definition).Let strings s and t have equal length. Then, s is lexicographically larg... | PASSED | 1,500 | standard input | 2 seconds | The first line contains two integers — n and m (1 ≤ n, m ≤ 100). Next n lines contain m small English letters each — the characters of the table. | ["0", "2", "4"] | /***************
* problem496C.c
**************/
/*******************************************************************************
* MAC0327 -- Aula01 -- 2015.08.03 -- IME/USP -- Prof. Cris
* Aluno: Marcello Souza de Oliveira
* Numero USP: 6432692
* Curso: Bacharelado em Ciencias da Computacao
* Compilador: gcc l... | |
You are given an n × m rectangular table consisting of lower case English letters. In one operation you can completely remove one column from the table. The remaining parts are combined forming a new table. For example, after removing the second column from the tableabcdedfghijk we obtain the table:acdefghjk A table is... | Print a single number — the minimum number of columns that you need to remove in order to make the table good. | C | a45cfc2855f82f162133930d9834a9f0 | d38a82e4526a4548e744b36f15bf374b | GNU C | standard output | 256 megabytes | train_001.jsonl | [
"constructive algorithms",
"implementation",
"brute force"
] | 1418833800 | ["1 10\ncodeforces", "4 4\ncase\ncare\ntest\ncode", "5 4\ncode\nforc\nesco\ndefo\nrces"] | NoteIn the first sample the table is already good.In the second sample you may remove the first and third column.In the third sample you have to remove all the columns (note that the table where all rows are empty is considered good by definition).Let strings s and t have equal length. Then, s is lexicographically larg... | PASSED | 1,500 | standard input | 2 seconds | The first line contains two integers — n and m (1 ≤ n, m ≤ 100). Next n lines contain m small English letters each — the characters of the table. | ["0", "2", "4"] | #include <stdio.h>
char str[1001][1001];
unsigned bigger[1000];
int main()
{
int n, m, i, j, res, flag, k;
scanf("%d %d", &n, &m);
getchar();
for (i = 0; i < n; ++i)
gets(str[i]);
res = 0;
for (j = 0; j < m; ++j)
{
flag = 1;
for (i = 0; i < n - 1; ++i)
{
... | |
You are given an n × m rectangular table consisting of lower case English letters. In one operation you can completely remove one column from the table. The remaining parts are combined forming a new table. For example, after removing the second column from the tableabcdedfghijk we obtain the table:acdefghjk A table is... | Print a single number — the minimum number of columns that you need to remove in order to make the table good. | C | a45cfc2855f82f162133930d9834a9f0 | 071e3874431ca872d5552887a202aa59 | GNU C | standard output | 256 megabytes | train_001.jsonl | [
"constructive algorithms",
"implementation",
"brute force"
] | 1418833800 | ["1 10\ncodeforces", "4 4\ncase\ncare\ntest\ncode", "5 4\ncode\nforc\nesco\ndefo\nrces"] | NoteIn the first sample the table is already good.In the second sample you may remove the first and third column.In the third sample you have to remove all the columns (note that the table where all rows are empty is considered good by definition).Let strings s and t have equal length. Then, s is lexicographically larg... | PASSED | 1,500 | standard input | 2 seconds | The first line contains two integers — n and m (1 ≤ n, m ≤ 100). Next n lines contain m small English letters each — the characters of the table. | ["0", "2", "4"] | #include <stdio.h>
char str[1001][1001];
int state[1000];
unsigned bigger[1000];
int main()
{
int n, m, i, j, res, flag, k;
scanf("%d %d", &n, &m);
getchar();
for (i = 0; i < n; ++i)
gets(str[i]);
for (j = 0; j < m; ++j)
{
if (state[j])
continue;
flag = 1;
... | |
You are given an n × m rectangular table consisting of lower case English letters. In one operation you can completely remove one column from the table. The remaining parts are combined forming a new table. For example, after removing the second column from the tableabcdedfghijk we obtain the table:acdefghjk A table is... | Print a single number — the minimum number of columns that you need to remove in order to make the table good. | C | a45cfc2855f82f162133930d9834a9f0 | 4c95fa89073c924a3e72b60296042293 | GNU C | standard output | 256 megabytes | train_001.jsonl | [
"constructive algorithms",
"implementation",
"brute force"
] | 1418833800 | ["1 10\ncodeforces", "4 4\ncase\ncare\ntest\ncode", "5 4\ncode\nforc\nesco\ndefo\nrces"] | NoteIn the first sample the table is already good.In the second sample you may remove the first and third column.In the third sample you have to remove all the columns (note that the table where all rows are empty is considered good by definition).Let strings s and t have equal length. Then, s is lexicographically larg... | PASSED | 1,500 | standard input | 2 seconds | The first line contains two integers — n and m (1 ≤ n, m ≤ 100). Next n lines contain m small English letters each — the characters of the table. | ["0", "2", "4"] | #include <stdio.h>
int main(){
int n,m,i,j,count;
scanf("%d%d",&n,&m);
char c[100][101];
int ci[100];
for(i=0;i<100;i++){
ci[i]=0;
}
for(i=0;i<n;i++){
scanf("%s",c[i]);
}
count = 0;
for(i=0;i<n-1;i++){
for(j=0;j<m;j++){
if(ci[j]==1) {//already removed
continue;
}
if(c[i+1][j]>c[i][j]){
... | |
You are given an n × m rectangular table consisting of lower case English letters. In one operation you can completely remove one column from the table. The remaining parts are combined forming a new table. For example, after removing the second column from the tableabcdedfghijk we obtain the table:acdefghjk A table is... | Print a single number — the minimum number of columns that you need to remove in order to make the table good. | C | a45cfc2855f82f162133930d9834a9f0 | 243f8358bc333212e27abb56932ad561 | GNU C | standard output | 256 megabytes | train_001.jsonl | [
"constructive algorithms",
"implementation",
"brute force"
] | 1418833800 | ["1 10\ncodeforces", "4 4\ncase\ncare\ntest\ncode", "5 4\ncode\nforc\nesco\ndefo\nrces"] | NoteIn the first sample the table is already good.In the second sample you may remove the first and third column.In the third sample you have to remove all the columns (note that the table where all rows are empty is considered good by definition).Let strings s and t have equal length. Then, s is lexicographically larg... | PASSED | 1,500 | standard input | 2 seconds | The first line contains two integers — n and m (1 ≤ n, m ≤ 100). Next n lines contain m small English letters each — the characters of the table. | ["0", "2", "4"] | #include <stdio.h>
int main(void) {
// your code goes here
int n,m,i,j, flag, count=0;
char s[101][101];
int visited[101]={0};
scanf("%d%d",&n,&m);
for(i=0; i<n; i++)
{
scanf("%s", s[i]);
}
for(i=0; i<n-1; i++)
{
flag=0;
for(j=0; j<m; j++)
{
... | |
You are given an n × m rectangular table consisting of lower case English letters. In one operation you can completely remove one column from the table. The remaining parts are combined forming a new table. For example, after removing the second column from the tableabcdedfghijk we obtain the table:acdefghjk A table is... | Print a single number — the minimum number of columns that you need to remove in order to make the table good. | C | a45cfc2855f82f162133930d9834a9f0 | 325d5251e36efcfcdcd7aa2e63822485 | GNU C | standard output | 256 megabytes | train_001.jsonl | [
"constructive algorithms",
"implementation",
"brute force"
] | 1418833800 | ["1 10\ncodeforces", "4 4\ncase\ncare\ntest\ncode", "5 4\ncode\nforc\nesco\ndefo\nrces"] | NoteIn the first sample the table is already good.In the second sample you may remove the first and third column.In the third sample you have to remove all the columns (note that the table where all rows are empty is considered good by definition).Let strings s and t have equal length. Then, s is lexicographically larg... | PASSED | 1,500 | standard input | 2 seconds | The first line contains two integers — n and m (1 ≤ n, m ≤ 100). Next n lines contain m small English letters each — the characters of the table. | ["0", "2", "4"] | #include<stdio.h>
char a[100][100];
int x[100],y[100];//x to store removed j
//y to store lexi .. smaller
int main()
{
int n,m,i,j,c,q=0,flag;
scanf("%d %d",&n,&m);
c=getchar();
for(i=0;i<n;i++)
{
for(j=0;j<m;j++)
{
scanf("%c",&a[i][j]);
}
c=getchar();
}
for(j=0;j<m;j++)
{
for(i=0;i<n-1;i++)
{
... | |
You are given an n × m rectangular table consisting of lower case English letters. In one operation you can completely remove one column from the table. The remaining parts are combined forming a new table. For example, after removing the second column from the tableabcdedfghijk we obtain the table:acdefghjk A table is... | Print a single number — the minimum number of columns that you need to remove in order to make the table good. | C | a45cfc2855f82f162133930d9834a9f0 | 3b5dec617beeddecf54b6524f2be9593 | GNU C | standard output | 256 megabytes | train_001.jsonl | [
"constructive algorithms",
"implementation",
"brute force"
] | 1418833800 | ["1 10\ncodeforces", "4 4\ncase\ncare\ntest\ncode", "5 4\ncode\nforc\nesco\ndefo\nrces"] | NoteIn the first sample the table is already good.In the second sample you may remove the first and third column.In the third sample you have to remove all the columns (note that the table where all rows are empty is considered good by definition).Let strings s and t have equal length. Then, s is lexicographically larg... | PASSED | 1,500 | standard input | 2 seconds | The first line contains two integers — n and m (1 ≤ n, m ≤ 100). Next n lines contain m small English letters each — the characters of the table. | ["0", "2", "4"] | #include<stdio.h>
#include<string.h>
int main()
{
char arr[101][101];
int n,m,i,j,k,s=0;
scanf("%d %d",&n,&m);
for(i=0;i<n;i++)
scanf("%s",arr[i]);
for(i=1;i<n;)
{
if(strcmp(arr[i],arr[i-1]) < 0)
{
for(j=0; j<m; j++)
if(arr[i][j]<arr[i-1][j])
break;
for(k=0; k<n; k++)
arr[k][j]='d';
s+... | |
You are given an n × m rectangular table consisting of lower case English letters. In one operation you can completely remove one column from the table. The remaining parts are combined forming a new table. For example, after removing the second column from the tableabcdedfghijk we obtain the table:acdefghjk A table is... | Print a single number — the minimum number of columns that you need to remove in order to make the table good. | C | a45cfc2855f82f162133930d9834a9f0 | 72404ff0a6d3f5b4904c4acf8154e6b0 | GNU C | standard output | 256 megabytes | train_001.jsonl | [
"constructive algorithms",
"implementation",
"brute force"
] | 1418833800 | ["1 10\ncodeforces", "4 4\ncase\ncare\ntest\ncode", "5 4\ncode\nforc\nesco\ndefo\nrces"] | NoteIn the first sample the table is already good.In the second sample you may remove the first and third column.In the third sample you have to remove all the columns (note that the table where all rows are empty is considered good by definition).Let strings s and t have equal length. Then, s is lexicographically larg... | PASSED | 1,500 | standard input | 2 seconds | The first line contains two integers — n and m (1 ≤ n, m ≤ 100). Next n lines contain m small English letters each — the characters of the table. | ["0", "2", "4"] | #include <math.h>
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <assert.h>
#include <limits.h>
#include <stdbool.h>
int main(void) {
int n,m;
scanf("%d %d",&n,&m);
char str[n][m+1];
int isSmall[n-1];
int i;
for(i=0;i<n-1;i++){
isSmall[i] = 0;
}
for(i=0;i<n;... | |
You are given an n × m rectangular table consisting of lower case English letters. In one operation you can completely remove one column from the table. The remaining parts are combined forming a new table. For example, after removing the second column from the tableabcdedfghijk we obtain the table:acdefghjk A table is... | Print a single number — the minimum number of columns that you need to remove in order to make the table good. | C | a45cfc2855f82f162133930d9834a9f0 | 15e242d377e1cf4ee3fb751d2daf0e14 | GNU C | standard output | 256 megabytes | train_001.jsonl | [
"constructive algorithms",
"implementation",
"brute force"
] | 1418833800 | ["1 10\ncodeforces", "4 4\ncase\ncare\ntest\ncode", "5 4\ncode\nforc\nesco\ndefo\nrces"] | NoteIn the first sample the table is already good.In the second sample you may remove the first and third column.In the third sample you have to remove all the columns (note that the table where all rows are empty is considered good by definition).Let strings s and t have equal length. Then, s is lexicographically larg... | PASSED | 1,500 | standard input | 2 seconds | The first line contains two integers — n and m (1 ≤ n, m ≤ 100). Next n lines contain m small English letters each — the characters of the table. | ["0", "2", "4"] | #include<stdio.h>
#include<string.h>
#include<stdlib.h>
#define M 111
char s[M][M];
int flag[M],now[M];
int main() {
int n,m,i,j;
while((scanf("%d%d",&n,&m))!=EOF){
for(i=0;i<n;i++) {
scanf("%s",s[i]);
}
memset(now,0,sizeof(now));
int cont= 0;
for(i=0;i<m;i++) {
memset(flag,0,sizeo... | |
You are given an n × m rectangular table consisting of lower case English letters. In one operation you can completely remove one column from the table. The remaining parts are combined forming a new table. For example, after removing the second column from the tableabcdedfghijk we obtain the table:acdefghjk A table is... | Print a single number — the minimum number of columns that you need to remove in order to make the table good. | C | a45cfc2855f82f162133930d9834a9f0 | 2559889d95c578129c7630d6bc1c651d | GNU C | standard output | 256 megabytes | train_001.jsonl | [
"constructive algorithms",
"implementation",
"brute force"
] | 1418833800 | ["1 10\ncodeforces", "4 4\ncase\ncare\ntest\ncode", "5 4\ncode\nforc\nesco\ndefo\nrces"] | NoteIn the first sample the table is already good.In the second sample you may remove the first and third column.In the third sample you have to remove all the columns (note that the table where all rows are empty is considered good by definition).Let strings s and t have equal length. Then, s is lexicographically larg... | PASSED | 1,500 | standard input | 2 seconds | The first line contains two integers — n and m (1 ≤ n, m ≤ 100). Next n lines contain m small English letters each — the characters of the table. | ["0", "2", "4"] | #include<stdio.h>
#include<string.h>
#define N 1010
char s[N][N], a[N];
int del[N];
int main()
{
int n, m, i, j, ans = 0;
scanf("%d%d",&n, &m);
memset(del, 0, sizeof(del));
for(i = 0; i < n; i++)
{
scanf("%s",a);
for(j = 0; j < m; j++)
s[j][i] = a[j];
}
for(i = 0; i < m; i++)
{
int flag = 0;
for(j = ... | |
You are given an n × m rectangular table consisting of lower case English letters. In one operation you can completely remove one column from the table. The remaining parts are combined forming a new table. For example, after removing the second column from the tableabcdedfghijk we obtain the table:acdefghjk A table is... | Print a single number — the minimum number of columns that you need to remove in order to make the table good. | C | a45cfc2855f82f162133930d9834a9f0 | 23a4a3fd3fff059d37883a7c02d234a4 | GNU C | standard output | 256 megabytes | train_001.jsonl | [
"constructive algorithms",
"implementation",
"brute force"
] | 1418833800 | ["1 10\ncodeforces", "4 4\ncase\ncare\ntest\ncode", "5 4\ncode\nforc\nesco\ndefo\nrces"] | NoteIn the first sample the table is already good.In the second sample you may remove the first and third column.In the third sample you have to remove all the columns (note that the table where all rows are empty is considered good by definition).Let strings s and t have equal length. Then, s is lexicographically larg... | PASSED | 1,500 | standard input | 2 seconds | The first line contains two integers — n and m (1 ≤ n, m ≤ 100). Next n lines contain m small English letters each — the characters of the table. | ["0", "2", "4"] | #include <stdio.h>
#include <string.h>
int main()
{
int flag;
int i, j;
int n, m;
int ans = 0;
int mark[105];
char str[105][105];
memset(mark, 0, sizeof(mark));
scanf("%d%d", &n, &m);
for ( i = 0; i < n; i++ )
scanf("%s", str[i]);
for ( i = 0; i < m; i++ )
{
... | |
You are given an n × m rectangular table consisting of lower case English letters. In one operation you can completely remove one column from the table. The remaining parts are combined forming a new table. For example, after removing the second column from the tableabcdedfghijk we obtain the table:acdefghjk A table is... | Print a single number — the minimum number of columns that you need to remove in order to make the table good. | C | a45cfc2855f82f162133930d9834a9f0 | 3d5fe26f71fef56dadd639dd16e20fed | GNU C | standard output | 256 megabytes | train_001.jsonl | [
"constructive algorithms",
"implementation",
"brute force"
] | 1418833800 | ["1 10\ncodeforces", "4 4\ncase\ncare\ntest\ncode", "5 4\ncode\nforc\nesco\ndefo\nrces"] | NoteIn the first sample the table is already good.In the second sample you may remove the first and third column.In the third sample you have to remove all the columns (note that the table where all rows are empty is considered good by definition).Let strings s and t have equal length. Then, s is lexicographically larg... | PASSED | 1,500 | standard input | 2 seconds | The first line contains two integers — n and m (1 ≤ n, m ≤ 100). Next n lines contain m small English letters each — the characters of the table. | ["0", "2", "4"] | #include<stdio.h>
int main()
{
int n,m,b[110],l=0,j,z=0,k,i;
char a[110][110];
scanf("%d%d",&n,&m);
for(i=1;i<=n;i++)
scanf("%s",a[i]);
do
{
z=l;
for(i=1;i<n;i++)
{
for(j=0;j<m;j++)
{
for(k=0;k<l;k++)
if... | |
You are given an n × m rectangular table consisting of lower case English letters. In one operation you can completely remove one column from the table. The remaining parts are combined forming a new table. For example, after removing the second column from the tableabcdedfghijk we obtain the table:acdefghjk A table is... | Print a single number — the minimum number of columns that you need to remove in order to make the table good. | C | a45cfc2855f82f162133930d9834a9f0 | 3e586777532d5c3da584bd6069d79097 | GNU C | standard output | 256 megabytes | train_001.jsonl | [
"constructive algorithms",
"implementation",
"brute force"
] | 1418833800 | ["1 10\ncodeforces", "4 4\ncase\ncare\ntest\ncode", "5 4\ncode\nforc\nesco\ndefo\nrces"] | NoteIn the first sample the table is already good.In the second sample you may remove the first and third column.In the third sample you have to remove all the columns (note that the table where all rows are empty is considered good by definition).Let strings s and t have equal length. Then, s is lexicographically larg... | PASSED | 1,500 | standard input | 2 seconds | The first line contains two integers — n and m (1 ≤ n, m ≤ 100). Next n lines contain m small English letters each — the characters of the table. | ["0", "2", "4"] |
#include<stdio.h>
int n,m,i,j,ans,tmp,flag[1000];
char s[1000][1000];
int main()
{
scanf("%d%d",&n,&m);
for (i=1;i<=n;i++)
scanf("%s",&s[i]);
for (j=0;j<m;j++)
{
tmp=0;
for (i=1;i<=n-1;i++)
if ((s[i][j]>s[i+1][j])&&(flag[i]==0))
tmp=1;
ans=ans+tmp;
if (tmp==0)
for (i=1;i<=n-1;i++)
if ((s[i][j]<s[i+1][j])... | |
You are given an n × m rectangular table consisting of lower case English letters. In one operation you can completely remove one column from the table. The remaining parts are combined forming a new table. For example, after removing the second column from the tableabcdedfghijk we obtain the table:acdefghjk A table is... | Print a single number — the minimum number of columns that you need to remove in order to make the table good. | C | a45cfc2855f82f162133930d9834a9f0 | 42eb73e79a4509b2b67180666a358109 | GNU C | standard output | 256 megabytes | train_001.jsonl | [
"constructive algorithms",
"implementation",
"brute force"
] | 1418833800 | ["1 10\ncodeforces", "4 4\ncase\ncare\ntest\ncode", "5 4\ncode\nforc\nesco\ndefo\nrces"] | NoteIn the first sample the table is already good.In the second sample you may remove the first and third column.In the third sample you have to remove all the columns (note that the table where all rows are empty is considered good by definition).Let strings s and t have equal length. Then, s is lexicographically larg... | PASSED | 1,500 | standard input | 2 seconds | The first line contains two integers — n and m (1 ≤ n, m ≤ 100). Next n lines contain m small English letters each — the characters of the table. | ["0", "2", "4"] | #include<stdio.h>
#include<string.h>
#include<stdlib.h>
int main (){
int n,m,i,j,i1,b[110]={0},count=0,flag=0;
char a[110][110];
scanf("%d%d",&n,&m);
for(i1=1;i1<=n;i1++)
scanf("%s",a[i1]);
int i5=0;
while(i5<m)
{ flag=0;
for(i=1;i<n;i++)
{
... | |
You are given an n × m rectangular table consisting of lower case English letters. In one operation you can completely remove one column from the table. The remaining parts are combined forming a new table. For example, after removing the second column from the tableabcdedfghijk we obtain the table:acdefghjk A table is... | Print a single number — the minimum number of columns that you need to remove in order to make the table good. | C | a45cfc2855f82f162133930d9834a9f0 | d6946609adefeecd0c9a45e35217c1c2 | GNU C | standard output | 256 megabytes | train_001.jsonl | [
"constructive algorithms",
"implementation",
"brute force"
] | 1418833800 | ["1 10\ncodeforces", "4 4\ncase\ncare\ntest\ncode", "5 4\ncode\nforc\nesco\ndefo\nrces"] | NoteIn the first sample the table is already good.In the second sample you may remove the first and third column.In the third sample you have to remove all the columns (note that the table where all rows are empty is considered good by definition).Let strings s and t have equal length. Then, s is lexicographically larg... | PASSED | 1,500 | standard input | 2 seconds | The first line contains two integers — n and m (1 ≤ n, m ≤ 100). Next n lines contain m small English letters each — the characters of the table. | ["0", "2", "4"] | /* Problem: 496C - Removing Columns */
/* Solver: Gusztav Szmolik */
#include <stdio.h>
#include <string.h>
#include <ctype.h>
int main ()
{
unsigned short n;
unsigned short m;
unsigned short i;
unsigned char s[102];
unsigned short j;
unsigned char t[100][100];
unsigned short rc[100];
... | |
You are given an n × m rectangular table consisting of lower case English letters. In one operation you can completely remove one column from the table. The remaining parts are combined forming a new table. For example, after removing the second column from the tableabcdedfghijk we obtain the table:acdefghjk A table is... | Print a single number — the minimum number of columns that you need to remove in order to make the table good. | C | a45cfc2855f82f162133930d9834a9f0 | a6c117fbf578ff05c18f4f1cea484dfc | GNU C | standard output | 256 megabytes | train_001.jsonl | [
"constructive algorithms",
"implementation",
"brute force"
] | 1418833800 | ["1 10\ncodeforces", "4 4\ncase\ncare\ntest\ncode", "5 4\ncode\nforc\nesco\ndefo\nrces"] | NoteIn the first sample the table is already good.In the second sample you may remove the first and third column.In the third sample you have to remove all the columns (note that the table where all rows are empty is considered good by definition).Let strings s and t have equal length. Then, s is lexicographically larg... | PASSED | 1,500 | standard input | 2 seconds | The first line contains two integers — n and m (1 ≤ n, m ≤ 100). Next n lines contain m small English letters each — the characters of the table. | ["0", "2", "4"] | #include <stdio.h>
#include <string.h>
int main()
{
int n,m;
char mat[105][105];
scanf("%d %d",&n,&m);
for(int i =0 ;i<n;i++)
scanf("%s",mat[i]);
int cnt = 0;
int del[105] = {0};
int les[105] = {0};
for(int i = 0; i < m; i ++ )
{
int flag = 0;
for(int j = 1; j<n;j++)
{
if(les[j] == 0 && mat[j][i] ... | |
You are given an n × m rectangular table consisting of lower case English letters. In one operation you can completely remove one column from the table. The remaining parts are combined forming a new table. For example, after removing the second column from the tableabcdedfghijk we obtain the table:acdefghjk A table is... | Print a single number — the minimum number of columns that you need to remove in order to make the table good. | C | a45cfc2855f82f162133930d9834a9f0 | a1bdd5c2dab8703f3c098948dd49cb4b | GNU C | standard output | 256 megabytes | train_001.jsonl | [
"constructive algorithms",
"implementation",
"brute force"
] | 1418833800 | ["1 10\ncodeforces", "4 4\ncase\ncare\ntest\ncode", "5 4\ncode\nforc\nesco\ndefo\nrces"] | NoteIn the first sample the table is already good.In the second sample you may remove the first and third column.In the third sample you have to remove all the columns (note that the table where all rows are empty is considered good by definition).Let strings s and t have equal length. Then, s is lexicographically larg... | PASSED | 1,500 | standard input | 2 seconds | The first line contains two integers — n and m (1 ≤ n, m ≤ 100). Next n lines contain m small English letters each — the characters of the table. | ["0", "2", "4"] | #include <stdio.h>
#include <stdlib.h>
#include <string.h>
int main()
{
int nColumns, nRows, i, j, k, m, count, aux;
scanf("%d %d", &nRows, &nColumns);
char** rows = malloc(nRows*sizeof(char*));
for(i = 0; i < nRows; i++)
{
rows[i] = malloc(nColumns*sizeof(char));
}
for(i = 0; i < nRows; i++)
{
scanf("%s",... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.