prob_desc_description stringlengths 63 3.8k | prob_desc_output_spec stringlengths 17 1.47k ⌀ | lang_cluster stringclasses 2
values | src_uid stringlengths 32 32 | code_uid stringlengths 32 32 | lang stringclasses 7
values | prob_desc_output_to stringclasses 3
values | prob_desc_memory_limit stringclasses 19
values | file_name stringclasses 111
values | tags listlengths 0 11 | prob_desc_created_at stringlengths 10 10 | prob_desc_sample_inputs stringlengths 2 802 | prob_desc_notes stringlengths 4 3k ⌀ | exec_outcome stringclasses 1
value | difficulty int64 -1 3.5k ⌀ | prob_desc_input_from stringclasses 3
values | prob_desc_time_limit stringclasses 27
values | prob_desc_input_spec stringlengths 28 2.42k ⌀ | prob_desc_sample_outputs stringlengths 2 796 | source_code stringlengths 42 65.5k | hidden_unit_tests stringclasses 1
value |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
You're given an array $$$a$$$ of $$$n$$$ integers, such that $$$a_1 + a_2 + \cdots + a_n = 0$$$.In one operation, you can choose two different indices $$$i$$$ and $$$j$$$ ($$$1 \le i, j \le n$$$), decrement $$$a_i$$$ by one and increment $$$a_j$$$ by one. If $$$i < j$$$ this operation is free, otherwise it costs one... | For each test case, print the minimum number of coins we have to spend in order to make all elements equal to $$$0$$$. | C | bd0b14e53ade1207022464ebafdf8c9a | 48f9183cc1665dfc267c6cc9e1b11481 | GNU C11 | standard output | 256 megabytes | train_002.jsonl | [
"constructive algorithms",
"implementation"
] | 1599402900 | ["7\n4\n-3 5 -3 1\n2\n1 -1\n4\n-3 2 -3 4\n4\n-1 1 1 -1\n7\n-5 7 -6 -4 17 -13 4\n6\n-1000000000 -1000000000 -1000000000 1000000000 1000000000 1000000000\n1\n0"] | NotePossible strategy for the first test case: Do $$$(i=2, j=3)$$$ three times (free), $$$a = [-3, 2, 0, 1]$$$. Do $$$(i=2, j=1)$$$ two times (pay two coins), $$$a = [-1, 0, 0, 1]$$$. Do $$$(i=4, j=1)$$$ one time (pay one coin), $$$a = [0, 0, 0, 0]$$$. | PASSED | 1,000 | standard input | 1 second | Each test contains multiple test cases. The first line contains the number of test cases $$$t$$$ ($$$1 \le t \le 5000$$$). Description of the test cases follows. The first line of each test case contains an integer $$$n$$$ ($$$1 \le n \le 10^5$$$) — the number of elements. The next line contains $$$n$$$ integers $$$a_... | ["3\n0\n4\n1\n8\n3000000000\n0"] | #include <stdio.h>
long long min(long long a,long long b){
if(a>b)return b;
else return a;
}
long long max(long long a,long long b){
if(a>b)return a;
else return b;
}
int main(int argc, char *argv[])
{
int tc;
scanf("%d",&tc);
while(tc--){
long long n,i,sum=0,d,ss;
scanf("%lld",&n);
long long a[n+6],pref[n... | |
You're given an array $$$a$$$ of $$$n$$$ integers, such that $$$a_1 + a_2 + \cdots + a_n = 0$$$.In one operation, you can choose two different indices $$$i$$$ and $$$j$$$ ($$$1 \le i, j \le n$$$), decrement $$$a_i$$$ by one and increment $$$a_j$$$ by one. If $$$i < j$$$ this operation is free, otherwise it costs one... | For each test case, print the minimum number of coins we have to spend in order to make all elements equal to $$$0$$$. | C | bd0b14e53ade1207022464ebafdf8c9a | 6f620f00d80427bfbfc784f1031e2b1b | GNU C11 | standard output | 256 megabytes | train_002.jsonl | [
"constructive algorithms",
"implementation"
] | 1599402900 | ["7\n4\n-3 5 -3 1\n2\n1 -1\n4\n-3 2 -3 4\n4\n-1 1 1 -1\n7\n-5 7 -6 -4 17 -13 4\n6\n-1000000000 -1000000000 -1000000000 1000000000 1000000000 1000000000\n1\n0"] | NotePossible strategy for the first test case: Do $$$(i=2, j=3)$$$ three times (free), $$$a = [-3, 2, 0, 1]$$$. Do $$$(i=2, j=1)$$$ two times (pay two coins), $$$a = [-1, 0, 0, 1]$$$. Do $$$(i=4, j=1)$$$ one time (pay one coin), $$$a = [0, 0, 0, 0]$$$. | PASSED | 1,000 | standard input | 1 second | Each test contains multiple test cases. The first line contains the number of test cases $$$t$$$ ($$$1 \le t \le 5000$$$). Description of the test cases follows. The first line of each test case contains an integer $$$n$$$ ($$$1 \le n \le 10^5$$$) — the number of elements. The next line contains $$$n$$$ integers $$$a_... | ["3\n0\n4\n1\n8\n3000000000\n0"] | #include <stdio.h>
typedef long long ll;
int correct(ll *arr, int n, ll coins) {
for (int i=0; i < n; i++) {
coins += arr[i];
if (coins < 0)
return 0;
}
if (coins < 0)
return 0;
return 1;
}
int main() {
int T;
int n;
ll arr[(int)1e5+7];
scanf("%d"... | |
You're given an array $$$a$$$ of $$$n$$$ integers, such that $$$a_1 + a_2 + \cdots + a_n = 0$$$.In one operation, you can choose two different indices $$$i$$$ and $$$j$$$ ($$$1 \le i, j \le n$$$), decrement $$$a_i$$$ by one and increment $$$a_j$$$ by one. If $$$i < j$$$ this operation is free, otherwise it costs one... | For each test case, print the minimum number of coins we have to spend in order to make all elements equal to $$$0$$$. | C | bd0b14e53ade1207022464ebafdf8c9a | b035b4b94866d8f45abf1319643b49de | GNU C11 | standard output | 256 megabytes | train_002.jsonl | [
"constructive algorithms",
"implementation"
] | 1599402900 | ["7\n4\n-3 5 -3 1\n2\n1 -1\n4\n-3 2 -3 4\n4\n-1 1 1 -1\n7\n-5 7 -6 -4 17 -13 4\n6\n-1000000000 -1000000000 -1000000000 1000000000 1000000000 1000000000\n1\n0"] | NotePossible strategy for the first test case: Do $$$(i=2, j=3)$$$ three times (free), $$$a = [-3, 2, 0, 1]$$$. Do $$$(i=2, j=1)$$$ two times (pay two coins), $$$a = [-1, 0, 0, 1]$$$. Do $$$(i=4, j=1)$$$ one time (pay one coin), $$$a = [0, 0, 0, 0]$$$. | PASSED | 1,000 | standard input | 1 second | Each test contains multiple test cases. The first line contains the number of test cases $$$t$$$ ($$$1 \le t \le 5000$$$). Description of the test cases follows. The first line of each test case contains an integer $$$n$$$ ($$$1 \le n \le 10^5$$$) — the number of elements. The next line contains $$$n$$$ integers $$$a_... | ["3\n0\n4\n1\n8\n3000000000\n0"] | #include<stdio.h>
int main()
{
long long int t,q,n,a[100001],i,x,y,z,k;
scanf("%lld",&t);
for(q=1;q<=t;q++)
{
x=0;
y=0;
z=0;
k=0;
scanf("%lld",&n);
for(i=1;i<=n;i++)
{scanf("%lld",&a[i]);
if(a[i]>0)
{x=x+a[i];}
else
{y=y+a[i];}
}
i=n;
... | |
You're given an array $$$a$$$ of $$$n$$$ integers, such that $$$a_1 + a_2 + \cdots + a_n = 0$$$.In one operation, you can choose two different indices $$$i$$$ and $$$j$$$ ($$$1 \le i, j \le n$$$), decrement $$$a_i$$$ by one and increment $$$a_j$$$ by one. If $$$i < j$$$ this operation is free, otherwise it costs one... | For each test case, print the minimum number of coins we have to spend in order to make all elements equal to $$$0$$$. | C | bd0b14e53ade1207022464ebafdf8c9a | c37afddf592cbd65fe3263498c9b9802 | GNU C11 | standard output | 256 megabytes | train_002.jsonl | [
"constructive algorithms",
"implementation"
] | 1599402900 | ["7\n4\n-3 5 -3 1\n2\n1 -1\n4\n-3 2 -3 4\n4\n-1 1 1 -1\n7\n-5 7 -6 -4 17 -13 4\n6\n-1000000000 -1000000000 -1000000000 1000000000 1000000000 1000000000\n1\n0"] | NotePossible strategy for the first test case: Do $$$(i=2, j=3)$$$ three times (free), $$$a = [-3, 2, 0, 1]$$$. Do $$$(i=2, j=1)$$$ two times (pay two coins), $$$a = [-1, 0, 0, 1]$$$. Do $$$(i=4, j=1)$$$ one time (pay one coin), $$$a = [0, 0, 0, 0]$$$. | PASSED | 1,000 | standard input | 1 second | Each test contains multiple test cases. The first line contains the number of test cases $$$t$$$ ($$$1 \le t \le 5000$$$). Description of the test cases follows. The first line of each test case contains an integer $$$n$$$ ($$$1 \le n \le 10^5$$$) — the number of elements. The next line contains $$$n$$$ integers $$$a_... | ["3\n0\n4\n1\n8\n3000000000\n0"] | #include <stdio.h>
int main()
{
int t;
scanf("%d", &t);
while(t--){
int n, tmp;
long long int negsum = 0, possum = 0;
scanf("%d", &n);
for(int i = 0; i < n; i++){
scanf("%d", &tmp);
if(tmp < 0) {
if(possum > 0) {
pos... | |
You're given an array $$$a$$$ of $$$n$$$ integers, such that $$$a_1 + a_2 + \cdots + a_n = 0$$$.In one operation, you can choose two different indices $$$i$$$ and $$$j$$$ ($$$1 \le i, j \le n$$$), decrement $$$a_i$$$ by one and increment $$$a_j$$$ by one. If $$$i < j$$$ this operation is free, otherwise it costs one... | For each test case, print the minimum number of coins we have to spend in order to make all elements equal to $$$0$$$. | C | bd0b14e53ade1207022464ebafdf8c9a | 8eed5e7189be05c7bbad697f967f7eb8 | GNU C11 | standard output | 256 megabytes | train_002.jsonl | [
"constructive algorithms",
"implementation"
] | 1599402900 | ["7\n4\n-3 5 -3 1\n2\n1 -1\n4\n-3 2 -3 4\n4\n-1 1 1 -1\n7\n-5 7 -6 -4 17 -13 4\n6\n-1000000000 -1000000000 -1000000000 1000000000 1000000000 1000000000\n1\n0"] | NotePossible strategy for the first test case: Do $$$(i=2, j=3)$$$ three times (free), $$$a = [-3, 2, 0, 1]$$$. Do $$$(i=2, j=1)$$$ two times (pay two coins), $$$a = [-1, 0, 0, 1]$$$. Do $$$(i=4, j=1)$$$ one time (pay one coin), $$$a = [0, 0, 0, 0]$$$. | PASSED | 1,000 | standard input | 1 second | Each test contains multiple test cases. The first line contains the number of test cases $$$t$$$ ($$$1 \le t \le 5000$$$). Description of the test cases follows. The first line of each test case contains an integer $$$n$$$ ($$$1 \le n \le 10^5$$$) — the number of elements. The next line contains $$$n$$$ integers $$$a_... | ["3\n0\n4\n1\n8\n3000000000\n0"] | #include <stdio.h>
int main() {
int tests;
scanf("%d", &tests);
int ar[100000];
while (tests--) {
int n;
scanf("%d", &n);
for (int i=0; i<n; i++) {
scanf("%d", ar+i);
}
long long ans = 0;
for (int i=0; i<n; i++) {
ans += ar[i];... | |
You're given an array $$$a$$$ of $$$n$$$ integers, such that $$$a_1 + a_2 + \cdots + a_n = 0$$$.In one operation, you can choose two different indices $$$i$$$ and $$$j$$$ ($$$1 \le i, j \le n$$$), decrement $$$a_i$$$ by one and increment $$$a_j$$$ by one. If $$$i < j$$$ this operation is free, otherwise it costs one... | For each test case, print the minimum number of coins we have to spend in order to make all elements equal to $$$0$$$. | C | bd0b14e53ade1207022464ebafdf8c9a | 947660a0ee32811054ce5333c645a7dc | GNU C11 | standard output | 256 megabytes | train_002.jsonl | [
"constructive algorithms",
"implementation"
] | 1599402900 | ["7\n4\n-3 5 -3 1\n2\n1 -1\n4\n-3 2 -3 4\n4\n-1 1 1 -1\n7\n-5 7 -6 -4 17 -13 4\n6\n-1000000000 -1000000000 -1000000000 1000000000 1000000000 1000000000\n1\n0"] | NotePossible strategy for the first test case: Do $$$(i=2, j=3)$$$ three times (free), $$$a = [-3, 2, 0, 1]$$$. Do $$$(i=2, j=1)$$$ two times (pay two coins), $$$a = [-1, 0, 0, 1]$$$. Do $$$(i=4, j=1)$$$ one time (pay one coin), $$$a = [0, 0, 0, 0]$$$. | PASSED | 1,000 | standard input | 1 second | Each test contains multiple test cases. The first line contains the number of test cases $$$t$$$ ($$$1 \le t \le 5000$$$). Description of the test cases follows. The first line of each test case contains an integer $$$n$$$ ($$$1 \le n \le 10^5$$$) — the number of elements. The next line contains $$$n$$$ integers $$$a_... | ["3\n0\n4\n1\n8\n3000000000\n0"] | #include<stdio.h>
int main()
{
int t;
scanf("%d",&t);
while(t--)
{
long long int n,j,c=0,s1=0,s2=0,i=0,p;
scanf("%lld",&n);
for(j=0;j<n;j++)
{
scanf("%lld",&p);
if(p>0) s1+=p;
else
{
s2=s2-p;
c=s2-s1;
... | |
You're given an array $$$a$$$ of $$$n$$$ integers, such that $$$a_1 + a_2 + \cdots + a_n = 0$$$.In one operation, you can choose two different indices $$$i$$$ and $$$j$$$ ($$$1 \le i, j \le n$$$), decrement $$$a_i$$$ by one and increment $$$a_j$$$ by one. If $$$i < j$$$ this operation is free, otherwise it costs one... | For each test case, print the minimum number of coins we have to spend in order to make all elements equal to $$$0$$$. | C | bd0b14e53ade1207022464ebafdf8c9a | a6f59f220d319edb56a26dbaa14bc363 | GNU C11 | standard output | 256 megabytes | train_002.jsonl | [
"constructive algorithms",
"implementation"
] | 1599402900 | ["7\n4\n-3 5 -3 1\n2\n1 -1\n4\n-3 2 -3 4\n4\n-1 1 1 -1\n7\n-5 7 -6 -4 17 -13 4\n6\n-1000000000 -1000000000 -1000000000 1000000000 1000000000 1000000000\n1\n0"] | NotePossible strategy for the first test case: Do $$$(i=2, j=3)$$$ three times (free), $$$a = [-3, 2, 0, 1]$$$. Do $$$(i=2, j=1)$$$ two times (pay two coins), $$$a = [-1, 0, 0, 1]$$$. Do $$$(i=4, j=1)$$$ one time (pay one coin), $$$a = [0, 0, 0, 0]$$$. | PASSED | 1,000 | standard input | 1 second | Each test contains multiple test cases. The first line contains the number of test cases $$$t$$$ ($$$1 \le t \le 5000$$$). Description of the test cases follows. The first line of each test case contains an integer $$$n$$$ ($$$1 \le n \le 10^5$$$) — the number of elements. The next line contains $$$n$$$ integers $$$a_... | ["3\n0\n4\n1\n8\n3000000000\n0"] | #include <stdio.h>
#include <stdlib.h>
int main()
{
int tc, n, i;
long long a, c, min;
scanf("%d", &tc);
while(tc--)
{
min = 0;
c = 0;
scanf("%d", &n);
for (i = 0; i < n; i++)
{
scanf("%lld", &a);
c += a;
if (min > c)
... | |
You're given an array $$$a$$$ of $$$n$$$ integers, such that $$$a_1 + a_2 + \cdots + a_n = 0$$$.In one operation, you can choose two different indices $$$i$$$ and $$$j$$$ ($$$1 \le i, j \le n$$$), decrement $$$a_i$$$ by one and increment $$$a_j$$$ by one. If $$$i < j$$$ this operation is free, otherwise it costs one... | For each test case, print the minimum number of coins we have to spend in order to make all elements equal to $$$0$$$. | C | bd0b14e53ade1207022464ebafdf8c9a | bcda0e7ac19bbc33bbd0870dfc3e79e5 | GNU C11 | standard output | 256 megabytes | train_002.jsonl | [
"constructive algorithms",
"implementation"
] | 1599402900 | ["7\n4\n-3 5 -3 1\n2\n1 -1\n4\n-3 2 -3 4\n4\n-1 1 1 -1\n7\n-5 7 -6 -4 17 -13 4\n6\n-1000000000 -1000000000 -1000000000 1000000000 1000000000 1000000000\n1\n0"] | NotePossible strategy for the first test case: Do $$$(i=2, j=3)$$$ three times (free), $$$a = [-3, 2, 0, 1]$$$. Do $$$(i=2, j=1)$$$ two times (pay two coins), $$$a = [-1, 0, 0, 1]$$$. Do $$$(i=4, j=1)$$$ one time (pay one coin), $$$a = [0, 0, 0, 0]$$$. | PASSED | 1,000 | standard input | 1 second | Each test contains multiple test cases. The first line contains the number of test cases $$$t$$$ ($$$1 \le t \le 5000$$$). Description of the test cases follows. The first line of each test case contains an integer $$$n$$$ ($$$1 \le n \le 10^5$$$) — the number of elements. The next line contains $$$n$$$ integers $$$a_... | ["3\n0\n4\n1\n8\n3000000000\n0"] | #include<stdio.h>
int main(){
int t;
scanf("%d",&t);
while(t--){
int n;
scanf("%d",&n);
long long int a[100001];
long long int sum=0,sum_=0;
int j=0;
for(int i=0;i<n;i++){
scanf("%lld",&a[i]);
sum+=a[i];
if(sum>=0){
continue;
}
if(sum<0){
sum_+=-sum;
sum=0;
}
}
printf("... | |
You're given an array $$$a$$$ of $$$n$$$ integers, such that $$$a_1 + a_2 + \cdots + a_n = 0$$$.In one operation, you can choose two different indices $$$i$$$ and $$$j$$$ ($$$1 \le i, j \le n$$$), decrement $$$a_i$$$ by one and increment $$$a_j$$$ by one. If $$$i < j$$$ this operation is free, otherwise it costs one... | For each test case, print the minimum number of coins we have to spend in order to make all elements equal to $$$0$$$. | C | bd0b14e53ade1207022464ebafdf8c9a | 58ab44238769d2a68adae6875f6ffb86 | GNU C11 | standard output | 256 megabytes | train_002.jsonl | [
"constructive algorithms",
"implementation"
] | 1599402900 | ["7\n4\n-3 5 -3 1\n2\n1 -1\n4\n-3 2 -3 4\n4\n-1 1 1 -1\n7\n-5 7 -6 -4 17 -13 4\n6\n-1000000000 -1000000000 -1000000000 1000000000 1000000000 1000000000\n1\n0"] | NotePossible strategy for the first test case: Do $$$(i=2, j=3)$$$ three times (free), $$$a = [-3, 2, 0, 1]$$$. Do $$$(i=2, j=1)$$$ two times (pay two coins), $$$a = [-1, 0, 0, 1]$$$. Do $$$(i=4, j=1)$$$ one time (pay one coin), $$$a = [0, 0, 0, 0]$$$. | PASSED | 1,000 | standard input | 1 second | Each test contains multiple test cases. The first line contains the number of test cases $$$t$$$ ($$$1 \le t \le 5000$$$). Description of the test cases follows. The first line of each test case contains an integer $$$n$$$ ($$$1 \le n \le 10^5$$$) — the number of elements. The next line contains $$$n$$$ integers $$$a_... | ["3\n0\n4\n1\n8\n3000000000\n0"] | #include <assert.h>
#include <limits.h>
#include <math.h>
#include <stdbool.h>
#include <stddef.h>
#include <stdint.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
int main(){
int t;
scanf("%d", &t);
for(int x=0; x<t; x++){
int n;
scanf("%d", &n);
int a[n];
... | |
You're given an array $$$a$$$ of $$$n$$$ integers, such that $$$a_1 + a_2 + \cdots + a_n = 0$$$.In one operation, you can choose two different indices $$$i$$$ and $$$j$$$ ($$$1 \le i, j \le n$$$), decrement $$$a_i$$$ by one and increment $$$a_j$$$ by one. If $$$i < j$$$ this operation is free, otherwise it costs one... | For each test case, print the minimum number of coins we have to spend in order to make all elements equal to $$$0$$$. | C | bd0b14e53ade1207022464ebafdf8c9a | 9b740403718cb26678d51f6b70040059 | GNU C11 | standard output | 256 megabytes | train_002.jsonl | [
"constructive algorithms",
"implementation"
] | 1599402900 | ["7\n4\n-3 5 -3 1\n2\n1 -1\n4\n-3 2 -3 4\n4\n-1 1 1 -1\n7\n-5 7 -6 -4 17 -13 4\n6\n-1000000000 -1000000000 -1000000000 1000000000 1000000000 1000000000\n1\n0"] | NotePossible strategy for the first test case: Do $$$(i=2, j=3)$$$ three times (free), $$$a = [-3, 2, 0, 1]$$$. Do $$$(i=2, j=1)$$$ two times (pay two coins), $$$a = [-1, 0, 0, 1]$$$. Do $$$(i=4, j=1)$$$ one time (pay one coin), $$$a = [0, 0, 0, 0]$$$. | PASSED | 1,000 | standard input | 1 second | Each test contains multiple test cases. The first line contains the number of test cases $$$t$$$ ($$$1 \le t \le 5000$$$). Description of the test cases follows. The first line of each test case contains an integer $$$n$$$ ($$$1 \le n \le 10^5$$$) — the number of elements. The next line contains $$$n$$$ integers $$$a_... | ["3\n0\n4\n1\n8\n3000000000\n0"] | #include<stdio.h>
int main()
{
int n, i, x, t;
long long int sum;
scanf("%d", &t);
while (t--)
{
scanf("%d", &n);
sum = 0;
for (i = 0; i<n; i++)
{
scanf("%d", &x);
sum += x;
if (sum < 0)
{
sum = 0;
}
}
printf("%lld\n", sum);
}
return 0;
} | |
You're given an array $$$a$$$ of $$$n$$$ integers, such that $$$a_1 + a_2 + \cdots + a_n = 0$$$.In one operation, you can choose two different indices $$$i$$$ and $$$j$$$ ($$$1 \le i, j \le n$$$), decrement $$$a_i$$$ by one and increment $$$a_j$$$ by one. If $$$i < j$$$ this operation is free, otherwise it costs one... | For each test case, print the minimum number of coins we have to spend in order to make all elements equal to $$$0$$$. | C | bd0b14e53ade1207022464ebafdf8c9a | 4c2b77b8692e88f868bb300bbd694c84 | GNU C11 | standard output | 256 megabytes | train_002.jsonl | [
"constructive algorithms",
"implementation"
] | 1599402900 | ["7\n4\n-3 5 -3 1\n2\n1 -1\n4\n-3 2 -3 4\n4\n-1 1 1 -1\n7\n-5 7 -6 -4 17 -13 4\n6\n-1000000000 -1000000000 -1000000000 1000000000 1000000000 1000000000\n1\n0"] | NotePossible strategy for the first test case: Do $$$(i=2, j=3)$$$ three times (free), $$$a = [-3, 2, 0, 1]$$$. Do $$$(i=2, j=1)$$$ two times (pay two coins), $$$a = [-1, 0, 0, 1]$$$. Do $$$(i=4, j=1)$$$ one time (pay one coin), $$$a = [0, 0, 0, 0]$$$. | PASSED | 1,000 | standard input | 1 second | Each test contains multiple test cases. The first line contains the number of test cases $$$t$$$ ($$$1 \le t \le 5000$$$). Description of the test cases follows. The first line of each test case contains an integer $$$n$$$ ($$$1 \le n \le 10^5$$$) — the number of elements. The next line contains $$$n$$$ integers $$$a_... | ["3\n0\n4\n1\n8\n3000000000\n0"] | #include<stdio.h>
#include<math.h>
int main()
{
long long int t,i,j,n,a[1000000],b[1000000],p;
scanf("%lld",&t);
while(t--)
{
scanf("%lld",&n);
for(i=1;i<=n;i++)
scanf("%lld",&a[i]);
for(i=1;i<=n;i++)
if(a[i]>=0)
{ j=i; break;}
p=a[j];
for... | |
You're given an array $$$a$$$ of $$$n$$$ integers, such that $$$a_1 + a_2 + \cdots + a_n = 0$$$.In one operation, you can choose two different indices $$$i$$$ and $$$j$$$ ($$$1 \le i, j \le n$$$), decrement $$$a_i$$$ by one and increment $$$a_j$$$ by one. If $$$i < j$$$ this operation is free, otherwise it costs one... | For each test case, print the minimum number of coins we have to spend in order to make all elements equal to $$$0$$$. | C | bd0b14e53ade1207022464ebafdf8c9a | 8f3948a51022a273607b0eb62d955705 | GNU C11 | standard output | 256 megabytes | train_002.jsonl | [
"constructive algorithms",
"implementation"
] | 1599402900 | ["7\n4\n-3 5 -3 1\n2\n1 -1\n4\n-3 2 -3 4\n4\n-1 1 1 -1\n7\n-5 7 -6 -4 17 -13 4\n6\n-1000000000 -1000000000 -1000000000 1000000000 1000000000 1000000000\n1\n0"] | NotePossible strategy for the first test case: Do $$$(i=2, j=3)$$$ three times (free), $$$a = [-3, 2, 0, 1]$$$. Do $$$(i=2, j=1)$$$ two times (pay two coins), $$$a = [-1, 0, 0, 1]$$$. Do $$$(i=4, j=1)$$$ one time (pay one coin), $$$a = [0, 0, 0, 0]$$$. | PASSED | 1,000 | standard input | 1 second | Each test contains multiple test cases. The first line contains the number of test cases $$$t$$$ ($$$1 \le t \le 5000$$$). Description of the test cases follows. The first line of each test case contains an integer $$$n$$$ ($$$1 \le n \le 10^5$$$) — the number of elements. The next line contains $$$n$$$ integers $$$a_... | ["3\n0\n4\n1\n8\n3000000000\n0"] | #include<stdio.h>
int main()
{
int test;
scanf("%d",&test);
while(test--)
{
long long int m,j,d=0,sum1=0,sum2=0,i=0,x;
scanf("%lld",&m);
for(j=0;j<m;j++)
{
scanf("%lld",&x);
if(x>0)
{
sum1=sum1+x;
... | |
You're given an array $$$a$$$ of $$$n$$$ integers, such that $$$a_1 + a_2 + \cdots + a_n = 0$$$.In one operation, you can choose two different indices $$$i$$$ and $$$j$$$ ($$$1 \le i, j \le n$$$), decrement $$$a_i$$$ by one and increment $$$a_j$$$ by one. If $$$i < j$$$ this operation is free, otherwise it costs one... | For each test case, print the minimum number of coins we have to spend in order to make all elements equal to $$$0$$$. | C | bd0b14e53ade1207022464ebafdf8c9a | cbdc5543bbeae392c49f36bfa9bd8f96 | GNU C11 | standard output | 256 megabytes | train_002.jsonl | [
"constructive algorithms",
"implementation"
] | 1599402900 | ["7\n4\n-3 5 -3 1\n2\n1 -1\n4\n-3 2 -3 4\n4\n-1 1 1 -1\n7\n-5 7 -6 -4 17 -13 4\n6\n-1000000000 -1000000000 -1000000000 1000000000 1000000000 1000000000\n1\n0"] | NotePossible strategy for the first test case: Do $$$(i=2, j=3)$$$ three times (free), $$$a = [-3, 2, 0, 1]$$$. Do $$$(i=2, j=1)$$$ two times (pay two coins), $$$a = [-1, 0, 0, 1]$$$. Do $$$(i=4, j=1)$$$ one time (pay one coin), $$$a = [0, 0, 0, 0]$$$. | PASSED | 1,000 | standard input | 1 second | Each test contains multiple test cases. The first line contains the number of test cases $$$t$$$ ($$$1 \le t \le 5000$$$). Description of the test cases follows. The first line of each test case contains an integer $$$n$$$ ($$$1 \le n \le 10^5$$$) — the number of elements. The next line contains $$$n$$$ integers $$$a_... | ["3\n0\n4\n1\n8\n3000000000\n0"] | #include<stdio.h>
typedef long long ll;
ll nnn(ll a,ll b)
{
return a<b?a:b;
}
int main()
{
int t;
scanf("%d",&t);
while(t--)
{
int n;
scanf("%d",&n);
ll ar[n],tmp=0,cnt=0;
for(int i=0;i<n;i++)
scanf("%lld",&ar[i]);
for(int i=0;i<n;i++)
{
if(ar[i]>=0)
tmp+=ar[i];
e... | |
You're given an array $$$a$$$ of $$$n$$$ integers, such that $$$a_1 + a_2 + \cdots + a_n = 0$$$.In one operation, you can choose two different indices $$$i$$$ and $$$j$$$ ($$$1 \le i, j \le n$$$), decrement $$$a_i$$$ by one and increment $$$a_j$$$ by one. If $$$i < j$$$ this operation is free, otherwise it costs one... | For each test case, print the minimum number of coins we have to spend in order to make all elements equal to $$$0$$$. | C | bd0b14e53ade1207022464ebafdf8c9a | f37bfe2f5ac17af1a445cb7fd727b331 | GNU C11 | standard output | 256 megabytes | train_002.jsonl | [
"constructive algorithms",
"implementation"
] | 1599402900 | ["7\n4\n-3 5 -3 1\n2\n1 -1\n4\n-3 2 -3 4\n4\n-1 1 1 -1\n7\n-5 7 -6 -4 17 -13 4\n6\n-1000000000 -1000000000 -1000000000 1000000000 1000000000 1000000000\n1\n0"] | NotePossible strategy for the first test case: Do $$$(i=2, j=3)$$$ three times (free), $$$a = [-3, 2, 0, 1]$$$. Do $$$(i=2, j=1)$$$ two times (pay two coins), $$$a = [-1, 0, 0, 1]$$$. Do $$$(i=4, j=1)$$$ one time (pay one coin), $$$a = [0, 0, 0, 0]$$$. | PASSED | 1,000 | standard input | 1 second | Each test contains multiple test cases. The first line contains the number of test cases $$$t$$$ ($$$1 \le t \le 5000$$$). Description of the test cases follows. The first line of each test case contains an integer $$$n$$$ ($$$1 \le n \le 10^5$$$) — the number of elements. The next line contains $$$n$$$ integers $$$a_... | ["3\n0\n4\n1\n8\n3000000000\n0"] | #include<stdio.h>
#include<math.h>
#include<string.h>
int main()
{
long long int i,a,b,j,y,x,m,cur=0,n,t,c1,c2,n1,n2,m1,m2,te,tem,temp,ar[200005];
scanf("%lld",&t);
for(i=0;i<t;i++)
{
long long int sum=0,max=0,ans=0,tl=0,k=1,w=0;
scanf("%lld",&n);
for(j=0;j<n;j++)
{
... | |
You're given an array $$$a$$$ of $$$n$$$ integers, such that $$$a_1 + a_2 + \cdots + a_n = 0$$$.In one operation, you can choose two different indices $$$i$$$ and $$$j$$$ ($$$1 \le i, j \le n$$$), decrement $$$a_i$$$ by one and increment $$$a_j$$$ by one. If $$$i < j$$$ this operation is free, otherwise it costs one... | For each test case, print the minimum number of coins we have to spend in order to make all elements equal to $$$0$$$. | C | bd0b14e53ade1207022464ebafdf8c9a | 0fa8eec93149c98833f467aaeb448ad7 | GNU C11 | standard output | 256 megabytes | train_002.jsonl | [
"constructive algorithms",
"implementation"
] | 1599402900 | ["7\n4\n-3 5 -3 1\n2\n1 -1\n4\n-3 2 -3 4\n4\n-1 1 1 -1\n7\n-5 7 -6 -4 17 -13 4\n6\n-1000000000 -1000000000 -1000000000 1000000000 1000000000 1000000000\n1\n0"] | NotePossible strategy for the first test case: Do $$$(i=2, j=3)$$$ three times (free), $$$a = [-3, 2, 0, 1]$$$. Do $$$(i=2, j=1)$$$ two times (pay two coins), $$$a = [-1, 0, 0, 1]$$$. Do $$$(i=4, j=1)$$$ one time (pay one coin), $$$a = [0, 0, 0, 0]$$$. | PASSED | 1,000 | standard input | 1 second | Each test contains multiple test cases. The first line contains the number of test cases $$$t$$$ ($$$1 \le t \le 5000$$$). Description of the test cases follows. The first line of each test case contains an integer $$$n$$$ ($$$1 \le n \le 10^5$$$) — the number of elements. The next line contains $$$n$$$ integers $$$a_... | ["3\n0\n4\n1\n8\n3000000000\n0"] | #include<stdio.h>
int main(){
int t; scanf("%d",&t);
while(t--){
int n; scanf("%d",&n);
long long int a[n];
for(int i=0;i<n;i++){scanf("%lld",&a[i]);}
long long int count=0,sum=0;
for(int i=n-1;i>=0;i--){
if(a[i]<0){sum=sum-a[i];}
else if(a[i]>0){
if(sum>=a[i]){sum=sum-a[i];}
else{
count=count+a[i]-sum; sum=0;
}
}
}
pr... | |
You're given an array $$$a$$$ of $$$n$$$ integers, such that $$$a_1 + a_2 + \cdots + a_n = 0$$$.In one operation, you can choose two different indices $$$i$$$ and $$$j$$$ ($$$1 \le i, j \le n$$$), decrement $$$a_i$$$ by one and increment $$$a_j$$$ by one. If $$$i < j$$$ this operation is free, otherwise it costs one... | For each test case, print the minimum number of coins we have to spend in order to make all elements equal to $$$0$$$. | C | bd0b14e53ade1207022464ebafdf8c9a | 3e8078aabe900c191d499088cb3dd425 | GNU C11 | standard output | 256 megabytes | train_002.jsonl | [
"constructive algorithms",
"implementation"
] | 1599402900 | ["7\n4\n-3 5 -3 1\n2\n1 -1\n4\n-3 2 -3 4\n4\n-1 1 1 -1\n7\n-5 7 -6 -4 17 -13 4\n6\n-1000000000 -1000000000 -1000000000 1000000000 1000000000 1000000000\n1\n0"] | NotePossible strategy for the first test case: Do $$$(i=2, j=3)$$$ three times (free), $$$a = [-3, 2, 0, 1]$$$. Do $$$(i=2, j=1)$$$ two times (pay two coins), $$$a = [-1, 0, 0, 1]$$$. Do $$$(i=4, j=1)$$$ one time (pay one coin), $$$a = [0, 0, 0, 0]$$$. | PASSED | 1,000 | standard input | 1 second | Each test contains multiple test cases. The first line contains the number of test cases $$$t$$$ ($$$1 \le t \le 5000$$$). Description of the test cases follows. The first line of each test case contains an integer $$$n$$$ ($$$1 \le n \le 10^5$$$) — the number of elements. The next line contains $$$n$$$ integers $$$a_... | ["3\n0\n4\n1\n8\n3000000000\n0"] | // 1405/B Array Cancellation
#include <stdio.h>
int main() {
int t,n;
long long tmp, sum;
scanf("%d",&t);
while (t--){
sum = 0;
scanf("%d",&n);
for (int i = 0; i < n; i++) {
scanf("%lld",&tmp);
sum += tmp;
if (sum < 0) {
sum... | |
You're given an array $$$a$$$ of $$$n$$$ integers, such that $$$a_1 + a_2 + \cdots + a_n = 0$$$.In one operation, you can choose two different indices $$$i$$$ and $$$j$$$ ($$$1 \le i, j \le n$$$), decrement $$$a_i$$$ by one and increment $$$a_j$$$ by one. If $$$i < j$$$ this operation is free, otherwise it costs one... | For each test case, print the minimum number of coins we have to spend in order to make all elements equal to $$$0$$$. | C | bd0b14e53ade1207022464ebafdf8c9a | c3f678536d035a775d80c722a02fbcec | GNU C11 | standard output | 256 megabytes | train_002.jsonl | [
"constructive algorithms",
"implementation"
] | 1599402900 | ["7\n4\n-3 5 -3 1\n2\n1 -1\n4\n-3 2 -3 4\n4\n-1 1 1 -1\n7\n-5 7 -6 -4 17 -13 4\n6\n-1000000000 -1000000000 -1000000000 1000000000 1000000000 1000000000\n1\n0"] | NotePossible strategy for the first test case: Do $$$(i=2, j=3)$$$ three times (free), $$$a = [-3, 2, 0, 1]$$$. Do $$$(i=2, j=1)$$$ two times (pay two coins), $$$a = [-1, 0, 0, 1]$$$. Do $$$(i=4, j=1)$$$ one time (pay one coin), $$$a = [0, 0, 0, 0]$$$. | PASSED | 1,000 | standard input | 1 second | Each test contains multiple test cases. The first line contains the number of test cases $$$t$$$ ($$$1 \le t \le 5000$$$). Description of the test cases follows. The first line of each test case contains an integer $$$n$$$ ($$$1 \le n \le 10^5$$$) — the number of elements. The next line contains $$$n$$$ integers $$$a_... | ["3\n0\n4\n1\n8\n3000000000\n0"] | #include <stdio.h>
#include <stdlib.h>
long long int min(long long int a,long long int b)
{
if(a<=b)
return(a);
else
return(b);
}
int main()
{
int t,i;
scanf("%d",&t);
for(i=0;i<t;i++)
{
long long int n,p=0,ans=0;scanf("%lld",&n);long long int a[n],j,k;for(j=0;j<n;j++)sc... | |
In a far away kingdom lived the King, the Prince, the Shoemaker, the Dressmaker and many other citizens. They lived happily until great trouble came into the Kingdom. The ACMers settled there.Most damage those strange creatures inflicted upon the kingdom was that they loved high precision numbers. As a result, the King... | If the last number of the integer part is not equal to 9, print the rounded-up number without leading zeroes. Otherwise, print the message "GOTO Vasilisa." (without the quotes). | C | 3060ecad253a2b4d4fac39e91fcd6c95 | 3b5bf871fe7e4f77874cc0cff1d55a73 | GNU C | standard output | 256 megabytes | train_002.jsonl | [
"strings"
] | 1311346800 | ["0.0", "1.49", "1.50", "2.71828182845904523536", "3.14159265358979323846", "12345678901234567890.1", "123456789123456789.999"] | null | PASSED | 800 | standard input | 2 seconds | The first line contains a single number to round up — the integer part (a non-empty set of decimal digits that do not start with 0 — with the exception of a case when the set consists of a single digit — in this case 0 can go first), then follows character «.» (a dot), and then follows the fractional part (any non-empt... | ["0", "1", "2", "3", "3", "12345678901234567890", "GOTO Vasilisa."] | #include<stdio.h>
int main()
{char a[10000];
scanf("%s",a);
int j,i,k;
while(a[i]!='.')
i++;
if(a[i-1]<'9')
{
if(a[i+1]>='5')
a[i-1]++;
for(k=0;k<i;k++)
printf("%c",a[k]);}
else printf("GOTO Vasilisa.");
return 0;
} | |
In a far away kingdom lived the King, the Prince, the Shoemaker, the Dressmaker and many other citizens. They lived happily until great trouble came into the Kingdom. The ACMers settled there.Most damage those strange creatures inflicted upon the kingdom was that they loved high precision numbers. As a result, the King... | If the last number of the integer part is not equal to 9, print the rounded-up number without leading zeroes. Otherwise, print the message "GOTO Vasilisa." (without the quotes). | C | 3060ecad253a2b4d4fac39e91fcd6c95 | 8625b8ee68b626ce37b243937acb6cbb | GNU C | standard output | 256 megabytes | train_002.jsonl | [
"strings"
] | 1311346800 | ["0.0", "1.49", "1.50", "2.71828182845904523536", "3.14159265358979323846", "12345678901234567890.1", "123456789123456789.999"] | null | PASSED | 800 | standard input | 2 seconds | The first line contains a single number to round up — the integer part (a non-empty set of decimal digits that do not start with 0 — with the exception of a case when the set consists of a single digit — in this case 0 can go first), then follows character «.» (a dot), and then follows the fractional part (any non-empt... | ["0", "1", "2", "3", "3", "12345678901234567890", "GOTO Vasilisa."] | #include <stdio.h>
#include <string.h>
int main()
{
char s1[1000], s2[1000];
scanf("%[^.].%s", s1, s2);
if (s1[strlen(s1) - 1] == '9')
printf("GOTO Vasilisa.");
else
if (s2[0] < '5')
printf("%s", s1);
else
s1[strlen(s1) - 1]++, printf("%s", s1);
re... | |
In a far away kingdom lived the King, the Prince, the Shoemaker, the Dressmaker and many other citizens. They lived happily until great trouble came into the Kingdom. The ACMers settled there.Most damage those strange creatures inflicted upon the kingdom was that they loved high precision numbers. As a result, the King... | If the last number of the integer part is not equal to 9, print the rounded-up number without leading zeroes. Otherwise, print the message "GOTO Vasilisa." (without the quotes). | C | 3060ecad253a2b4d4fac39e91fcd6c95 | f427d964840fe070a85e0d5189dc4cdb | GNU C | standard output | 256 megabytes | train_002.jsonl | [
"strings"
] | 1311346800 | ["0.0", "1.49", "1.50", "2.71828182845904523536", "3.14159265358979323846", "12345678901234567890.1", "123456789123456789.999"] | null | PASSED | 800 | standard input | 2 seconds | The first line contains a single number to round up — the integer part (a non-empty set of decimal digits that do not start with 0 — with the exception of a case when the set consists of a single digit — in this case 0 can go first), then follows character «.» (a dot), and then follows the fractional part (any non-empt... | ["0", "1", "2", "3", "3", "12345678901234567890", "GOTO Vasilisa."] | #include<stdio.h>
#include<string.h>
int main()
{
int l,i,j,k;
char cg[1002];
scanf("%s",cg);
l=strlen(cg);
for(i=0;i<l;i++)
{
if(cg[i]=='.')
{
k=i;
break;
}
}
if((int)cg[i-1]!=(int)'9')
{
if((int)cg[i+1]<(int)'5')
{
... | |
In a far away kingdom lived the King, the Prince, the Shoemaker, the Dressmaker and many other citizens. They lived happily until great trouble came into the Kingdom. The ACMers settled there.Most damage those strange creatures inflicted upon the kingdom was that they loved high precision numbers. As a result, the King... | If the last number of the integer part is not equal to 9, print the rounded-up number without leading zeroes. Otherwise, print the message "GOTO Vasilisa." (without the quotes). | C | 3060ecad253a2b4d4fac39e91fcd6c95 | f5ff96c6549b18f971a77cee2d7580f5 | GNU C | standard output | 256 megabytes | train_002.jsonl | [
"strings"
] | 1311346800 | ["0.0", "1.49", "1.50", "2.71828182845904523536", "3.14159265358979323846", "12345678901234567890.1", "123456789123456789.999"] | null | PASSED | 800 | standard input | 2 seconds | The first line contains a single number to round up — the integer part (a non-empty set of decimal digits that do not start with 0 — with the exception of a case when the set consists of a single digit — in this case 0 can go first), then follows character «.» (a dot), and then follows the fractional part (any non-empt... | ["0", "1", "2", "3", "3", "12345678901234567890", "GOTO Vasilisa."] | #include<stdio.h>
#include<string.h>
int main(void){
char str[1024];
int i,j,k;
fgets(str,sizeof(str)/sizeof(char),stdin);
for(i=0;i<strlen(str);i++){
if(str[i]=='.'){
if(str[i-1]=='9'){
puts("GOTO Vasilisa.");
return 0;
}
if(str[i+1]>='5'){
str[i-1]++;
}
for(j=0;j<i;j++)... | |
In a far away kingdom lived the King, the Prince, the Shoemaker, the Dressmaker and many other citizens. They lived happily until great trouble came into the Kingdom. The ACMers settled there.Most damage those strange creatures inflicted upon the kingdom was that they loved high precision numbers. As a result, the King... | If the last number of the integer part is not equal to 9, print the rounded-up number without leading zeroes. Otherwise, print the message "GOTO Vasilisa." (without the quotes). | C | 3060ecad253a2b4d4fac39e91fcd6c95 | 004b1f73f178e308839029c55eed637b | GNU C | standard output | 256 megabytes | train_002.jsonl | [
"strings"
] | 1311346800 | ["0.0", "1.49", "1.50", "2.71828182845904523536", "3.14159265358979323846", "12345678901234567890.1", "123456789123456789.999"] | null | PASSED | 800 | standard input | 2 seconds | The first line contains a single number to round up — the integer part (a non-empty set of decimal digits that do not start with 0 — with the exception of a case when the set consists of a single digit — in this case 0 can go first), then follows character «.» (a dot), and then follows the fractional part (any non-empt... | ["0", "1", "2", "3", "3", "12345678901234567890", "GOTO Vasilisa."] | #include <stdio.h>
#include <string.h>
int main(int argc, char *argv[])
{
int dot ;
char number[2000] ;
scanf("%s", number) ;
dot = 0 ;
while (number[dot] != '.')
{
dot++ ;
}
number[dot] = '\0' ;
if (number[dot - 1] < '9')
{
if (number[dot + 1] < '5')
{
printf("%s", number) ;
}
else... | |
In a far away kingdom lived the King, the Prince, the Shoemaker, the Dressmaker and many other citizens. They lived happily until great trouble came into the Kingdom. The ACMers settled there.Most damage those strange creatures inflicted upon the kingdom was that they loved high precision numbers. As a result, the King... | If the last number of the integer part is not equal to 9, print the rounded-up number without leading zeroes. Otherwise, print the message "GOTO Vasilisa." (without the quotes). | C | 3060ecad253a2b4d4fac39e91fcd6c95 | 15a4072eca787526cf0290b21421c38e | GNU C | standard output | 256 megabytes | train_002.jsonl | [
"strings"
] | 1311346800 | ["0.0", "1.49", "1.50", "2.71828182845904523536", "3.14159265358979323846", "12345678901234567890.1", "123456789123456789.999"] | null | PASSED | 800 | standard input | 2 seconds | The first line contains a single number to round up — the integer part (a non-empty set of decimal digits that do not start with 0 — with the exception of a case when the set consists of a single digit — in this case 0 can go first), then follows character «.» (a dot), and then follows the fractional part (any non-empt... | ["0", "1", "2", "3", "3", "12345678901234567890", "GOTO Vasilisa."] | #include <stdio.h>
#include <stdlib.h>
#include <string.h>
int main()
{
char s[1001];
int i,j;
scanf("%s",s);
i=0;
while(s[i]!='.')
i++;
//printf("i=%d",i);
if(s[i-1]=='9')
printf("GOTO Vasilisa.");
else
{
// i++;
for(j=0;j<=i-2;j++)
printf("%c",s[j]);
/... | |
In a far away kingdom lived the King, the Prince, the Shoemaker, the Dressmaker and many other citizens. They lived happily until great trouble came into the Kingdom. The ACMers settled there.Most damage those strange creatures inflicted upon the kingdom was that they loved high precision numbers. As a result, the King... | If the last number of the integer part is not equal to 9, print the rounded-up number without leading zeroes. Otherwise, print the message "GOTO Vasilisa." (without the quotes). | C | 3060ecad253a2b4d4fac39e91fcd6c95 | de4c3ff7faa06de333d94b526ff425e7 | GNU C | standard output | 256 megabytes | train_002.jsonl | [
"strings"
] | 1311346800 | ["0.0", "1.49", "1.50", "2.71828182845904523536", "3.14159265358979323846", "12345678901234567890.1", "123456789123456789.999"] | null | PASSED | 800 | standard input | 2 seconds | The first line contains a single number to round up — the integer part (a non-empty set of decimal digits that do not start with 0 — with the exception of a case when the set consists of a single digit — in this case 0 can go first), then follows character «.» (a dot), and then follows the fractional part (any non-empt... | ["0", "1", "2", "3", "3", "12345678901234567890", "GOTO Vasilisa."] | #include<stdio.h>
#include<string.h>
int main()
{
char a[1001];
int i,l;
while(gets(a))
{
for(i=0;a[i]!='.';i++);
l=i;
if(a[l-1]=='9')
puts("GOTO Vasilisa.");
else if(a[i+1]-'0'<5)
{
... | |
In a far away kingdom lived the King, the Prince, the Shoemaker, the Dressmaker and many other citizens. They lived happily until great trouble came into the Kingdom. The ACMers settled there.Most damage those strange creatures inflicted upon the kingdom was that they loved high precision numbers. As a result, the King... | If the last number of the integer part is not equal to 9, print the rounded-up number without leading zeroes. Otherwise, print the message "GOTO Vasilisa." (without the quotes). | C | 3060ecad253a2b4d4fac39e91fcd6c95 | c337a558ceedb0fee5ae4b770a5b80a6 | GNU C | standard output | 256 megabytes | train_002.jsonl | [
"strings"
] | 1311346800 | ["0.0", "1.49", "1.50", "2.71828182845904523536", "3.14159265358979323846", "12345678901234567890.1", "123456789123456789.999"] | null | PASSED | 800 | standard input | 2 seconds | The first line contains a single number to round up — the integer part (a non-empty set of decimal digits that do not start with 0 — with the exception of a case when the set consists of a single digit — in this case 0 can go first), then follows character «.» (a dot), and then follows the fractional part (any non-empt... | ["0", "1", "2", "3", "3", "12345678901234567890", "GOTO Vasilisa."] | #include <stdio.h>
#include <stdlib.h>
#include <math.h>
int main()
{
char ch[1001];
scanf("%s",ch);
int i;
for(i=0;ch[i]!='.';i++);
ch[i]='\0';
if(ch[i-1]=='9')
{
printf("%s","GOTO Vasilisa.");
}
else
{
if(ch[i+1]<'5')
{
printf("%s",ch);
... | |
In a far away kingdom lived the King, the Prince, the Shoemaker, the Dressmaker and many other citizens. They lived happily until great trouble came into the Kingdom. The ACMers settled there.Most damage those strange creatures inflicted upon the kingdom was that they loved high precision numbers. As a result, the King... | If the last number of the integer part is not equal to 9, print the rounded-up number without leading zeroes. Otherwise, print the message "GOTO Vasilisa." (without the quotes). | C | 3060ecad253a2b4d4fac39e91fcd6c95 | a209c2309ac687c5a40c09c3842b0a17 | GNU C | standard output | 256 megabytes | train_002.jsonl | [
"strings"
] | 1311346800 | ["0.0", "1.49", "1.50", "2.71828182845904523536", "3.14159265358979323846", "12345678901234567890.1", "123456789123456789.999"] | null | PASSED | 800 | standard input | 2 seconds | The first line contains a single number to round up — the integer part (a non-empty set of decimal digits that do not start with 0 — with the exception of a case when the set consists of a single digit — in this case 0 can go first), then follows character «.» (a dot), and then follows the fractional part (any non-empt... | ["0", "1", "2", "3", "3", "12345678901234567890", "GOTO Vasilisa."] | #include <stdio.h>
#include <stdlib.h>
#include <math.h>
int main()
{
char ch[1001];
scanf("%s",ch);
int i;
for(i=0;ch[i]!='.';i++);
ch[i]='\0';
if(ch[i-1]=='9')
{
printf("%s","GOTO Vasilisa.");
}
else
{
if(ch[i+1]<'5')
{
printf("%s",ch);
... | |
In a far away kingdom lived the King, the Prince, the Shoemaker, the Dressmaker and many other citizens. They lived happily until great trouble came into the Kingdom. The ACMers settled there.Most damage those strange creatures inflicted upon the kingdom was that they loved high precision numbers. As a result, the King... | If the last number of the integer part is not equal to 9, print the rounded-up number without leading zeroes. Otherwise, print the message "GOTO Vasilisa." (without the quotes). | C | 3060ecad253a2b4d4fac39e91fcd6c95 | de39714be5b7aff5d5da8db5f8629bec | GNU C | standard output | 256 megabytes | train_002.jsonl | [
"strings"
] | 1311346800 | ["0.0", "1.49", "1.50", "2.71828182845904523536", "3.14159265358979323846", "12345678901234567890.1", "123456789123456789.999"] | null | PASSED | 800 | standard input | 2 seconds | The first line contains a single number to round up — the integer part (a non-empty set of decimal digits that do not start with 0 — with the exception of a case when the set consists of a single digit — in this case 0 can go first), then follows character «.» (a dot), and then follows the fractional part (any non-empt... | ["0", "1", "2", "3", "3", "12345678901234567890", "GOTO Vasilisa."] | #include <stdio.h>
main() {
char s[1001];
int pos, i = 0;
scanf("%s", s);
while(s[pos] != '.') pos++;
if (s[pos - 1] == '9') {
printf("GOTO Vasilisa.");
return 0;
}
i = 0;
while (i != pos -1) {
printf("%c", s[i]);
i++;
}
printf("%c", s[pos + 1]... | |
In a far away kingdom lived the King, the Prince, the Shoemaker, the Dressmaker and many other citizens. They lived happily until great trouble came into the Kingdom. The ACMers settled there.Most damage those strange creatures inflicted upon the kingdom was that they loved high precision numbers. As a result, the King... | If the last number of the integer part is not equal to 9, print the rounded-up number without leading zeroes. Otherwise, print the message "GOTO Vasilisa." (without the quotes). | C | 3060ecad253a2b4d4fac39e91fcd6c95 | e21c3acc374969dc69035335bdccffea | GNU C | standard output | 256 megabytes | train_002.jsonl | [
"strings"
] | 1311346800 | ["0.0", "1.49", "1.50", "2.71828182845904523536", "3.14159265358979323846", "12345678901234567890.1", "123456789123456789.999"] | null | PASSED | 800 | standard input | 2 seconds | The first line contains a single number to round up — the integer part (a non-empty set of decimal digits that do not start with 0 — with the exception of a case when the set consists of a single digit — in this case 0 can go first), then follows character «.» (a dot), and then follows the fractional part (any non-empt... | ["0", "1", "2", "3", "3", "12345678901234567890", "GOTO Vasilisa."] | #include<stdio.h>
int main()
{
char s[1001];
scanf(" %s", s);
int dot;
for(int i = 0; ; i++)
{
if(s[i] == '.')
{
dot = i;
break;
}
}
if(s[dot-1] == '9')
{
printf("GOTO Vasilisa.\n");
return 0;
}
if(s[dot+1] >= '5')
s[dot-1] = s[dot-1] +1;
for(int i = 0; i < dot; i++)
printf("%c... | |
In a far away kingdom lived the King, the Prince, the Shoemaker, the Dressmaker and many other citizens. They lived happily until great trouble came into the Kingdom. The ACMers settled there.Most damage those strange creatures inflicted upon the kingdom was that they loved high precision numbers. As a result, the King... | If the last number of the integer part is not equal to 9, print the rounded-up number without leading zeroes. Otherwise, print the message "GOTO Vasilisa." (without the quotes). | C | 3060ecad253a2b4d4fac39e91fcd6c95 | c565f363236d6c44bd9fa2212604ecc5 | GNU C | standard output | 256 megabytes | train_002.jsonl | [
"strings"
] | 1311346800 | ["0.0", "1.49", "1.50", "2.71828182845904523536", "3.14159265358979323846", "12345678901234567890.1", "123456789123456789.999"] | null | PASSED | 800 | standard input | 2 seconds | The first line contains a single number to round up — the integer part (a non-empty set of decimal digits that do not start with 0 — with the exception of a case when the set consists of a single digit — in this case 0 can go first), then follows character «.» (a dot), and then follows the fractional part (any non-empt... | ["0", "1", "2", "3", "3", "12345678901234567890", "GOTO Vasilisa."] | #include<stdio.h>
int main()
{
char s[1002];
int ans;
int i,j,l;
scanf("%s",&s);
for(i=0;s[i]!='\0';i++)
{
if(s[i]=='.')
break;
}
l=i;
if(s[l-1]=='9')
{
printf("GOTO Vasilisa.\n");
}
else if(s[l+1]<'5')
{
for(i=0;i<l;i++)
... | |
In a far away kingdom lived the King, the Prince, the Shoemaker, the Dressmaker and many other citizens. They lived happily until great trouble came into the Kingdom. The ACMers settled there.Most damage those strange creatures inflicted upon the kingdom was that they loved high precision numbers. As a result, the King... | If the last number of the integer part is not equal to 9, print the rounded-up number without leading zeroes. Otherwise, print the message "GOTO Vasilisa." (without the quotes). | C | 3060ecad253a2b4d4fac39e91fcd6c95 | 1ab076400693b376237c73aaed19e479 | GNU C | standard output | 256 megabytes | train_002.jsonl | [
"strings"
] | 1311346800 | ["0.0", "1.49", "1.50", "2.71828182845904523536", "3.14159265358979323846", "12345678901234567890.1", "123456789123456789.999"] | null | PASSED | 800 | standard input | 2 seconds | The first line contains a single number to round up — the integer part (a non-empty set of decimal digits that do not start with 0 — with the exception of a case when the set consists of a single digit — in this case 0 can go first), then follows character «.» (a dot), and then follows the fractional part (any non-empt... | ["0", "1", "2", "3", "3", "12345678901234567890", "GOTO Vasilisa."] | #include <stdio.h>
#include <string.h>
int main()
{
char s1[1000], s2[1000];
int i;
scanf("%[^.]%*c%s", s1, s2);
if (s1[strlen(s1) - 1] == '9') {
puts("GOTO Vasilisa.");
} else {
for (i = 0; i < strlen(s1) - 1; i++) printf("%c", s1[i]);
if (s2[0] >= '5') {
printf("%c\n", s1[i] + 1);
} e... | |
In a far away kingdom lived the King, the Prince, the Shoemaker, the Dressmaker and many other citizens. They lived happily until great trouble came into the Kingdom. The ACMers settled there.Most damage those strange creatures inflicted upon the kingdom was that they loved high precision numbers. As a result, the King... | If the last number of the integer part is not equal to 9, print the rounded-up number without leading zeroes. Otherwise, print the message "GOTO Vasilisa." (without the quotes). | C | 3060ecad253a2b4d4fac39e91fcd6c95 | 9cf575cec42b04355865a0a792ef321f | GNU C | standard output | 256 megabytes | train_002.jsonl | [
"strings"
] | 1311346800 | ["0.0", "1.49", "1.50", "2.71828182845904523536", "3.14159265358979323846", "12345678901234567890.1", "123456789123456789.999"] | null | PASSED | 800 | standard input | 2 seconds | The first line contains a single number to round up — the integer part (a non-empty set of decimal digits that do not start with 0 — with the exception of a case when the set consists of a single digit — in this case 0 can go first), then follows character «.» (a dot), and then follows the fractional part (any non-empt... | ["0", "1", "2", "3", "3", "12345678901234567890", "GOTO Vasilisa."] | #include<stdio.h>
//#include<conio.h>
#include<string.h>
main()
{
char str[1001];
scanf("%s",&str);
int len=strlen(str);
int i=0,j;
while(str[i]!='.')
{
i++;
}
int k=i;
if(str[k-1]=='9')
printf("GOTO Vasilisa.");
else if(str[k+1]-48<5)
{
for(j=0;j<i;j++)
printf("%c",str[j]);
}
else if (str[k+1]-48>=5)
{
for(j=0;j<i-1... | |
In a far away kingdom lived the King, the Prince, the Shoemaker, the Dressmaker and many other citizens. They lived happily until great trouble came into the Kingdom. The ACMers settled there.Most damage those strange creatures inflicted upon the kingdom was that they loved high precision numbers. As a result, the King... | If the last number of the integer part is not equal to 9, print the rounded-up number without leading zeroes. Otherwise, print the message "GOTO Vasilisa." (without the quotes). | C | 3060ecad253a2b4d4fac39e91fcd6c95 | 9e28e40a16ec47739e7ed82f59fdc4aa | GNU C | standard output | 256 megabytes | train_002.jsonl | [
"strings"
] | 1311346800 | ["0.0", "1.49", "1.50", "2.71828182845904523536", "3.14159265358979323846", "12345678901234567890.1", "123456789123456789.999"] | null | PASSED | 800 | standard input | 2 seconds | The first line contains a single number to round up — the integer part (a non-empty set of decimal digits that do not start with 0 — with the exception of a case when the set consists of a single digit — in this case 0 can go first), then follows character «.» (a dot), and then follows the fractional part (any non-empt... | ["0", "1", "2", "3", "3", "12345678901234567890", "GOTO Vasilisa."] | #include <stdio.h>
#include <string.h>
#include <stdio.h>
#include <limits.h>
int main()
{
char s[1111];
scanf("%s", s);
char* p = strchr(s, '.');
if (p[-1] == '9') {
printf("GOTO Vasilisa.\n");
return 0;
}
*p = '\0';
if (p[1] >= '5') {
p[-1]++;
}
printf("%s\n", s);
return 0;
}
| |
In a far away kingdom lived the King, the Prince, the Shoemaker, the Dressmaker and many other citizens. They lived happily until great trouble came into the Kingdom. The ACMers settled there.Most damage those strange creatures inflicted upon the kingdom was that they loved high precision numbers. As a result, the King... | If the last number of the integer part is not equal to 9, print the rounded-up number without leading zeroes. Otherwise, print the message "GOTO Vasilisa." (without the quotes). | C | 3060ecad253a2b4d4fac39e91fcd6c95 | d2608f7caa51b337daa3b30eaa187198 | GNU C | standard output | 256 megabytes | train_002.jsonl | [
"strings"
] | 1311346800 | ["0.0", "1.49", "1.50", "2.71828182845904523536", "3.14159265358979323846", "12345678901234567890.1", "123456789123456789.999"] | null | PASSED | 800 | standard input | 2 seconds | The first line contains a single number to round up — the integer part (a non-empty set of decimal digits that do not start with 0 — with the exception of a case when the set consists of a single digit — in this case 0 can go first), then follows character «.» (a dot), and then follows the fractional part (any non-empt... | ["0", "1", "2", "3", "3", "12345678901234567890", "GOTO Vasilisa."] | #include<stdio.h>
int main()
{
char num[1001];
int i,j;
scanf("%s",num);
for(i=0;num[i]!='.';i++)
;
if(num[i-1]!='9')
{
if(num[i+1]>='5')
{
for(j=0;j<i-1;j++)
printf("%c",num[j]);
printf("%c\n",num[j]+1);
}
else
{
for(j=0;j<i;j++)
printf("%c",num[j]);
printf("\n");
}
}
else
p... | |
In a far away kingdom lived the King, the Prince, the Shoemaker, the Dressmaker and many other citizens. They lived happily until great trouble came into the Kingdom. The ACMers settled there.Most damage those strange creatures inflicted upon the kingdom was that they loved high precision numbers. As a result, the King... | If the last number of the integer part is not equal to 9, print the rounded-up number without leading zeroes. Otherwise, print the message "GOTO Vasilisa." (without the quotes). | C | 3060ecad253a2b4d4fac39e91fcd6c95 | 498c53ccf1ed1fc62278e74649eb2e57 | GNU C | standard output | 256 megabytes | train_002.jsonl | [
"strings"
] | 1311346800 | ["0.0", "1.49", "1.50", "2.71828182845904523536", "3.14159265358979323846", "12345678901234567890.1", "123456789123456789.999"] | null | PASSED | 800 | standard input | 2 seconds | The first line contains a single number to round up — the integer part (a non-empty set of decimal digits that do not start with 0 — with the exception of a case when the set consists of a single digit — in this case 0 can go first), then follows character «.» (a dot), and then follows the fractional part (any non-empt... | ["0", "1", "2", "3", "3", "12345678901234567890", "GOTO Vasilisa."] | #include<stdio.h>
#include<stdlib.h>
int main(void)
{
char num[1002],integ[1002],fract[1002];
int car,i,j,n;
int k;
gets(num);
n=strlen(num);
for(i=0;i<=n-1 && num[i]!='.';i++)
integ[i]=num[i];
integ[i]='\0';
if(i!=n-1)
{
for(j=i+1;j<=n-1;j++)
{
fract[j-i-1]=num[j];
}
fract[j]='\0';
}
n=strlen(integ);
if(integ[n-1]=='... | |
In a far away kingdom lived the King, the Prince, the Shoemaker, the Dressmaker and many other citizens. They lived happily until great trouble came into the Kingdom. The ACMers settled there.Most damage those strange creatures inflicted upon the kingdom was that they loved high precision numbers. As a result, the King... | If the last number of the integer part is not equal to 9, print the rounded-up number without leading zeroes. Otherwise, print the message "GOTO Vasilisa." (without the quotes). | C | 3060ecad253a2b4d4fac39e91fcd6c95 | bccdb93d17eabe3bf43edd44d8f01851 | GNU C | standard output | 256 megabytes | train_002.jsonl | [
"strings"
] | 1311346800 | ["0.0", "1.49", "1.50", "2.71828182845904523536", "3.14159265358979323846", "12345678901234567890.1", "123456789123456789.999"] | null | PASSED | 800 | standard input | 2 seconds | The first line contains a single number to round up — the integer part (a non-empty set of decimal digits that do not start with 0 — with the exception of a case when the set consists of a single digit — in this case 0 can go first), then follows character «.» (a dot), and then follows the fractional part (any non-empt... | ["0", "1", "2", "3", "3", "12345678901234567890", "GOTO Vasilisa."] | #include <stdio.h>
#include <string.h>
char s[1005 ] , a, b , t[1001] ;
int n , i , j , k , p , q ;
int main()
{
scanf("%s", s) ;
n = strlen(s ) ;
for ( i = 0 ; i < n ; i++)
{
if( s[i] == '.' ) break ;
else
{
t[i] = s[i] ;
}
}
t[i] = '\0' ;
... | |
Ilya is sitting in a waiting area of Metropolis airport and is bored of looking at time table that shows again and again that his plane is delayed. So he took out a sheet of paper and decided to solve some problems.First Ilya has drawn a grid of size n × n and marked n squares on it, such that no two marked squares sha... | For each query rectangle output its beauty degree on a separate line. | C | bc834c0aa602a8ba789b676affb0b33a | 06c19d481baf5537e4211cec391fa9da | GNU C11 | standard output | 512 megabytes | train_002.jsonl | [
"data structures"
] | 1504702500 | ["2 3\n1 2\n1 1 1 1\n1 1 1 2\n1 1 2 2", "4 2\n1 3 2 4\n4 1 4 4\n1 1 2 3"] | NoteThe first sample test has one beautiful rectangle that occupies the whole grid, therefore the answer to any query is 1.In the second sample test the first query rectangle intersects 3 beautiful rectangles, as shown on the picture below: There are 5 beautiful rectangles that intersect the second query rectangle, as... | PASSED | 2,100 | standard input | 2 seconds | The first line of input contains two integers n and q (2 ≤ n ≤ 200 000, 1 ≤ q ≤ 200 000) — the size of the grid and the number of query rectangles. The second line contains n integers p1, p2, ..., pn, separated by spaces (1 ≤ pi ≤ n, all pi are different), they specify grid squares marked by Ilya: in column i he has ma... | ["1\n1\n1", "3\n5"] | /* practice with Dukkha */
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#define N 200000
#define M 200000
long long aa[M];
int n, m;
struct V {
int i, j, h;
} vv[N + M];
int compare(const void *a, const void *b) {
struct V *u = (struct V *) a;
struct V *v = (struct V *) b;
return u->i != v->i ? u... | |
Goa'uld Apophis captured Jack O'Neill's team again! Jack himself was able to escape, but by that time Apophis's ship had already jumped to hyperspace. But Jack knows on what planet will Apophis land. In order to save his friends, Jack must repeatedly go through stargates to get to this planet.Overall the galaxy has n p... | Print a single number — the least amount of time Jack needs to get from planet 1 to planet n. If Jack can't get to planet n in any amount of time, print number -1. | C | d5fbb3033bd7508fd468edb9bb995d6c | 5222ade1c8385d9a3c86e6d024bfc759 | GNU C | standard output | 256 megabytes | train_002.jsonl | [
"data structures",
"binary search",
"graphs",
"shortest paths"
] | 1349105400 | ["4 6\n1 2 2\n1 3 3\n1 4 8\n2 3 4\n2 4 5\n3 4 3\n0\n1 3\n2 3 4\n0", "3 1\n1 2 3\n0\n1 3\n0"] | NoteIn the first sample Jack has three ways to go from planet 1. If he moves to planet 4 at once, he spends 8 seconds. If he transfers to planet 3, he spends 3 seconds, but as other travellers arrive to planet 3 at time 3 and 4, he can travel to planet 4 only at time 5, thus spending 8 seconds in total. But if Jack mov... | PASSED | 1,700 | standard input | 2 seconds | The first line contains two space-separated integers: n (2 ≤ n ≤ 105), the number of planets in the galaxy, and m (0 ≤ m ≤ 105) — the number of pairs of planets between which Jack can travel using stargates. Then m lines follow, containing three integers each: the i-th line contains numbers of planets ai and bi (1 ≤ ai... | ["7", "-1"] | #include <stdio.h>
#include <string.h>
#define QLEN 100007
int n,m;
int e[200010][2],v[200010],p[100010];
int bgn[100010],len[100010],ban[100010],go[100010];
int q[100010],dis[100010];
short vis[100010];
void adde(int sn,int fn,int val,int id)
{
e[id][0] = fn; e[id][1] = p[sn]; p[sn] = id; v[id] = val;
}
int calc(int ... | |
A group of tourists is going to kayak and catamaran tour. A rented lorry has arrived to the boat depot to take kayaks and catamarans to the point of departure. It's known that all kayaks are of the same size (and each of them occupies the space of 1 cubic metre), and all catamarans are of the same size, but two times b... | In the first line print the maximum possible carrying capacity of the set. In the second line print a string consisting of the numbers of the vehicles that make the optimal set. If the answer is not unique, print any of them. | C | a1f98b06650a5755e784cd6ec6f3b211 | 34f5cc4ce4639ee798ad9f2fafe8e28f | GNU C11 | standard output | 64 megabytes | train_002.jsonl | [
"sortings",
"greedy"
] | 1267963200 | ["3 2\n1 2\n2 7\n1 3"] | null | PASSED | 1,900 | standard input | 2 seconds | The first line contains a pair of integer numbers n and v (1 ≤ n ≤ 105; 1 ≤ v ≤ 109), where n is the number of waterborne vehicles in the boat depot, and v is the truck body volume of the lorry in cubic metres. The following n lines contain the information about the waterborne vehicles, that is a pair of numbers ti, pi... | ["7\n2"] | #include <stdio.h>
#define MAX_PERSON 100005
typedef struct person_
{
int cap;
int id;
}person_t;
void min_heapify(person_t **map, int start, int end)
{
person_t *map_t = NULL;
int dad = start;
int son = dad * 2 + 1;
while (son <= end)
{
if ((son + 1 <= end) && (map[son]->cap > map[son + 1]->cap))
{
+... | |
A group of tourists is going to kayak and catamaran tour. A rented lorry has arrived to the boat depot to take kayaks and catamarans to the point of departure. It's known that all kayaks are of the same size (and each of them occupies the space of 1 cubic metre), and all catamarans are of the same size, but two times b... | In the first line print the maximum possible carrying capacity of the set. In the second line print a string consisting of the numbers of the vehicles that make the optimal set. If the answer is not unique, print any of them. | C | a1f98b06650a5755e784cd6ec6f3b211 | 686e5d4cbefcee0913e5d46f5e95607e | GNU C11 | standard output | 64 megabytes | train_002.jsonl | [
"sortings",
"greedy"
] | 1267963200 | ["3 2\n1 2\n2 7\n1 3"] | null | PASSED | 1,900 | standard input | 2 seconds | The first line contains a pair of integer numbers n and v (1 ≤ n ≤ 105; 1 ≤ v ≤ 109), where n is the number of waterborne vehicles in the boat depot, and v is the truck body volume of the lorry in cubic metres. The following n lines contain the information about the waterborne vehicles, that is a pair of numbers ti, pi... | ["7\n2"] | #include <stdio.h>
#include <stdlib.h>
struct g
{
int x;
int y;
int c;
} n[100000],temp;
int ch[100000],u,s,c[100000];
void kuai(int a,int b)
{
if(a>=b)
return ;
int l=a,h=b;
temp=n[l];
while(l!=h)
{
while(l<h&&n[h].x<=temp.x)
h--;
if(l<h)
... | |
A group of tourists is going to kayak and catamaran tour. A rented lorry has arrived to the boat depot to take kayaks and catamarans to the point of departure. It's known that all kayaks are of the same size (and each of them occupies the space of 1 cubic metre), and all catamarans are of the same size, but two times b... | In the first line print the maximum possible carrying capacity of the set. In the second line print a string consisting of the numbers of the vehicles that make the optimal set. If the answer is not unique, print any of them. | C | a1f98b06650a5755e784cd6ec6f3b211 | 8cea787e26b3cfce67722c983ae774d8 | GNU C11 | standard output | 64 megabytes | train_002.jsonl | [
"sortings",
"greedy"
] | 1267963200 | ["3 2\n1 2\n2 7\n1 3"] | null | PASSED | 1,900 | standard input | 2 seconds | The first line contains a pair of integer numbers n and v (1 ≤ n ≤ 105; 1 ≤ v ≤ 109), where n is the number of waterborne vehicles in the boat depot, and v is the truck body volume of the lorry in cubic metres. The following n lines contain the information about the waterborne vehicles, that is a pair of numbers ti, pi... | ["7\n2"] | #include <stdio.h>
#include <stdlib.h>
int t[100000],p[100000],w[100000],x[100000];
int cmp(const void *a,const void *b) {
return w[*(int *)b]-w[*(int *)a];
}
int main() {
int i,N,V,P,T,m=-1;
scanf("%i %i\n",&N,&V);
for (i=0;i<N;i++) scanf("%i %i\n",&t[i],&p[i]);
for (i=0;i<N;i++) w[i]=2/t[i]*p[i],x[i]=i;
qsor... | |
A group of tourists is going to kayak and catamaran tour. A rented lorry has arrived to the boat depot to take kayaks and catamarans to the point of departure. It's known that all kayaks are of the same size (and each of them occupies the space of 1 cubic metre), and all catamarans are of the same size, but two times b... | In the first line print the maximum possible carrying capacity of the set. In the second line print a string consisting of the numbers of the vehicles that make the optimal set. If the answer is not unique, print any of them. | C | a1f98b06650a5755e784cd6ec6f3b211 | 6a789d41561d1f92c3b3094f2efc650f | GNU C11 | standard output | 64 megabytes | train_002.jsonl | [
"sortings",
"greedy"
] | 1267963200 | ["3 2\n1 2\n2 7\n1 3"] | null | PASSED | 1,900 | standard input | 2 seconds | The first line contains a pair of integer numbers n and v (1 ≤ n ≤ 105; 1 ≤ v ≤ 109), where n is the number of waterborne vehicles in the boat depot, and v is the truck body volume of the lorry in cubic metres. The following n lines contain the information about the waterborne vehicles, that is a pair of numbers ti, pi... | ["7\n2"] | #include <stdio.h>
#include <stdlib.h>
struct Barca {
int number;
int pi;
};
typedef struct Barca Barca;
int lodka_cmp_func (const void *a,const void *b) {
int x = ((Barca*) a)->pi;
int y = ((Barca *) b)->pi;
if ( x == y) {
return 0;
} else if ( x > y) {
return -1;
} else {... | |
A group of tourists is going to kayak and catamaran tour. A rented lorry has arrived to the boat depot to take kayaks and catamarans to the point of departure. It's known that all kayaks are of the same size (and each of them occupies the space of 1 cubic metre), and all catamarans are of the same size, but two times b... | In the first line print the maximum possible carrying capacity of the set. In the second line print a string consisting of the numbers of the vehicles that make the optimal set. If the answer is not unique, print any of them. | C | a1f98b06650a5755e784cd6ec6f3b211 | 102d1c18b4f36c31fb5075462dff8404 | GNU C11 | standard output | 64 megabytes | train_002.jsonl | [
"sortings",
"greedy"
] | 1267963200 | ["3 2\n1 2\n2 7\n1 3"] | null | PASSED | 1,900 | standard input | 2 seconds | The first line contains a pair of integer numbers n and v (1 ≤ n ≤ 105; 1 ≤ v ≤ 109), where n is the number of waterborne vehicles in the boat depot, and v is the truck body volume of the lorry in cubic metres. The following n lines contain the information about the waterborne vehicles, that is a pair of numbers ti, pi... | ["7\n2"] | #include <stdio.h>
#include <stdlib.h>
struct vehicle {
int p, i;
} *kk, *cc;
int compare(const void *a, const void *b) {
struct vehicle *va = (struct vehicle *) a;
struct vehicle *vb = (struct vehicle *) b;
return vb->p - va->p;
}
int main() {
int i, ik, ic, n, nk, nc, v, sum;
scanf("%d%d", &n, &v);
kk = m... | |
A group of tourists is going to kayak and catamaran tour. A rented lorry has arrived to the boat depot to take kayaks and catamarans to the point of departure. It's known that all kayaks are of the same size (and each of them occupies the space of 1 cubic metre), and all catamarans are of the same size, but two times b... | In the first line print the maximum possible carrying capacity of the set. In the second line print a string consisting of the numbers of the vehicles that make the optimal set. If the answer is not unique, print any of them. | C | a1f98b06650a5755e784cd6ec6f3b211 | 8e1333a79821261bc0d97ef437308e98 | GNU C11 | standard output | 64 megabytes | train_002.jsonl | [
"sortings",
"greedy"
] | 1267963200 | ["3 2\n1 2\n2 7\n1 3"] | null | PASSED | 1,900 | standard input | 2 seconds | The first line contains a pair of integer numbers n and v (1 ≤ n ≤ 105; 1 ≤ v ≤ 109), where n is the number of waterborne vehicles in the boat depot, and v is the truck body volume of the lorry in cubic metres. The following n lines contain the information about the waterborne vehicles, that is a pair of numbers ti, pi... | ["7\n2"] | #include <stdio.h>
#define MAX_PERSON 100005
typedef struct person_
{
int cap;
int id;
}person_t;
void min_heapify(person_t **map, int start, int end)
{
person_t *map_t = NULL;
int dad = start;
int son = dad * 2 + 1;
while (son <= end)
{
if ((son + 1 <= end) && (map[son]->cap > map[son + 1]->cap))
{
... | |
A group of tourists is going to kayak and catamaran tour. A rented lorry has arrived to the boat depot to take kayaks and catamarans to the point of departure. It's known that all kayaks are of the same size (and each of them occupies the space of 1 cubic metre), and all catamarans are of the same size, but two times b... | In the first line print the maximum possible carrying capacity of the set. In the second line print a string consisting of the numbers of the vehicles that make the optimal set. If the answer is not unique, print any of them. | C | a1f98b06650a5755e784cd6ec6f3b211 | 5356b4407f52937c95e19d29cc1bc1d0 | GNU C11 | standard output | 64 megabytes | train_002.jsonl | [
"sortings",
"greedy"
] | 1267963200 | ["3 2\n1 2\n2 7\n1 3"] | null | PASSED | 1,900 | standard input | 2 seconds | The first line contains a pair of integer numbers n and v (1 ≤ n ≤ 105; 1 ≤ v ≤ 109), where n is the number of waterborne vehicles in the boat depot, and v is the truck body volume of the lorry in cubic metres. The following n lines contain the information about the waterborne vehicles, that is a pair of numbers ti, pi... | ["7\n2"] | #include <stdio.h>
#include <stdlib.h>
#include <math.h>
#include <string.h>
struct veh
{
int index;
int type;
int pow;
};
int partition(struct veh vehs[],int start,int end){
int pivot = vehs[end].pow,pIndex=start;
for(int i=start;i<end;i++){
if(vehs[i].pow>=pivot){
... | |
A group of tourists is going to kayak and catamaran tour. A rented lorry has arrived to the boat depot to take kayaks and catamarans to the point of departure. It's known that all kayaks are of the same size (and each of them occupies the space of 1 cubic metre), and all catamarans are of the same size, but two times b... | In the first line print the maximum possible carrying capacity of the set. In the second line print a string consisting of the numbers of the vehicles that make the optimal set. If the answer is not unique, print any of them. | C | a1f98b06650a5755e784cd6ec6f3b211 | d3dd0f111658b1af3267be0ef3c4d224 | GNU C11 | standard output | 64 megabytes | train_002.jsonl | [
"sortings",
"greedy"
] | 1267963200 | ["3 2\n1 2\n2 7\n1 3"] | null | PASSED | 1,900 | standard input | 2 seconds | The first line contains a pair of integer numbers n and v (1 ≤ n ≤ 105; 1 ≤ v ≤ 109), where n is the number of waterborne vehicles in the boat depot, and v is the truck body volume of the lorry in cubic metres. The following n lines contain the information about the waterborne vehicles, that is a pair of numbers ti, pi... | ["7\n2"] | #include <stdio.h>
#include <stdlib.h>
int t[100000],p[100000],w[100000],x[100000];
int cmp(const void *a,const void *b) {//function is used in qsort to decide the relative order of elements at addresses
return w[*(int *)b]-w[*(int *)a];
}
int main() {
int i,N,V,P,T,m=-1;
scanf("%i %i\n",&N,&V);
for (i=0;i<N... | |
A group of tourists is going to kayak and catamaran tour. A rented lorry has arrived to the boat depot to take kayaks and catamarans to the point of departure. It's known that all kayaks are of the same size (and each of them occupies the space of 1 cubic metre), and all catamarans are of the same size, but two times b... | In the first line print the maximum possible carrying capacity of the set. In the second line print a string consisting of the numbers of the vehicles that make the optimal set. If the answer is not unique, print any of them. | C | a1f98b06650a5755e784cd6ec6f3b211 | bc56857e4f6c8a2561eb8ed3ddc7ce3a | GNU C11 | standard output | 64 megabytes | train_002.jsonl | [
"sortings",
"greedy"
] | 1267963200 | ["3 2\n1 2\n2 7\n1 3"] | null | PASSED | 1,900 | standard input | 2 seconds | The first line contains a pair of integer numbers n and v (1 ≤ n ≤ 105; 1 ≤ v ≤ 109), where n is the number of waterborne vehicles in the boat depot, and v is the truck body volume of the lorry in cubic metres. The following n lines contain the information about the waterborne vehicles, that is a pair of numbers ti, pi... | ["7\n2"] | /*
* Группа туристов собирается в водный поход. На лодочную базу прибыл арендованный грузовик, в который будут погружены байдарки и катамараны, а затем доставлены на место отправления.
* Известно, что все байдарки равны по размерам между собой (и занимают 1 куб. метр пространства), а катамараны равны по размерам меж... | |
A magic island Geraldion, where Gerald lives, has its own currency system. It uses banknotes of several values. But the problem is, the system is not perfect and sometimes it happens that Geraldionians cannot express a certain sum of money with any set of banknotes. Of course, they can use any number of banknotes of ea... | Print a single line — the minimum unfortunate sum. If there are no unfortunate sums, print - 1. | C | df94080c5b0b046af2397cafc02b5bdc | e87942aff0f382815ec71dd9edb53640 | GNU C | standard output | 256 megabytes | train_002.jsonl | [
"implementation",
"sortings"
] | 1437573600 | ["5\n1 2 3 4 5"] | null | PASSED | 1,000 | standard input | 2 seconds | The first line contains number n (1 ≤ n ≤ 1000) — the number of values of the banknotes that used in Geraldion. The second line contains n distinct space-separated numbers a1, a2, ..., an (1 ≤ ai ≤ 106) — the values of the banknotes. | ["-1"] | #include <stdio.h>
int main()
{
int n,i,ara1[10000],store=0;
scanf("%d", &n);
for(i=0 ; i<n; i++)
{
scanf("%d", &ara1[i]);
if(ara1[i]==1)
{
store=1;
}
//ara2[i]=ara1[i];
}
if(store==1) printf("-1");
else printf("1");
/*k=n;
for(i=0... | |
A magic island Geraldion, where Gerald lives, has its own currency system. It uses banknotes of several values. But the problem is, the system is not perfect and sometimes it happens that Geraldionians cannot express a certain sum of money with any set of banknotes. Of course, they can use any number of banknotes of ea... | Print a single line — the minimum unfortunate sum. If there are no unfortunate sums, print - 1. | C | df94080c5b0b046af2397cafc02b5bdc | 9201b455dbe91272f41592643e606c60 | GNU C | standard output | 256 megabytes | train_002.jsonl | [
"implementation",
"sortings"
] | 1437573600 | ["5\n1 2 3 4 5"] | null | PASSED | 1,000 | standard input | 2 seconds | The first line contains number n (1 ≤ n ≤ 1000) — the number of values of the banknotes that used in Geraldion. The second line contains n distinct space-separated numbers a1, a2, ..., an (1 ≤ ai ≤ 106) — the values of the banknotes. | ["-1"] | #include<stdio.h>
int main()
{
int n;
scanf("%d",&n);
int myarray[n];
int i;
for(i=0; i<n; i++)
{
scanf("%d",&myarray[i]);
}
for(i=0; i<n; i++)
{
if(myarray[i]==1)
{
printf("-1");
return 0;
}
}
printf("1");
return 0;... | |
A magic island Geraldion, where Gerald lives, has its own currency system. It uses banknotes of several values. But the problem is, the system is not perfect and sometimes it happens that Geraldionians cannot express a certain sum of money with any set of banknotes. Of course, they can use any number of banknotes of ea... | Print a single line — the minimum unfortunate sum. If there are no unfortunate sums, print - 1. | C | df94080c5b0b046af2397cafc02b5bdc | efa778aa226b1d336886f399191093fe | GNU C | standard output | 256 megabytes | train_002.jsonl | [
"implementation",
"sortings"
] | 1437573600 | ["5\n1 2 3 4 5"] | null | PASSED | 1,000 | standard input | 2 seconds | The first line contains number n (1 ≤ n ≤ 1000) — the number of values of the banknotes that used in Geraldion. The second line contains n distinct space-separated numbers a1, a2, ..., an (1 ≤ ai ≤ 106) — the values of the banknotes. | ["-1"] | #include<stdio.h>
int main()
{
int x,n,i;
scanf("%d",&n);
for(i=0; i<n; i++)
{
scanf("%d",&x);
if(x==1)
{
printf("-1");
return 0;
}
}
printf("1");
return 0;
}
| |
A magic island Geraldion, where Gerald lives, has its own currency system. It uses banknotes of several values. But the problem is, the system is not perfect and sometimes it happens that Geraldionians cannot express a certain sum of money with any set of banknotes. Of course, they can use any number of banknotes of ea... | Print a single line — the minimum unfortunate sum. If there are no unfortunate sums, print - 1. | C | df94080c5b0b046af2397cafc02b5bdc | c4788799457880f6727ee958e2ef5de7 | GNU C | standard output | 256 megabytes | train_002.jsonl | [
"implementation",
"sortings"
] | 1437573600 | ["5\n1 2 3 4 5"] | null | PASSED | 1,000 | standard input | 2 seconds | The first line contains number n (1 ≤ n ≤ 1000) — the number of values of the banknotes that used in Geraldion. The second line contains n distinct space-separated numbers a1, a2, ..., an (1 ≤ ai ≤ 106) — the values of the banknotes. | ["-1"] | #include <stdio.h>
int main()
{
int n,a[1005],i,flag=0,min=1000001;
scanf("%d",&n);
for(i=0;i<n;i++)
{
scanf("%d",&a[i]);
if(min>a[i])
min=a[i];
if(a[i]==1)
flag=1;
}
if(flag==1)
printf("-1");
else
printf("1");
return 0;
}
| |
A magic island Geraldion, where Gerald lives, has its own currency system. It uses banknotes of several values. But the problem is, the system is not perfect and sometimes it happens that Geraldionians cannot express a certain sum of money with any set of banknotes. Of course, they can use any number of banknotes of ea... | Print a single line — the minimum unfortunate sum. If there are no unfortunate sums, print - 1. | C | df94080c5b0b046af2397cafc02b5bdc | 9f7ffe05ff843b6b5b3a14c4688b76fc | GNU C | standard output | 256 megabytes | train_002.jsonl | [
"implementation",
"sortings"
] | 1437573600 | ["5\n1 2 3 4 5"] | null | PASSED | 1,000 | standard input | 2 seconds | The first line contains number n (1 ≤ n ≤ 1000) — the number of values of the banknotes that used in Geraldion. The second line contains n distinct space-separated numbers a1, a2, ..., an (1 ≤ ai ≤ 106) — the values of the banknotes. | ["-1"] | #include <stdio.h>
#include <stdlib.h>
int main()
{
int n,s,p;
scanf("%d",&n);
p=1;
while(n--)
{
scanf("%d",&s);
if(s==1) p=-1;
}
printf("%d",p);
return 0;
}
| |
A magic island Geraldion, where Gerald lives, has its own currency system. It uses banknotes of several values. But the problem is, the system is not perfect and sometimes it happens that Geraldionians cannot express a certain sum of money with any set of banknotes. Of course, they can use any number of banknotes of ea... | Print a single line — the minimum unfortunate sum. If there are no unfortunate sums, print - 1. | C | df94080c5b0b046af2397cafc02b5bdc | ebb1c617b8112267c42200ada2958d1a | GNU C | standard output | 256 megabytes | train_002.jsonl | [
"implementation",
"sortings"
] | 1437573600 | ["5\n1 2 3 4 5"] | null | PASSED | 1,000 | standard input | 2 seconds | The first line contains number n (1 ≤ n ≤ 1000) — the number of values of the banknotes that used in Geraldion. The second line contains n distinct space-separated numbers a1, a2, ..., an (1 ≤ ai ≤ 106) — the values of the banknotes. | ["-1"] | #include <stdio.h>
#include <stdlib.h>
int main()
{
long int n,a[1002],f=0,i,j,t,tmp,g=0;
scanf("%ld",&n);
for(i=1;i<=n;i++)
{
scanf("%ld",&a[i]);
if(a[i]==1)
{
f=1;
goto label;
}
}
for(i=1;i<=n-1;i++)
{
for(j=1;j<=n-i;j++)
{
if(a[j]>a[j+1])
{
tmp=a[... | |
A magic island Geraldion, where Gerald lives, has its own currency system. It uses banknotes of several values. But the problem is, the system is not perfect and sometimes it happens that Geraldionians cannot express a certain sum of money with any set of banknotes. Of course, they can use any number of banknotes of ea... | Print a single line — the minimum unfortunate sum. If there are no unfortunate sums, print - 1. | C | df94080c5b0b046af2397cafc02b5bdc | 14f900fdf58303389e84252f38da253b | GNU C | standard output | 256 megabytes | train_002.jsonl | [
"implementation",
"sortings"
] | 1437573600 | ["5\n1 2 3 4 5"] | null | PASSED | 1,000 | standard input | 2 seconds | The first line contains number n (1 ≤ n ≤ 1000) — the number of values of the banknotes that used in Geraldion. The second line contains n distinct space-separated numbers a1, a2, ..., an (1 ≤ ai ≤ 106) — the values of the banknotes. | ["-1"] | #include<stdio.h>
int main()
{
int n;
scanf("%d",&n);
int a[n];
int min=1000001, prev_min;
for(int i=0;i<n;i++)
{
scanf("%d",&a[i]);
if(a[i]<min)
{
min=a[i];
}
}
if(min==1)
{
printf("-1");
}
if(min>=2)
{
printf("%d\n",1);
}
} | |
A magic island Geraldion, where Gerald lives, has its own currency system. It uses banknotes of several values. But the problem is, the system is not perfect and sometimes it happens that Geraldionians cannot express a certain sum of money with any set of banknotes. Of course, they can use any number of banknotes of ea... | Print a single line — the minimum unfortunate sum. If there are no unfortunate sums, print - 1. | C | df94080c5b0b046af2397cafc02b5bdc | 332a37a2fa4494ddf37e9da9c508f7e3 | GNU C | standard output | 256 megabytes | train_002.jsonl | [
"implementation",
"sortings"
] | 1437573600 | ["5\n1 2 3 4 5"] | null | PASSED | 1,000 | standard input | 2 seconds | The first line contains number n (1 ≤ n ≤ 1000) — the number of values of the banknotes that used in Geraldion. The second line contains n distinct space-separated numbers a1, a2, ..., an (1 ≤ ai ≤ 106) — the values of the banknotes. | ["-1"] | //http://codeforces.com/contest/560/problem/a
#include <stdio.h>
#include <stdlib.h>
int b[1000001]={0};
int compare(const void *a , const void *b){
int c = *(int*) a;
int d = *(int*) b;
if (c<d)
return -1;
else if(c==d){
return 0;
}
else return 1;
}
int main(void){
int i,a... | |
A magic island Geraldion, where Gerald lives, has its own currency system. It uses banknotes of several values. But the problem is, the system is not perfect and sometimes it happens that Geraldionians cannot express a certain sum of money with any set of banknotes. Of course, they can use any number of banknotes of ea... | Print a single line — the minimum unfortunate sum. If there are no unfortunate sums, print - 1. | C | df94080c5b0b046af2397cafc02b5bdc | 17f1bf4d60611aeee77ea3c83db3d538 | GNU C | standard output | 256 megabytes | train_002.jsonl | [
"implementation",
"sortings"
] | 1437573600 | ["5\n1 2 3 4 5"] | null | PASSED | 1,000 | standard input | 2 seconds | The first line contains number n (1 ≤ n ≤ 1000) — the number of values of the banknotes that used in Geraldion. The second line contains n distinct space-separated numbers a1, a2, ..., an (1 ≤ ai ≤ 106) — the values of the banknotes. | ["-1"] | #include <stdio.h>
int main(void) {
int t,n,k,flag,i;
scanf("%d",&n);flag=0;
for(i=1;i<=n;i++)
{
scanf("%d",&k);
if(k==1)
{
flag=1;
break;
}
}
if(flag==1)
printf("-1");
else
printf("1");
return 0;
} | |
A magic island Geraldion, where Gerald lives, has its own currency system. It uses banknotes of several values. But the problem is, the system is not perfect and sometimes it happens that Geraldionians cannot express a certain sum of money with any set of banknotes. Of course, they can use any number of banknotes of ea... | Print a single line — the minimum unfortunate sum. If there are no unfortunate sums, print - 1. | C | df94080c5b0b046af2397cafc02b5bdc | 17dda463da74eacb4d724ae170f48877 | GNU C | standard output | 256 megabytes | train_002.jsonl | [
"implementation",
"sortings"
] | 1437573600 | ["5\n1 2 3 4 5"] | null | PASSED | 1,000 | standard input | 2 seconds | The first line contains number n (1 ≤ n ≤ 1000) — the number of values of the banknotes that used in Geraldion. The second line contains n distinct space-separated numbers a1, a2, ..., an (1 ≤ ai ≤ 106) — the values of the banknotes. | ["-1"] | #include <stdio.h>
int main()
{
int n,i,j,f=0;
scanf ("%d",&n);
for (i=0;i<n;++i)
{
scanf ("%d",&j);
if (j==1)
f=1;
}
if (f==0)
puts ("1");
else
puts ("-1");
return 0;
}
| |
A magic island Geraldion, where Gerald lives, has its own currency system. It uses banknotes of several values. But the problem is, the system is not perfect and sometimes it happens that Geraldionians cannot express a certain sum of money with any set of banknotes. Of course, they can use any number of banknotes of ea... | Print a single line — the minimum unfortunate sum. If there are no unfortunate sums, print - 1. | C | df94080c5b0b046af2397cafc02b5bdc | bff3157b0a40bde3038bd7f806ae340e | GNU C | standard output | 256 megabytes | train_002.jsonl | [
"implementation",
"sortings"
] | 1437573600 | ["5\n1 2 3 4 5"] | null | PASSED | 1,000 | standard input | 2 seconds | The first line contains number n (1 ≤ n ≤ 1000) — the number of values of the banknotes that used in Geraldion. The second line contains n distinct space-separated numbers a1, a2, ..., an (1 ≤ ai ≤ 106) — the values of the banknotes. | ["-1"] | #include <stdio.h>
#include<malloc.h>
int main(){
int n,i,*a,c;
scanf("%d",&n);
a=(int *)malloc(n*sizeof(int));
c=1;
for(i=0;i<n;i++){
scanf("%d",&a[i]);
if(a[i]==1) c=-1;
}
printf("%d\n",c);
return 0;
}
| |
A magic island Geraldion, where Gerald lives, has its own currency system. It uses banknotes of several values. But the problem is, the system is not perfect and sometimes it happens that Geraldionians cannot express a certain sum of money with any set of banknotes. Of course, they can use any number of banknotes of ea... | Print a single line — the minimum unfortunate sum. If there are no unfortunate sums, print - 1. | C | df94080c5b0b046af2397cafc02b5bdc | 8c37780a7ba719082b60cf5a1d0dd847 | GNU C | standard output | 256 megabytes | train_002.jsonl | [
"implementation",
"sortings"
] | 1437573600 | ["5\n1 2 3 4 5"] | null | PASSED | 1,000 | standard input | 2 seconds | The first line contains number n (1 ≤ n ≤ 1000) — the number of values of the banknotes that used in Geraldion. The second line contains n distinct space-separated numbers a1, a2, ..., an (1 ≤ ai ≤ 106) — the values of the banknotes. | ["-1"] | #include<stdio.h>
#include<stdlib.h>
int main()
{
int n,a[10000],sum=0,i;
scanf("%d",&n);
for(i=0;i<n;i++)
{
scanf("%d",&a[i]);
sum=sum+a[i];
}
for(i=0;i<n;i++)
{
if(a[i] == 1)
{
printf("%d",-1);
exit(0);
}
}
printf("1");
} | |
A magic island Geraldion, where Gerald lives, has its own currency system. It uses banknotes of several values. But the problem is, the system is not perfect and sometimes it happens that Geraldionians cannot express a certain sum of money with any set of banknotes. Of course, they can use any number of banknotes of ea... | Print a single line — the minimum unfortunate sum. If there are no unfortunate sums, print - 1. | C | df94080c5b0b046af2397cafc02b5bdc | df580d0727b2416a409d84bfc9331c1f | GNU C | standard output | 256 megabytes | train_002.jsonl | [
"implementation",
"sortings"
] | 1437573600 | ["5\n1 2 3 4 5"] | null | PASSED | 1,000 | standard input | 2 seconds | The first line contains number n (1 ≤ n ≤ 1000) — the number of values of the banknotes that used in Geraldion. The second line contains n distinct space-separated numbers a1, a2, ..., an (1 ≤ ai ≤ 106) — the values of the banknotes. | ["-1"] | #include<stdio.h>
main()
{
int x,y,i;
scanf("%d",&x);
for(i=0; i<x; i++)
{
scanf("%d",&y);
if(y==1)
{
printf("-1");
return 0;
}
}
printf("1");
}
| |
A magic island Geraldion, where Gerald lives, has its own currency system. It uses banknotes of several values. But the problem is, the system is not perfect and sometimes it happens that Geraldionians cannot express a certain sum of money with any set of banknotes. Of course, they can use any number of banknotes of ea... | Print a single line — the minimum unfortunate sum. If there are no unfortunate sums, print - 1. | C | df94080c5b0b046af2397cafc02b5bdc | 31742fcf407ccc2b980c76c11b7417c4 | GNU C | standard output | 256 megabytes | train_002.jsonl | [
"implementation",
"sortings"
] | 1437573600 | ["5\n1 2 3 4 5"] | null | PASSED | 1,000 | standard input | 2 seconds | The first line contains number n (1 ≤ n ≤ 1000) — the number of values of the banknotes that used in Geraldion. The second line contains n distinct space-separated numbers a1, a2, ..., an (1 ≤ ai ≤ 106) — the values of the banknotes. | ["-1"] | #include <stdio.h>
int main() {
int hm, flag = 0;
scanf("%d", &hm);
for (int i = 0; i < hm; i++) {
int a;
scanf("%d", &a);
if (a == 1) {
flag = 1;
printf("%d", -1);
break;
}
}
if (flag == 0) {
printf("%d", 1);
}
ret... | |
A magic island Geraldion, where Gerald lives, has its own currency system. It uses banknotes of several values. But the problem is, the system is not perfect and sometimes it happens that Geraldionians cannot express a certain sum of money with any set of banknotes. Of course, they can use any number of banknotes of ea... | Print a single line — the minimum unfortunate sum. If there are no unfortunate sums, print - 1. | C | df94080c5b0b046af2397cafc02b5bdc | a4868f9900df2633e6080c811ad98518 | GNU C | standard output | 256 megabytes | train_002.jsonl | [
"implementation",
"sortings"
] | 1437573600 | ["5\n1 2 3 4 5"] | null | PASSED | 1,000 | standard input | 2 seconds | The first line contains number n (1 ≤ n ≤ 1000) — the number of values of the banknotes that used in Geraldion. The second line contains n distinct space-separated numbers a1, a2, ..., an (1 ≤ ai ≤ 106) — the values of the banknotes. | ["-1"] | #include<stdio.h>
#include<string.h>
int main()
{
int i, n, j, temp;
scanf("%d",&n);
int a[1005];
for(i=0;i<n;i++)
{
scanf("%d",&a[i]);
}
for(j=0;j<n-1;j++)
for(i=0;i<n;i++)
{
if(a[i]>a[i+1])
{
temp=a[i+1];
a[i+1]=a[i];
... | |
A magic island Geraldion, where Gerald lives, has its own currency system. It uses banknotes of several values. But the problem is, the system is not perfect and sometimes it happens that Geraldionians cannot express a certain sum of money with any set of banknotes. Of course, they can use any number of banknotes of ea... | Print a single line — the minimum unfortunate sum. If there are no unfortunate sums, print - 1. | C | df94080c5b0b046af2397cafc02b5bdc | d0687ed1d2455fe1fa19c57c0b486dc2 | GNU C | standard output | 256 megabytes | train_002.jsonl | [
"implementation",
"sortings"
] | 1437573600 | ["5\n1 2 3 4 5"] | null | PASSED | 1,000 | standard input | 2 seconds | The first line contains number n (1 ≤ n ≤ 1000) — the number of values of the banknotes that used in Geraldion. The second line contains n distinct space-separated numbers a1, a2, ..., an (1 ≤ ai ≤ 106) — the values of the banknotes. | ["-1"] | #include<stdio.h>
int main()
{
long long int n,i;
scanf("%lld",&n);
long long int a[n];
for(i=0;i<n;i++)
{
scanf("%lld",&a[i]);
if(a[i]==1)
{
printf("-1");
return 0;
}
}
printf("1");
return 0;
} | |
A magic island Geraldion, where Gerald lives, has its own currency system. It uses banknotes of several values. But the problem is, the system is not perfect and sometimes it happens that Geraldionians cannot express a certain sum of money with any set of banknotes. Of course, they can use any number of banknotes of ea... | Print a single line — the minimum unfortunate sum. If there are no unfortunate sums, print - 1. | C | df94080c5b0b046af2397cafc02b5bdc | 9e73f43007a1436368ae3acc131ceb36 | GNU C | standard output | 256 megabytes | train_002.jsonl | [
"implementation",
"sortings"
] | 1437573600 | ["5\n1 2 3 4 5"] | null | PASSED | 1,000 | standard input | 2 seconds | The first line contains number n (1 ≤ n ≤ 1000) — the number of values of the banknotes that used in Geraldion. The second line contains n distinct space-separated numbers a1, a2, ..., an (1 ≤ ai ≤ 106) — the values of the banknotes. | ["-1"] | #include <stdio.h>
int main(void) {
int check=0,ar[1005],i,n;
scanf("%d",&n);
for(i=0;i<n;i++)
{
scanf("%d",&ar[i]);
if(ar[i]==1)
check=1;
}
if(check==0)
printf("1\n");
else
printf("-1\n");
return 0;
} | |
A magic island Geraldion, where Gerald lives, has its own currency system. It uses banknotes of several values. But the problem is, the system is not perfect and sometimes it happens that Geraldionians cannot express a certain sum of money with any set of banknotes. Of course, they can use any number of banknotes of ea... | Print a single line — the minimum unfortunate sum. If there are no unfortunate sums, print - 1. | C | df94080c5b0b046af2397cafc02b5bdc | 0e02edb29149be31f310a09a3e1987e3 | GNU C | standard output | 256 megabytes | train_002.jsonl | [
"implementation",
"sortings"
] | 1437573600 | ["5\n1 2 3 4 5"] | null | PASSED | 1,000 | standard input | 2 seconds | The first line contains number n (1 ≤ n ≤ 1000) — the number of values of the banknotes that used in Geraldion. The second line contains n distinct space-separated numbers a1, a2, ..., an (1 ≤ ai ≤ 106) — the values of the banknotes. | ["-1"] | #include<stdio.h>
int main(){
int tc,i,n=0;
long long ara[100000];
scanf("%d",&tc);
for(i=0;i<tc;i++){
scanf("%I64d",&ara[i]);
if(ara[i]==1){
n=1;
}
}
if(n){
printf("-1\n");
return 0;
}
else
printf("1\n");
return 0;
} | |
A magic island Geraldion, where Gerald lives, has its own currency system. It uses banknotes of several values. But the problem is, the system is not perfect and sometimes it happens that Geraldionians cannot express a certain sum of money with any set of banknotes. Of course, they can use any number of banknotes of ea... | Print a single line — the minimum unfortunate sum. If there are no unfortunate sums, print - 1. | C | df94080c5b0b046af2397cafc02b5bdc | 9c7eea50bd84d20e87370da4b3bf512d | GNU C | standard output | 256 megabytes | train_002.jsonl | [
"implementation",
"sortings"
] | 1437573600 | ["5\n1 2 3 4 5"] | null | PASSED | 1,000 | standard input | 2 seconds | The first line contains number n (1 ≤ n ≤ 1000) — the number of values of the banknotes that used in Geraldion. The second line contains n distinct space-separated numbers a1, a2, ..., an (1 ≤ ai ≤ 106) — the values of the banknotes. | ["-1"] | #include<string.h>
#include<stdio.h>
#include<stdlib.h>
#include<time.h>
#include<math.h>
#include<ctype.h>
#define MAX( a, b ) ( ( a > b) ? a : b )
#define MIN( a, b ) ( ( a < b) ? a : b )
#define FOR(ii,aa,bb) for(ii=aa;ii<bb;ii++)
int main () {
int x=0,n=0,s=0,i,j;
scanf("%d",&x);
FOR(i,0,x){
scanf("%d",&n);
if... | |
A magic island Geraldion, where Gerald lives, has its own currency system. It uses banknotes of several values. But the problem is, the system is not perfect and sometimes it happens that Geraldionians cannot express a certain sum of money with any set of banknotes. Of course, they can use any number of banknotes of ea... | Print a single line — the minimum unfortunate sum. If there are no unfortunate sums, print - 1. | C | df94080c5b0b046af2397cafc02b5bdc | ecb386a796def940ef802367139b76e6 | GNU C | standard output | 256 megabytes | train_002.jsonl | [
"implementation",
"sortings"
] | 1437573600 | ["5\n1 2 3 4 5"] | null | PASSED | 1,000 | standard input | 2 seconds | The first line contains number n (1 ≤ n ≤ 1000) — the number of values of the banknotes that used in Geraldion. The second line contains n distinct space-separated numbers a1, a2, ..., an (1 ≤ ai ≤ 106) — the values of the banknotes. | ["-1"] | #include <stdio.h>
int main()
{
int n;
scanf("%d", &n);
int a[n];
int i,j,temp;
for(i=0;i<n;i++)
{
scanf("%d", &a[i]);
}
for(i=0;i<n;i++)
{
for(j=0;j<n-1;j++)
{
if(a[j]>a[j+1])
{
temp=a[j];
a[j]=a[j+1];
... | |
A magic island Geraldion, where Gerald lives, has its own currency system. It uses banknotes of several values. But the problem is, the system is not perfect and sometimes it happens that Geraldionians cannot express a certain sum of money with any set of banknotes. Of course, they can use any number of banknotes of ea... | Print a single line — the minimum unfortunate sum. If there are no unfortunate sums, print - 1. | C | df94080c5b0b046af2397cafc02b5bdc | 1e132d4a38c4c8242f44d123a8aed8c7 | GNU C | standard output | 256 megabytes | train_002.jsonl | [
"implementation",
"sortings"
] | 1437573600 | ["5\n1 2 3 4 5"] | null | PASSED | 1,000 | standard input | 2 seconds | The first line contains number n (1 ≤ n ≤ 1000) — the number of values of the banknotes that used in Geraldion. The second line contains n distinct space-separated numbers a1, a2, ..., an (1 ≤ ai ≤ 106) — the values of the banknotes. | ["-1"] | #include<stdio.h>
main()
{
long int a[1000],n,i;
int f;
scanf("%d",&n);
for(i=0;i<n;i++)
scanf("%d",&a[i]);
f=0;
for(i=0;i<n;i++)
{
if(a[i]==1)
{f=1;break;}
}
if(f==1)
printf("-1");
else
printf("1");
return 0;
} | |
A magic island Geraldion, where Gerald lives, has its own currency system. It uses banknotes of several values. But the problem is, the system is not perfect and sometimes it happens that Geraldionians cannot express a certain sum of money with any set of banknotes. Of course, they can use any number of banknotes of ea... | Print a single line — the minimum unfortunate sum. If there are no unfortunate sums, print - 1. | C | df94080c5b0b046af2397cafc02b5bdc | c9d0fc100b78bd874595833b04ffd5c0 | GNU C | standard output | 256 megabytes | train_002.jsonl | [
"implementation",
"sortings"
] | 1437573600 | ["5\n1 2 3 4 5"] | null | PASSED | 1,000 | standard input | 2 seconds | The first line contains number n (1 ≤ n ≤ 1000) — the number of values of the banknotes that used in Geraldion. The second line contains n distinct space-separated numbers a1, a2, ..., an (1 ≤ ai ≤ 106) — the values of the banknotes. | ["-1"] | #include<stdio.h>
int main(){
int n,i,b;
int l[1001];
scanf("%d",&n);
for(b=i=0;i<n;i++){
scanf("%d",&l[i]);
b=b | l[i]==1;
}
if(b){
printf("-1");
}else{
printf("1");
}
}
| |
A magic island Geraldion, where Gerald lives, has its own currency system. It uses banknotes of several values. But the problem is, the system is not perfect and sometimes it happens that Geraldionians cannot express a certain sum of money with any set of banknotes. Of course, they can use any number of banknotes of ea... | Print a single line — the minimum unfortunate sum. If there are no unfortunate sums, print - 1. | C | df94080c5b0b046af2397cafc02b5bdc | 3653f696421a2cf9bf5a62fd018849b3 | GNU C | standard output | 256 megabytes | train_002.jsonl | [
"implementation",
"sortings"
] | 1437573600 | ["5\n1 2 3 4 5"] | null | PASSED | 1,000 | standard input | 2 seconds | The first line contains number n (1 ≤ n ≤ 1000) — the number of values of the banknotes that used in Geraldion. The second line contains n distinct space-separated numbers a1, a2, ..., an (1 ≤ ai ≤ 106) — the values of the banknotes. | ["-1"] | #include<stdio.h>
int main()
{
int t,c=0;
scanf("%d",&t);
int i=0;
int a[t];
for(i=0;i<t;i++)
{
scanf("%d",&a[i]);
if(a[i]==1)
{
printf("-1");
c=1;
break;
}}
if(c==0)
printf("1");
return 0;
} | |
A magic island Geraldion, where Gerald lives, has its own currency system. It uses banknotes of several values. But the problem is, the system is not perfect and sometimes it happens that Geraldionians cannot express a certain sum of money with any set of banknotes. Of course, they can use any number of banknotes of ea... | Print a single line — the minimum unfortunate sum. If there are no unfortunate sums, print - 1. | C | df94080c5b0b046af2397cafc02b5bdc | b1005c039fd94f9f7113be864002ab1a | GNU C | standard output | 256 megabytes | train_002.jsonl | [
"implementation",
"sortings"
] | 1437573600 | ["5\n1 2 3 4 5"] | null | PASSED | 1,000 | standard input | 2 seconds | The first line contains number n (1 ≤ n ≤ 1000) — the number of values of the banknotes that used in Geraldion. The second line contains n distinct space-separated numbers a1, a2, ..., an (1 ≤ ai ≤ 106) — the values of the banknotes. | ["-1"] | #include <stdio.h>
#include <stdlib.h>
int a[1005];
int main()
{
int n=0,i=0,b=0;
scanf("%d",&n);
for(i=0;i<n;i++){
scanf("%d",&a[i]);
if(a[i] == 1)
b = 1 ;
}
if(b == 1)
printf("-1");
else
printf("1");
return 0;
}
| |
A magic island Geraldion, where Gerald lives, has its own currency system. It uses banknotes of several values. But the problem is, the system is not perfect and sometimes it happens that Geraldionians cannot express a certain sum of money with any set of banknotes. Of course, they can use any number of banknotes of ea... | Print a single line — the minimum unfortunate sum. If there are no unfortunate sums, print - 1. | C | df94080c5b0b046af2397cafc02b5bdc | 44f15e670678d1b73b654fd4b6d76e29 | GNU C | standard output | 256 megabytes | train_002.jsonl | [
"implementation",
"sortings"
] | 1437573600 | ["5\n1 2 3 4 5"] | null | PASSED | 1,000 | standard input | 2 seconds | The first line contains number n (1 ≤ n ≤ 1000) — the number of values of the banknotes that used in Geraldion. The second line contains n distinct space-separated numbers a1, a2, ..., an (1 ≤ ai ≤ 106) — the values of the banknotes. | ["-1"] | #include<stdio.h>
int main()
{
int n,num,i,f=0; scanf("%d",&n);
for(i=0;i<n;i++)
{
scanf("%d",&num);
if(num==1)
f=1;
}
if(f&1)
printf("-1");
else
printf("1");
return 0;
} | |
A magic island Geraldion, where Gerald lives, has its own currency system. It uses banknotes of several values. But the problem is, the system is not perfect and sometimes it happens that Geraldionians cannot express a certain sum of money with any set of banknotes. Of course, they can use any number of banknotes of ea... | Print a single line — the minimum unfortunate sum. If there are no unfortunate sums, print - 1. | C | df94080c5b0b046af2397cafc02b5bdc | 2ff592ae584c813662457c0f2d549b68 | GNU C | standard output | 256 megabytes | train_002.jsonl | [
"implementation",
"sortings"
] | 1437573600 | ["5\n1 2 3 4 5"] | null | PASSED | 1,000 | standard input | 2 seconds | The first line contains number n (1 ≤ n ≤ 1000) — the number of values of the banknotes that used in Geraldion. The second line contains n distinct space-separated numbers a1, a2, ..., an (1 ≤ ai ≤ 106) — the values of the banknotes. | ["-1"] | #include<stdio.h>
#include<stdlib.h>
#define fr(i,a,n,k) for(i=a;i<n;i+=k)
#define ll long long
#define sc1(x) scanf("%ld",&x)
#define sc2(x,y) scanf("%ld%ld",&x,&y)
#define sc3(x,y,z) scanf("%ld%ld%ld",&x,&y,&z)
#define ss1(s) scanf("%s",s);
#define pr1(x) printf("%lld\n",x)
#define pr2(x,y) printf("%lld\t%lld\n",&x,&... | |
A magic island Geraldion, where Gerald lives, has its own currency system. It uses banknotes of several values. But the problem is, the system is not perfect and sometimes it happens that Geraldionians cannot express a certain sum of money with any set of banknotes. Of course, they can use any number of banknotes of ea... | Print a single line — the minimum unfortunate sum. If there are no unfortunate sums, print - 1. | C | df94080c5b0b046af2397cafc02b5bdc | 4b3f981a702ad795c7bf9413d184c3ca | GNU C | standard output | 256 megabytes | train_002.jsonl | [
"implementation",
"sortings"
] | 1437573600 | ["5\n1 2 3 4 5"] | null | PASSED | 1,000 | standard input | 2 seconds | The first line contains number n (1 ≤ n ≤ 1000) — the number of values of the banknotes that used in Geraldion. The second line contains n distinct space-separated numbers a1, a2, ..., an (1 ≤ ai ≤ 106) — the values of the banknotes. | ["-1"] | #include <stdio.h>
#include <stdlib.h>
int main()
{
int n,i = 0,x= -1000;
scanf("%d",&n);
for(i=0;i<n && x != 1;i++)
{
scanf("%d",&x);
}
if(x==1)
{
printf("-1");
}
else
{
printf("1");
}
return 0;
}
| |
A magic island Geraldion, where Gerald lives, has its own currency system. It uses banknotes of several values. But the problem is, the system is not perfect and sometimes it happens that Geraldionians cannot express a certain sum of money with any set of banknotes. Of course, they can use any number of banknotes of ea... | Print a single line — the minimum unfortunate sum. If there are no unfortunate sums, print - 1. | C | df94080c5b0b046af2397cafc02b5bdc | e88e42160f9909d9e7def794375c4e4f | GNU C | standard output | 256 megabytes | train_002.jsonl | [
"implementation",
"sortings"
] | 1437573600 | ["5\n1 2 3 4 5"] | null | PASSED | 1,000 | standard input | 2 seconds | The first line contains number n (1 ≤ n ≤ 1000) — the number of values of the banknotes that used in Geraldion. The second line contains n distinct space-separated numbers a1, a2, ..., an (1 ≤ ai ≤ 106) — the values of the banknotes. | ["-1"] | #include<stdio.h>
int main()
{
int n,i;
scanf("%d",&n);
long int a[n];
for(i=0;i<n;i++)
{
scanf("%ld",&a[i]);
}
for(i=0;i<n;i++)
{
if(a[i]==1)
{
printf("-1");
return 0;
}
}
printf("1");
return 0;
}
| |
A magic island Geraldion, where Gerald lives, has its own currency system. It uses banknotes of several values. But the problem is, the system is not perfect and sometimes it happens that Geraldionians cannot express a certain sum of money with any set of banknotes. Of course, they can use any number of banknotes of ea... | Print a single line — the minimum unfortunate sum. If there are no unfortunate sums, print - 1. | C | df94080c5b0b046af2397cafc02b5bdc | 79fffe4fbbe5e8eef6d4dc1ebf469ead | GNU C | standard output | 256 megabytes | train_002.jsonl | [
"implementation",
"sortings"
] | 1437573600 | ["5\n1 2 3 4 5"] | null | PASSED | 1,000 | standard input | 2 seconds | The first line contains number n (1 ≤ n ≤ 1000) — the number of values of the banknotes that used in Geraldion. The second line contains n distinct space-separated numbers a1, a2, ..., an (1 ≤ ai ≤ 106) — the values of the banknotes. | ["-1"] | #include <stdio.h>
long long int q[1005];
int main()
{
int a,i;
scanf("%d",&a);
for(i=1 ; i<=a ; i++)
{
scanf("%d",&q[i]);
if(q[i]==1)
{
printf("-1\n");
return 0;
}
}
printf("1\n");
return 0;
}
| |
A magic island Geraldion, where Gerald lives, has its own currency system. It uses banknotes of several values. But the problem is, the system is not perfect and sometimes it happens that Geraldionians cannot express a certain sum of money with any set of banknotes. Of course, they can use any number of banknotes of ea... | Print a single line — the minimum unfortunate sum. If there are no unfortunate sums, print - 1. | C | df94080c5b0b046af2397cafc02b5bdc | 60c105691fcd89d28fa2f5453b6a003d | GNU C | standard output | 256 megabytes | train_002.jsonl | [
"implementation",
"sortings"
] | 1437573600 | ["5\n1 2 3 4 5"] | null | PASSED | 1,000 | standard input | 2 seconds | The first line contains number n (1 ≤ n ≤ 1000) — the number of values of the banknotes that used in Geraldion. The second line contains n distinct space-separated numbers a1, a2, ..., an (1 ≤ ai ≤ 106) — the values of the banknotes. | ["-1"] | /*
* main.c
*
* Created on: Jul 22, 2015
* Author: michael
*/
#include <stdio.h>
#include <stdlib.h>
#define MAX 1000
unsigned int n;
unsigned int banknotes[MAX];
unsigned int i;
int cmp(const void *a, const void *b)
{
return ( *(unsigned int*)a - *(unsigned int *)b );
}
int main()
{
// freopen("input... | |
A magic island Geraldion, where Gerald lives, has its own currency system. It uses banknotes of several values. But the problem is, the system is not perfect and sometimes it happens that Geraldionians cannot express a certain sum of money with any set of banknotes. Of course, they can use any number of banknotes of ea... | Print a single line — the minimum unfortunate sum. If there are no unfortunate sums, print - 1. | C | df94080c5b0b046af2397cafc02b5bdc | 6f3803e57b4110f49239d2c08510bdf7 | GNU C | standard output | 256 megabytes | train_002.jsonl | [
"implementation",
"sortings"
] | 1437573600 | ["5\n1 2 3 4 5"] | null | PASSED | 1,000 | standard input | 2 seconds | The first line contains number n (1 ≤ n ≤ 1000) — the number of values of the banknotes that used in Geraldion. The second line contains n distinct space-separated numbers a1, a2, ..., an (1 ≤ ai ≤ 106) — the values of the banknotes. | ["-1"] | #include <stdio.h>
#include <stdlib.h>
int main()
{
int i, n, noteVal[100005], flag = 0;
scanf("%d",&n);
memset(noteVal, 0, sizeof(noteVal));
for(i=1;i <= n;i ++)
scanf("%d",¬eVal[i]);
for(i=1;i <= n;i ++)
if(noteVal[i] == 1)
{
printf("-1\n");
fla... | |
A magic island Geraldion, where Gerald lives, has its own currency system. It uses banknotes of several values. But the problem is, the system is not perfect and sometimes it happens that Geraldionians cannot express a certain sum of money with any set of banknotes. Of course, they can use any number of banknotes of ea... | Print a single line — the minimum unfortunate sum. If there are no unfortunate sums, print - 1. | C | df94080c5b0b046af2397cafc02b5bdc | ed7279f7f8a809dd8d8ed01152fc3391 | GNU C | standard output | 256 megabytes | train_002.jsonl | [
"implementation",
"sortings"
] | 1437573600 | ["5\n1 2 3 4 5"] | null | PASSED | 1,000 | standard input | 2 seconds | The first line contains number n (1 ≤ n ≤ 1000) — the number of values of the banknotes that used in Geraldion. The second line contains n distinct space-separated numbers a1, a2, ..., an (1 ≤ ai ≤ 106) — the values of the banknotes. | ["-1"] | #include<stdio.h>
int main()
{
int n,a,i;
while(scanf("%d",&n)!=EOF)
{
int flag=0;
for(i=0;i<n;i++)
{
scanf("%d",&a);
if(a==1)
flag=1;
}
if(flag==1)
printf("-1\n");
else
printf("1\n");
}
... | |
A magic island Geraldion, where Gerald lives, has its own currency system. It uses banknotes of several values. But the problem is, the system is not perfect and sometimes it happens that Geraldionians cannot express a certain sum of money with any set of banknotes. Of course, they can use any number of banknotes of ea... | Print a single line — the minimum unfortunate sum. If there are no unfortunate sums, print - 1. | C | df94080c5b0b046af2397cafc02b5bdc | 97d85a7891f85bfa82b762221f3f16d0 | GNU C | standard output | 256 megabytes | train_002.jsonl | [
"implementation",
"sortings"
] | 1437573600 | ["5\n1 2 3 4 5"] | null | PASSED | 1,000 | standard input | 2 seconds | The first line contains number n (1 ≤ n ≤ 1000) — the number of values of the banknotes that used in Geraldion. The second line contains n distinct space-separated numbers a1, a2, ..., an (1 ≤ ai ≤ 106) — the values of the banknotes. | ["-1"] | #include <stdio.h>
#define MAX 1100
void Sort(int x[],int n)
{
int i,j,min,t;
for(i=0;i<n-1;i++)
{
min = i;
for(j=i+1;j<n;j++)
{
if( x[min]>x[j] )
{
min = j;
}
}
if(min!=i)
{
t = x[min];
x[min] = x[i];
x[i] = t;
}
}
}
int Unfo(int x[],int n)
{
Sort(x,n);
if(x[0]>1)
... | |
A magic island Geraldion, where Gerald lives, has its own currency system. It uses banknotes of several values. But the problem is, the system is not perfect and sometimes it happens that Geraldionians cannot express a certain sum of money with any set of banknotes. Of course, they can use any number of banknotes of ea... | Print a single line — the minimum unfortunate sum. If there are no unfortunate sums, print - 1. | C | df94080c5b0b046af2397cafc02b5bdc | d223218e221e35de0be9c7805729c6ac | GNU C | standard output | 256 megabytes | train_002.jsonl | [
"implementation",
"sortings"
] | 1437573600 | ["5\n1 2 3 4 5"] | null | PASSED | 1,000 | standard input | 2 seconds | The first line contains number n (1 ≤ n ≤ 1000) — the number of values of the banknotes that used in Geraldion. The second line contains n distinct space-separated numbers a1, a2, ..., an (1 ≤ ai ≤ 106) — the values of the banknotes. | ["-1"] | #include <stdio.h>
int main()
{
int n;
int a[100000];
int kt = 0;
scanf("%d", &n);
for (int i=0; i<n; i++)
{
scanf("%d", &a[i]);
if (a[i] == 1) kt = 1;
}
int min = a[0];
if (kt == 1) printf("-1");
else printf("1");
return 0;
} | |
A magic island Geraldion, where Gerald lives, has its own currency system. It uses banknotes of several values. But the problem is, the system is not perfect and sometimes it happens that Geraldionians cannot express a certain sum of money with any set of banknotes. Of course, they can use any number of banknotes of ea... | Print a single line — the minimum unfortunate sum. If there are no unfortunate sums, print - 1. | C | df94080c5b0b046af2397cafc02b5bdc | b7a7469d79a29334f05e3fb450e09533 | GNU C | standard output | 256 megabytes | train_002.jsonl | [
"implementation",
"sortings"
] | 1437573600 | ["5\n1 2 3 4 5"] | null | PASSED | 1,000 | standard input | 2 seconds | The first line contains number n (1 ≤ n ≤ 1000) — the number of values of the banknotes that used in Geraldion. The second line contains n distinct space-separated numbers a1, a2, ..., an (1 ≤ ai ≤ 106) — the values of the banknotes. | ["-1"] | #include <stdio.h>
#include <conio.h>
#include <string.h>
#include <math.h>
int main()
{
long long int n,i,min=999999999,k=1;
scanf("%lld",&n);
for(i=1;i<=n;i++){
scanf("%lld",&k);
if(k<min){
min=k;
}
}
if(min==1){
printf("-1");
}
else{
printf("1");
}
return 0;
} | |
A magic island Geraldion, where Gerald lives, has its own currency system. It uses banknotes of several values. But the problem is, the system is not perfect and sometimes it happens that Geraldionians cannot express a certain sum of money with any set of banknotes. Of course, they can use any number of banknotes of ea... | Print a single line — the minimum unfortunate sum. If there are no unfortunate sums, print - 1. | C | df94080c5b0b046af2397cafc02b5bdc | ad340c8869ee5c5e9ac19c19cd178106 | GNU C | standard output | 256 megabytes | train_002.jsonl | [
"implementation",
"sortings"
] | 1437573600 | ["5\n1 2 3 4 5"] | null | PASSED | 1,000 | standard input | 2 seconds | The first line contains number n (1 ≤ n ≤ 1000) — the number of values of the banknotes that used in Geraldion. The second line contains n distinct space-separated numbers a1, a2, ..., an (1 ≤ ai ≤ 106) — the values of the banknotes. | ["-1"] | #include<stdio.h>
int main() {
int i,j;
int arr[1000];
scanf("%d",&i);
for(j=0;j<i;j++){
scanf("%d",arr+j);
//printf("%d\n",*(arr+j));
if(*(arr+j)==1){
printf("-1\n");
return 0;
}
}
printf("1\n");
return 0;
}
| |
A magic island Geraldion, where Gerald lives, has its own currency system. It uses banknotes of several values. But the problem is, the system is not perfect and sometimes it happens that Geraldionians cannot express a certain sum of money with any set of banknotes. Of course, they can use any number of banknotes of ea... | Print a single line — the minimum unfortunate sum. If there are no unfortunate sums, print - 1. | C | df94080c5b0b046af2397cafc02b5bdc | 8a5b2386076ab4b655a6c01a786b55cb | GNU C | standard output | 256 megabytes | train_002.jsonl | [
"implementation",
"sortings"
] | 1437573600 | ["5\n1 2 3 4 5"] | null | PASSED | 1,000 | standard input | 2 seconds | The first line contains number n (1 ≤ n ≤ 1000) — the number of values of the banknotes that used in Geraldion. The second line contains n distinct space-separated numbers a1, a2, ..., an (1 ≤ ai ≤ 106) — the values of the banknotes. | ["-1"] | #include<stdio.h>
long long int a[1000010],i,n,mark=1,flag=1;
int main()
{
scanf("%I64d", &n);
for(i=0;i<n;i++)
{
scanf("%I64d", &a[i]);
if(a[i]==1)
{
mark=-1;
}
}
if(mark==-1) printf("%I64d", mark);
else printf("%I64d", flag);
return 0;
}
| |
A magic island Geraldion, where Gerald lives, has its own currency system. It uses banknotes of several values. But the problem is, the system is not perfect and sometimes it happens that Geraldionians cannot express a certain sum of money with any set of banknotes. Of course, they can use any number of banknotes of ea... | Print a single line — the minimum unfortunate sum. If there are no unfortunate sums, print - 1. | C | df94080c5b0b046af2397cafc02b5bdc | 7231f3f0d3dc96db015fb850f9211a8d | GNU C | standard output | 256 megabytes | train_002.jsonl | [
"implementation",
"sortings"
] | 1437573600 | ["5\n1 2 3 4 5"] | null | PASSED | 1,000 | standard input | 2 seconds | The first line contains number n (1 ≤ n ≤ 1000) — the number of values of the banknotes that used in Geraldion. The second line contains n distinct space-separated numbers a1, a2, ..., an (1 ≤ ai ≤ 106) — the values of the banknotes. | ["-1"] | #include <stdio.h>
int GCD(int a,int b)
{
return b==0?a:GCD(b , a%b);
}
int min(int a, int b)
{
return a<b?a:b;
}
int main()
{
int n;
scanf ( "%d", &n );
int ans = 0;
int i;
int mi = 2100000000;
for(i=0; i<n; i++)
{
int x;
scanf ( "%d", &x );
ans = GCD(x, ans)... | |
A magic island Geraldion, where Gerald lives, has its own currency system. It uses banknotes of several values. But the problem is, the system is not perfect and sometimes it happens that Geraldionians cannot express a certain sum of money with any set of banknotes. Of course, they can use any number of banknotes of ea... | Print a single line — the minimum unfortunate sum. If there are no unfortunate sums, print - 1. | C | df94080c5b0b046af2397cafc02b5bdc | 82f4d0415dbc17bb2f7d1addaa8fcc2d | GNU C | standard output | 256 megabytes | train_002.jsonl | [
"implementation",
"sortings"
] | 1437573600 | ["5\n1 2 3 4 5"] | null | PASSED | 1,000 | standard input | 2 seconds | The first line contains number n (1 ≤ n ≤ 1000) — the number of values of the banknotes that used in Geraldion. The second line contains n distinct space-separated numbers a1, a2, ..., an (1 ≤ ai ≤ 106) — the values of the banknotes. | ["-1"] | #include <stdio.h>
main()
{
int n, a, i;
scanf("%d", &n);
for(i = 0; i< n; i++)
{
scanf("%d", &a);
if(a == 1)
{
printf("-1");
return 0;
}
}
printf("1");
return 0;
}
| |
A magic island Geraldion, where Gerald lives, has its own currency system. It uses banknotes of several values. But the problem is, the system is not perfect and sometimes it happens that Geraldionians cannot express a certain sum of money with any set of banknotes. Of course, they can use any number of banknotes of ea... | Print a single line — the minimum unfortunate sum. If there are no unfortunate sums, print - 1. | C | df94080c5b0b046af2397cafc02b5bdc | aaac169626e45619bbec922644b76b1d | GNU C | standard output | 256 megabytes | train_002.jsonl | [
"implementation",
"sortings"
] | 1437573600 | ["5\n1 2 3 4 5"] | null | PASSED | 1,000 | standard input | 2 seconds | The first line contains number n (1 ≤ n ≤ 1000) — the number of values of the banknotes that used in Geraldion. The second line contains n distinct space-separated numbers a1, a2, ..., an (1 ≤ ai ≤ 106) — the values of the banknotes. | ["-1"] | #include<stdio.h>
int main()
{
int n,a,m=1000000000;
scanf("%d",&n);
while(n--)
{
scanf("%d",&a);
if(m>a) m=a;
}
if(m==1) printf("-1\n");
else printf("1\n");
return 0;
} | |
In late autumn evening n robots gathered in the cheerful company of friends. Each robot has a unique identifier — an integer from 1 to 109.At some moment, robots decided to play the game "Snowball". Below there are the rules of this game. First, all robots stand in a row. Then the first robot says his identifier. After... | Print the k-th pronounced identifier (assume that the numeration starts from 1). | C | 9ad07b42358e7f7cfa15ea382495a8a1 | 570e344c38dd05a924a21fa68c8ea059 | GNU C11 | standard output | 256 megabytes | train_002.jsonl | [
"implementation"
] | 1462464300 | ["2 2\n1 2", "4 5\n10 4 18 3"] | NoteIn the first sample identifiers of robots will be pronounced in the following order: 1, 1, 2. As k = 2, the answer equals to 1.In the second test case identifiers of robots will be pronounced in the following order: 10, 10, 4, 10, 4, 18, 10, 4, 18, 3. As k = 5, the answer equals to 4. | PASSED | 1,000 | standard input | 1 second | The first line contains two positive integers n and k (1 ≤ n ≤ 100 000, 1 ≤ k ≤ min(2·109, n·(n + 1) / 2). The second line contains the sequence id1, id2, ..., idn (1 ≤ idi ≤ 109) — identifiers of roborts. It is guaranteed that all identifiers are different. | ["1", "4"] | #include<stdio.h>
int main()
{
long int n,k,i,q;
scanf("%ld %ld",&n,&k);
long int a[n];
for(i=0;i<n;i++)
scanf("%ld",&a[i]);
q=k;
i=1;
while(1)
{
if(q-i>0)
q=q-i;
else
break;
i++;
}
printf("%ld\n",a[q-1]);
return 0;
}
| |
In late autumn evening n robots gathered in the cheerful company of friends. Each robot has a unique identifier — an integer from 1 to 109.At some moment, robots decided to play the game "Snowball". Below there are the rules of this game. First, all robots stand in a row. Then the first robot says his identifier. After... | Print the k-th pronounced identifier (assume that the numeration starts from 1). | C | 9ad07b42358e7f7cfa15ea382495a8a1 | bf1047f28d5a0fe5a888b4c79d900e00 | GNU C11 | standard output | 256 megabytes | train_002.jsonl | [
"implementation"
] | 1462464300 | ["2 2\n1 2", "4 5\n10 4 18 3"] | NoteIn the first sample identifiers of robots will be pronounced in the following order: 1, 1, 2. As k = 2, the answer equals to 1.In the second test case identifiers of robots will be pronounced in the following order: 10, 10, 4, 10, 4, 18, 10, 4, 18, 3. As k = 5, the answer equals to 4. | PASSED | 1,000 | standard input | 1 second | The first line contains two positive integers n and k (1 ≤ n ≤ 100 000, 1 ≤ k ≤ min(2·109, n·(n + 1) / 2). The second line contains the sequence id1, id2, ..., idn (1 ≤ idi ≤ 109) — identifiers of roborts. It is guaranteed that all identifiers are different. | ["1", "4"] | #include <stdio.h>
int main()
{
int i, n, k, a[100005];
scanf("%d %d", &n, &k);
for (i = 1; i <= n; i++)
scanf("%d", &a[i]);
for (i = 1; i <= 2000000000; i++)
{
if (k - i > 0)k -= i;
else
{
printf("%d", a[k]);
break;
}
}
} | |
In late autumn evening n robots gathered in the cheerful company of friends. Each robot has a unique identifier — an integer from 1 to 109.At some moment, robots decided to play the game "Snowball". Below there are the rules of this game. First, all robots stand in a row. Then the first robot says his identifier. After... | Print the k-th pronounced identifier (assume that the numeration starts from 1). | C | 9ad07b42358e7f7cfa15ea382495a8a1 | 75aec045451f1a3d6ebf8e470a4fac7d | GNU C11 | standard output | 256 megabytes | train_002.jsonl | [
"implementation"
] | 1462464300 | ["2 2\n1 2", "4 5\n10 4 18 3"] | NoteIn the first sample identifiers of robots will be pronounced in the following order: 1, 1, 2. As k = 2, the answer equals to 1.In the second test case identifiers of robots will be pronounced in the following order: 10, 10, 4, 10, 4, 18, 10, 4, 18, 3. As k = 5, the answer equals to 4. | PASSED | 1,000 | standard input | 1 second | The first line contains two positive integers n and k (1 ≤ n ≤ 100 000, 1 ≤ k ≤ min(2·109, n·(n + 1) / 2). The second line contains the sequence id1, id2, ..., idn (1 ≤ idi ≤ 109) — identifiers of roborts. It is guaranteed that all identifiers are different. | ["1", "4"] | #include<stdio.h>
int main()
{
long long int n,k;
scanf("%lld%lld",&n,&k);
long long int i, a[n];
for(i=0;i<n;i++)
scanf("%lld",&a[i]);
// for(i=0;i<n;i++)
long long int j=0;
while(k-j>0)
{
k=k-j;
j++;
}
printf("%lld",a[k-1]);
return 0;
}
| |
In late autumn evening n robots gathered in the cheerful company of friends. Each robot has a unique identifier — an integer from 1 to 109.At some moment, robots decided to play the game "Snowball". Below there are the rules of this game. First, all robots stand in a row. Then the first robot says his identifier. After... | Print the k-th pronounced identifier (assume that the numeration starts from 1). | C | 9ad07b42358e7f7cfa15ea382495a8a1 | 9b5fe47e8f3bcf855d357801ee7cb822 | GNU C11 | standard output | 256 megabytes | train_002.jsonl | [
"implementation"
] | 1462464300 | ["2 2\n1 2", "4 5\n10 4 18 3"] | NoteIn the first sample identifiers of robots will be pronounced in the following order: 1, 1, 2. As k = 2, the answer equals to 1.In the second test case identifiers of robots will be pronounced in the following order: 10, 10, 4, 10, 4, 18, 10, 4, 18, 3. As k = 5, the answer equals to 4. | PASSED | 1,000 | standard input | 1 second | The first line contains two positive integers n and k (1 ≤ n ≤ 100 000, 1 ≤ k ≤ min(2·109, n·(n + 1) / 2). The second line contains the sequence id1, id2, ..., idn (1 ≤ idi ≤ 109) — identifiers of roborts. It is guaranteed that all identifiers are different. | ["1", "4"] | #include <stdio.h>
int main()
{
long long int i, n, k;
while(scanf("%lld %lld", &n, &k) != EOF)
{
int ara[n];
for(i = 0; i < n; i++)
{
scanf("%d", &ara[i]);
}
long long int a = 1, pos;
long long int b1 = (-1 + (sqrt(1 + 4*2*k)))/2;
for(i = ... | |
In late autumn evening n robots gathered in the cheerful company of friends. Each robot has a unique identifier — an integer from 1 to 109.At some moment, robots decided to play the game "Snowball". Below there are the rules of this game. First, all robots stand in a row. Then the first robot says his identifier. After... | Print the k-th pronounced identifier (assume that the numeration starts from 1). | C | 9ad07b42358e7f7cfa15ea382495a8a1 | 0a4f8ba03699d068b27dd38b0ba74358 | GNU C11 | standard output | 256 megabytes | train_002.jsonl | [
"implementation"
] | 1462464300 | ["2 2\n1 2", "4 5\n10 4 18 3"] | NoteIn the first sample identifiers of robots will be pronounced in the following order: 1, 1, 2. As k = 2, the answer equals to 1.In the second test case identifiers of robots will be pronounced in the following order: 10, 10, 4, 10, 4, 18, 10, 4, 18, 3. As k = 5, the answer equals to 4. | PASSED | 1,000 | standard input | 1 second | The first line contains two positive integers n and k (1 ≤ n ≤ 100 000, 1 ≤ k ≤ min(2·109, n·(n + 1) / 2). The second line contains the sequence id1, id2, ..., idn (1 ≤ idi ≤ 109) — identifiers of roborts. It is guaranteed that all identifiers are different. | ["1", "4"] | x;main(k){scanf("%*d%d",&k);for(x=sqrt(2.0*k)-.5001,k-=x*(1ll+x)/2;k--;scanf("%d",&x));printf("%d",x);} | |
In late autumn evening n robots gathered in the cheerful company of friends. Each robot has a unique identifier — an integer from 1 to 109.At some moment, robots decided to play the game "Snowball". Below there are the rules of this game. First, all robots stand in a row. Then the first robot says his identifier. After... | Print the k-th pronounced identifier (assume that the numeration starts from 1). | C | 9ad07b42358e7f7cfa15ea382495a8a1 | e92c47da651c62e6e7588585b0971b87 | GNU C11 | standard output | 256 megabytes | train_002.jsonl | [
"implementation"
] | 1462464300 | ["2 2\n1 2", "4 5\n10 4 18 3"] | NoteIn the first sample identifiers of robots will be pronounced in the following order: 1, 1, 2. As k = 2, the answer equals to 1.In the second test case identifiers of robots will be pronounced in the following order: 10, 10, 4, 10, 4, 18, 10, 4, 18, 3. As k = 5, the answer equals to 4. | PASSED | 1,000 | standard input | 1 second | The first line contains two positive integers n and k (1 ≤ n ≤ 100 000, 1 ≤ k ≤ min(2·109, n·(n + 1) / 2). The second line contains the sequence id1, id2, ..., idn (1 ≤ idi ≤ 109) — identifiers of roborts. It is guaranteed that all identifiers are different. | ["1", "4"] | #include<stdio.h>
#include<math.h>
int main()
{
long long int n,k,i,arr[100001],a=1,b=1,c;
scanf("%lld%lld",&n,&k);
for(i=0;i<n;i++)
{
scanf("%lld",&arr[i]);
}
c=2*k;
long long int d=(-b+sqrt(b*b+4*a*c))/2*a;
long long int e=k-((d*(d+1))/2);
if(e==0)
printf("%l... | |
In late autumn evening n robots gathered in the cheerful company of friends. Each robot has a unique identifier — an integer from 1 to 109.At some moment, robots decided to play the game "Snowball". Below there are the rules of this game. First, all robots stand in a row. Then the first robot says his identifier. After... | Print the k-th pronounced identifier (assume that the numeration starts from 1). | C | 9ad07b42358e7f7cfa15ea382495a8a1 | f16f1aae89e5b795a761d5adc567d806 | GNU C11 | standard output | 256 megabytes | train_002.jsonl | [
"implementation"
] | 1462464300 | ["2 2\n1 2", "4 5\n10 4 18 3"] | NoteIn the first sample identifiers of robots will be pronounced in the following order: 1, 1, 2. As k = 2, the answer equals to 1.In the second test case identifiers of robots will be pronounced in the following order: 10, 10, 4, 10, 4, 18, 10, 4, 18, 3. As k = 5, the answer equals to 4. | PASSED | 1,000 | standard input | 1 second | The first line contains two positive integers n and k (1 ≤ n ≤ 100 000, 1 ≤ k ≤ min(2·109, n·(n + 1) / 2). The second line contains the sequence id1, id2, ..., idn (1 ≤ idi ≤ 109) — identifiers of roborts. It is guaranteed that all identifiers are different. | ["1", "4"] | #include <stdio.h>
int main() {
int n, k, i, id, x = 0;
scanf("%d%d", &n, &k);
for(i = 0; ; i++) {
if(x + i > k - 1) break;
else x += i;
}
for(i = 0; i < n; i++) {
scanf("%d", &id);
if(i == k - 1 - x) printf("%d\n", id);
}
return 0;
}
| |
In late autumn evening n robots gathered in the cheerful company of friends. Each robot has a unique identifier — an integer from 1 to 109.At some moment, robots decided to play the game "Snowball". Below there are the rules of this game. First, all robots stand in a row. Then the first robot says his identifier. After... | Print the k-th pronounced identifier (assume that the numeration starts from 1). | C | 9ad07b42358e7f7cfa15ea382495a8a1 | b9e87e48a17e8c9c7a5f4bbb9bb60eab | GNU C11 | standard output | 256 megabytes | train_002.jsonl | [
"implementation"
] | 1462464300 | ["2 2\n1 2", "4 5\n10 4 18 3"] | NoteIn the first sample identifiers of robots will be pronounced in the following order: 1, 1, 2. As k = 2, the answer equals to 1.In the second test case identifiers of robots will be pronounced in the following order: 10, 10, 4, 10, 4, 18, 10, 4, 18, 3. As k = 5, the answer equals to 4. | PASSED | 1,000 | standard input | 1 second | The first line contains two positive integers n and k (1 ≤ n ≤ 100 000, 1 ≤ k ≤ min(2·109, n·(n + 1) / 2). The second line contains the sequence id1, id2, ..., idn (1 ≤ idi ≤ 109) — identifiers of roborts. It is guaranteed that all identifiers are different. | ["1", "4"] | #include<stdio.h>
int main()
{
long int n,k,i,q;
scanf("%ld %ld",&n,&k);
long int a[n];
for(i=0;i<n;i++)
scanf("%ld",&a[i]);
q=k;
i=1;
while(1)
{
if(q-i>0)
... | |
In late autumn evening n robots gathered in the cheerful company of friends. Each robot has a unique identifier — an integer from 1 to 109.At some moment, robots decided to play the game "Snowball". Below there are the rules of this game. First, all robots stand in a row. Then the first robot says his identifier. After... | Print the k-th pronounced identifier (assume that the numeration starts from 1). | C | 9ad07b42358e7f7cfa15ea382495a8a1 | 7610b6370cc90485b06a879614f4a8e8 | GNU C11 | standard output | 256 megabytes | train_002.jsonl | [
"implementation"
] | 1462464300 | ["2 2\n1 2", "4 5\n10 4 18 3"] | NoteIn the first sample identifiers of robots will be pronounced in the following order: 1, 1, 2. As k = 2, the answer equals to 1.In the second test case identifiers of robots will be pronounced in the following order: 10, 10, 4, 10, 4, 18, 10, 4, 18, 3. As k = 5, the answer equals to 4. | PASSED | 1,000 | standard input | 1 second | The first line contains two positive integers n and k (1 ≤ n ≤ 100 000, 1 ≤ k ≤ min(2·109, n·(n + 1) / 2). The second line contains the sequence id1, id2, ..., idn (1 ≤ idi ≤ 109) — identifiers of roborts. It is guaranteed that all identifiers are different. | ["1", "4"] | #include<stdio.h>
#include<string.h>
int main()
{
long long int n,m,i,d=0;
scanf("%lld %lld",&n,&m);
long long int ara[n];
for(i=0; i<n; i++)
{
scanf("%lld",&ara[i]);
}
for(i=1; i+1<=m; i++)
{
m=m-i;
//printf("%lld\n",m);
}
printf("%lld\n",ara[m-1]);... | |
In late autumn evening n robots gathered in the cheerful company of friends. Each robot has a unique identifier — an integer from 1 to 109.At some moment, robots decided to play the game "Snowball". Below there are the rules of this game. First, all robots stand in a row. Then the first robot says his identifier. After... | Print the k-th pronounced identifier (assume that the numeration starts from 1). | C | 9ad07b42358e7f7cfa15ea382495a8a1 | 8e59add36d491342d460ce8c7b430161 | GNU C11 | standard output | 256 megabytes | train_002.jsonl | [
"implementation"
] | 1462464300 | ["2 2\n1 2", "4 5\n10 4 18 3"] | NoteIn the first sample identifiers of robots will be pronounced in the following order: 1, 1, 2. As k = 2, the answer equals to 1.In the second test case identifiers of robots will be pronounced in the following order: 10, 10, 4, 10, 4, 18, 10, 4, 18, 3. As k = 5, the answer equals to 4. | PASSED | 1,000 | standard input | 1 second | The first line contains two positive integers n and k (1 ≤ n ≤ 100 000, 1 ≤ k ≤ min(2·109, n·(n + 1) / 2). The second line contains the sequence id1, id2, ..., idn (1 ≤ idi ≤ 109) — identifiers of roborts. It is guaranteed that all identifiers are different. | ["1", "4"] | #include<stdio.h>
int main()
{
int n,k,a,c=0;
scanf("%d%d",&n,&k);
int arr[n];
for(int i=0;i<n;i++)
scanf("%d",&arr[i]);
for(int i=0;i<k;i++)
{
for(int j=0;j<=i;j++)
{
a=arr[j];
c++;
if(c==k)goto end;
}
}
end:
printf("%d",a);
... | |
In late autumn evening n robots gathered in the cheerful company of friends. Each robot has a unique identifier — an integer from 1 to 109.At some moment, robots decided to play the game "Snowball". Below there are the rules of this game. First, all robots stand in a row. Then the first robot says his identifier. After... | Print the k-th pronounced identifier (assume that the numeration starts from 1). | C | 9ad07b42358e7f7cfa15ea382495a8a1 | e4955d1c58295c3ea681a310e72697f1 | GNU C11 | standard output | 256 megabytes | train_002.jsonl | [
"implementation"
] | 1462464300 | ["2 2\n1 2", "4 5\n10 4 18 3"] | NoteIn the first sample identifiers of robots will be pronounced in the following order: 1, 1, 2. As k = 2, the answer equals to 1.In the second test case identifiers of robots will be pronounced in the following order: 10, 10, 4, 10, 4, 18, 10, 4, 18, 3. As k = 5, the answer equals to 4. | PASSED | 1,000 | standard input | 1 second | The first line contains two positive integers n and k (1 ≤ n ≤ 100 000, 1 ≤ k ≤ min(2·109, n·(n + 1) / 2). The second line contains the sequence id1, id2, ..., idn (1 ≤ idi ≤ 109) — identifiers of roborts. It is guaranteed that all identifiers are different. | ["1", "4"] | #include <stdio.h>
#include<string.h>
#include<stdlib.h>
#include<math.h>
long long cmpfunc (const void * a, const void * b) {
return ( *(long long*)a - *(long long*)b );
}
int main(void){
long long int test,i,j,n,count,flag=0,o1=0,o2=0,b1,x,m,l,max,x1,y1,k,sum2,min,f,r,o,sum1,sum=0,y,count1, a[1000000]={0};
... | |
In late autumn evening n robots gathered in the cheerful company of friends. Each robot has a unique identifier — an integer from 1 to 109.At some moment, robots decided to play the game "Snowball". Below there are the rules of this game. First, all robots stand in a row. Then the first robot says his identifier. After... | Print the k-th pronounced identifier (assume that the numeration starts from 1). | C | 9ad07b42358e7f7cfa15ea382495a8a1 | 0745d09fcd75c818dc3fdb309b6d6888 | GNU C11 | standard output | 256 megabytes | train_002.jsonl | [
"implementation"
] | 1462464300 | ["2 2\n1 2", "4 5\n10 4 18 3"] | NoteIn the first sample identifiers of robots will be pronounced in the following order: 1, 1, 2. As k = 2, the answer equals to 1.In the second test case identifiers of robots will be pronounced in the following order: 10, 10, 4, 10, 4, 18, 10, 4, 18, 3. As k = 5, the answer equals to 4. | PASSED | 1,000 | standard input | 1 second | The first line contains two positive integers n and k (1 ≤ n ≤ 100 000, 1 ≤ k ≤ min(2·109, n·(n + 1) / 2). The second line contains the sequence id1, id2, ..., idn (1 ≤ idi ≤ 109) — identifiers of roborts. It is guaranteed that all identifiers are different. | ["1", "4"] | #include <stdio.h>
#include<string.h>
#include<stdlib.h>
#include<math.h>
long long cmpfunc (const void * a, const void * b) {
return ( *(long long*)a - *(long long*)b );
}
int main(void){
long long int test,i,j,n,count,flag=0,o1=0,o2=0,b1,x,m,l,max,sum2,min,f,c,r,o,sum1,sum=0,y,a[1000000],count1=0,up,low,a2,... | |
In late autumn evening n robots gathered in the cheerful company of friends. Each robot has a unique identifier — an integer from 1 to 109.At some moment, robots decided to play the game "Snowball". Below there are the rules of this game. First, all robots stand in a row. Then the first robot says his identifier. After... | Print the k-th pronounced identifier (assume that the numeration starts from 1). | C | 9ad07b42358e7f7cfa15ea382495a8a1 | 244efa26871704a3d96f9d51aef29a28 | GNU C11 | standard output | 256 megabytes | train_002.jsonl | [
"implementation"
] | 1462464300 | ["2 2\n1 2", "4 5\n10 4 18 3"] | NoteIn the first sample identifiers of robots will be pronounced in the following order: 1, 1, 2. As k = 2, the answer equals to 1.In the second test case identifiers of robots will be pronounced in the following order: 10, 10, 4, 10, 4, 18, 10, 4, 18, 3. As k = 5, the answer equals to 4. | PASSED | 1,000 | standard input | 1 second | The first line contains two positive integers n and k (1 ≤ n ≤ 100 000, 1 ≤ k ≤ min(2·109, n·(n + 1) / 2). The second line contains the sequence id1, id2, ..., idn (1 ≤ idi ≤ 109) — identifiers of roborts. It is guaranteed that all identifiers are different. | ["1", "4"] | #include<stdio.h>
#include<math.h>
main()
{
long long n, k, i, s, x, a[100010];
scanf("%lld%lld", &n, &k);
for (i=1; i<=n; i++)
{
scanf("%lld", &a[i]);
}
s=sqrt((8*k)+1);
s=s-1;
s=s/2;
x=s;
s=(s*(s+1))/2;
x=(x*(x-1))/2;
if (k!=s)
k=k-s;
else
k=k-x;
printf("%lld\n", a[k]);
return 0;
} | |
In late autumn evening n robots gathered in the cheerful company of friends. Each robot has a unique identifier — an integer from 1 to 109.At some moment, robots decided to play the game "Snowball". Below there are the rules of this game. First, all robots stand in a row. Then the first robot says his identifier. After... | Print the k-th pronounced identifier (assume that the numeration starts from 1). | C | 9ad07b42358e7f7cfa15ea382495a8a1 | 0fd3598aaff96b724892b7149ada46d3 | GNU C11 | standard output | 256 megabytes | train_002.jsonl | [
"implementation"
] | 1462464300 | ["2 2\n1 2", "4 5\n10 4 18 3"] | NoteIn the first sample identifiers of robots will be pronounced in the following order: 1, 1, 2. As k = 2, the answer equals to 1.In the second test case identifiers of robots will be pronounced in the following order: 10, 10, 4, 10, 4, 18, 10, 4, 18, 3. As k = 5, the answer equals to 4. | PASSED | 1,000 | standard input | 1 second | The first line contains two positive integers n and k (1 ≤ n ≤ 100 000, 1 ≤ k ≤ min(2·109, n·(n + 1) / 2). The second line contains the sequence id1, id2, ..., idn (1 ≤ idi ≤ 109) — identifiers of roborts. It is guaranteed that all identifiers are different. | ["1", "4"] | #include<stdio.h>
int main()
{long long int n,k,i,j,c;
scanf("%I64d %I64d",&n,&k);
long long int a[n];
for(i=0;i<n;i++)
{scanf("%I64d",&a[i]);}
for(i=1;i<=n;i++)
{
if(2*k<(i*(i+1)))
{
j=k-i*(i-1)/2;
if(j%n==0)
printf("%I64d",a[j%n]);
else
printf("%I64d",a[j%n-1]);
break;
}
else if(2*k==(i*(i+1)))
{printf("%d... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.