답안 #172795

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
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);
     ~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~
# 결과 실행 시간 메모리 Grader output
1 Incorrect 2 ms 356 KB Taken too much stones from the heap
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 2 ms 356 KB Taken too much stones from the heap
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 2 ms 356 KB Taken too much stones from the heap
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 188 ms 14112 KB Taken too much stones from the heap
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 2 ms 356 KB Taken too much stones from the heap
2 Halted 0 ms 0 KB -