# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
85412 | 2018-11-19T19:50:44 Z | farukkastamonuda | Nice sequence (IZhO18_sequence) | C++14 | 22 ms | 2176 KB |
#include <bits/stdc++.h> #define fi first #define se second #define mp make_pair #define lo long long #define inf 1000000000 #define md 1000000007 #define pb push_back #define li 400105 using namespace std; int t,n,m,B[li]; int main(){ scanf("%d",&t); while(t--){ scanf("%d %d",&n,&m);// n negative , m positive if(n==m){ printf("%d\n",n-1); for(int i=1;i<=n-1;i++) printf("1 "); printf("\n"); continue; } if(n==1){ printf("%d\n",m-1); for(int i=1;i<=m-1;i++){ printf("-1 "); } printf("\n"); continue; } if(m==1){ printf("%d\n",n-1); for(int i=1;i<=n-1;i++){ printf("1 "); } printf("\n"); continue; } if(n<m){ for(int i=1;i<=400000;i++){ if(i%n==0){ B[i]=-((n-1)*100+1); } else B[i]=100; } int sum=0; for(int i=1;i<=m;i++){ sum+=B[i]; } if(sum<=0){ printf("0\n\n"); continue; } int say=m; for(int i=m+1;i<=400000;i++){ sum-=B[i-m]; sum+=B[i]; if(sum<=0) break; say++; } printf("%d\n",say); for(int i=1;i<=say;i++){ printf("%d ",B[i]); } printf("\n"); } else{ for(int i=1;i<=400000;i++){ if(i%m==0){ B[i]=((m-1)*100+1); } else B[i]=-100; } int sum=0; for(int i=1;i<=n;i++){ sum+=B[i]; } if(sum>=0){ printf("0\n\n"); continue; } int say=n; for(int i=n+1;i<=400000;i++){ sum-=B[i-n]; sum+=B[i]; if(sum<=0) break; say++; } printf("%d\n",say); for(int i=1;i<=say;i++){ printf("%d ",B[i]); } printf("\n"); } } return 0; }
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 2 ms | 256 KB | Ok |
2 | Incorrect | 5 ms | 1908 KB | Jury has the better answer : jans = 86, pans = 0 |
3 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 19 ms | 1984 KB | there is incorrect sequence |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 5 ms | 2008 KB | Ok |
2 | Correct | 2 ms | 2008 KB | Ok |
3 | Incorrect | 17 ms | 2008 KB | Jury has the better answer : jans = 5, pans = 0 |
4 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 22 ms | 2176 KB | Jury has the better answer : jans = 3, pans = 0 |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 2 ms | 256 KB | Ok |
2 | Incorrect | 5 ms | 1908 KB | Jury has the better answer : jans = 86, pans = 0 |
3 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 2 ms | 256 KB | Ok |
2 | Incorrect | 5 ms | 1908 KB | Jury has the better answer : jans = 86, pans = 0 |
3 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 2 ms | 256 KB | Ok |
2 | Incorrect | 5 ms | 1908 KB | Jury has the better answer : jans = 86, pans = 0 |
3 | Halted | 0 ms | 0 KB | - |