Submission #172795

# Submission time Handle Problem Language Result Execution time Memory
172795 2020-01-02T16:12:33 Z juggernaut Gift (IZhO18_nicegift) C++14
0 / 100
188 ms 14112 KB
//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

nicegift.cpp:6:6: warning: ISO C++ forbids declaration of 'main' with no type [-Wreturn-type]
 main(){
      ^
nicegift.cpp: In function 'int main()':
nicegift.cpp:7:10: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
     scanf("%lld%lld%lld",&n,&k,&a);
     ~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~
# Verdict Execution time Memory Grader output
1 Incorrect 2 ms 356 KB Taken too much stones from the heap
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 2 ms 356 KB Taken too much stones from the heap
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 2 ms 356 KB Taken too much stones from the heap
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 188 ms 14112 KB Taken too much stones from the heap
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 2 ms 356 KB Taken too much stones from the heap
2 Halted 0 ms 0 KB -