# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
484845 | 2021-11-05T15:46:15 Z | luka1234 | Gift (IZhO18_nicegift) | C++14 | 825 ms | 35988 KB |
#include<bits/stdc++.h> #define ll long long #define ff first #define ss second using namespace std; ll n,m; ll a[1000001]; ll sum=0; int main(){ cin>>n>>m; for(ll k=1;k<=n;k++){ cin>>a[k]; sum+=a[k]; } if(sum%m!=0){ cout<<-1; return 0; } ll bolo=a[1]; if(bolo>(sum/m)){ cout<<-1; return 0; } ll A=a[1]; ll N=n; ll x=__gcd(A,m); ll y=m/x; ll das=A/x; cout<<n/y<<"\n"; for(ll k=1;k<=n;k+=y){ cout<<das<<' '; if((k+m)<=n+1){ for(ll i=k;i<k+m;i++){ cout<<i<<' '; } } else{ for(ll i=k;i<=n;i++){ cout<<i<<' '; } ll raod=n-k+1; raod=m-raod; for(ll i=1;i<raod+1;i++){ cout<<i<<' '; } } cout<<"\n"; } return 0; }
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 0 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 | 0 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 | 0 ms | 204 KB | Not all heaps are empty in the end |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 825 ms | 35988 KB | n=1000000 |
2 | Correct | 419 ms | 22532 KB | n=666666 |
3 | Correct | 454 ms | 27928 KB | n=400000 |
4 | Correct | 382 ms | 23632 KB | n=285714 |
5 | Correct | 201 ms | 11844 KB | n=20000 |
6 | Correct | 276 ms | 19536 KB | n=181818 |
7 | Correct | 201 ms | 10492 KB | n=10000 |
8 | Correct | 80 ms | 5316 KB | n=6666 |
9 | Correct | 158 ms | 9840 KB | n=4000 |
10 | Correct | 150 ms | 9616 KB | n=2857 |
11 | Correct | 189 ms | 9284 KB | n=2000 |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 0 ms | 204 KB | Not all heaps are empty in the end |
2 | Halted | 0 ms | 0 KB | - |