# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
484842 | 2021-11-05T15:41:53 Z | luka1234 | Gift (IZhO18_nicegift) | C++14 | 8 ms | 332 KB |
#include<bits/stdc++.h> #define ll long long #define ff first #define ss second using namespace std; int n,m; int a[1000001]; int sum=0; int main(){ cin>>n>>m; for(int k=1;k<=n;k++){ cin>>a[k]; sum+=a[k]; } if(sum%m!=0){ cout<<-1; return 0; } int bolo=a[1]; if(bolo>(sum/m)){ cout<<-1; return 0; } int A=a[1]; int N=n; int x=__gcd(A,m); int y=m/x; int das=A/x; for(int k=1;k<=n;k+=y){ cout<<das<<' '; if((k+m)<=n+1){ for(int i=k;i<k+m;i++){ cout<<i<<' '; } } else{ for(int i=k;i<=n;i++){ cout<<i<<' '; } int raod=n-k+1; raod=m-raod; for(int i=1;i<raod+1;i++){ cout<<i<<' '; } } cout<<"\n"; } return 0; }
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 1 ms | 204 KB | Not all heaps are empty in the end |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 1 ms | 204 KB | Not all heaps are empty in the end |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 1 ms | 204 KB | Not all heaps are empty in the end |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 8 ms | 332 KB | Jury has the answer but participant has not |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 1 ms | 204 KB | Not all heaps are empty in the end |
2 | Halted | 0 ms | 0 KB | - |