# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
172795 | juggernaut | Gift (IZhO18_nicegift) | C++14 | 188 ms | 14112 KiB |
This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
//Just try and the idea will come!
#include<bits/stdc++.h>
#define int long long int
using namespace std;
int n,k,i,a,b,j,ind;
main(){
scanf("%lld%lld%lld",&n,&k,&a);
if((n*a)%k!=0){
puts("-1");
return 0;
}
if(a%(__gcd(n,k))!=0)return 1;
b=a/(k/__gcd(n,k));
ind=n*a/k/b;
i=0;
printf("%lld\n",ind);
while(ind--){
printf("%lld",b);
for(j=0;j<k;j++)printf(" %lld",(i+j)%n+1);
i=(i+1)%n;
puts("");
}
}
Compilation message (stderr)
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |