답안 #467061

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
467061 2021-08-21T14:04:47 Z mosiashvililuka Gift (IZhO18_nicegift) C++14
0 / 100
1102 ms 120300 KB
#include<bits/stdc++.h>
using namespace std;
long long a,b,c,d,e,i,j,ii,jj,zx,xc,k,f[1000009],sub;
int main(){
	ios_base::sync_with_stdio(false),cin.tie(0),cout.tie(0);
	//cin>>a>>k;
	scanf("%I64d %I64d\n",&a,&k);
	for(i=1; i<=a; i++){
		scanf("%I64d",&f[i]);
		zx+=f[i];
		if(i>1&&f[i]!=f[i-1]) sub=1;
	}
	if(zx%k!=0){
		printf("-1");
		exit(0);
	}
	if(sub==0){
		c=a*k/__gcd(a,k);c/=a;
		if(c>f[1]){
			printf("-1");
			exit(0);
		}
		d=f[1]/c;
		for(i=1; i<=c*a; i+=k){
			printf("%I64d ",d);
			ii=i%a;if(ii==0) ii=a;
			jj=(i+k-1)%a;if(jj==0) jj=a;
			for(j=i; ; j++){
				if(j>a) j-=a;
				printf("%I64d ",j);
				if(j==jj) break;
			}
			printf("\n");
		}
	}
	return 0;
}

Compilation message

nicegift.cpp: In function 'int main()':
nicegift.cpp:7:13: warning: format '%d' expects argument of type 'int*', but argument 2 has type 'long long int*' [-Wformat=]
    7 |  scanf("%I64d %I64d\n",&a,&k);
      |         ~~~~^          ~~
      |             |          |
      |             int*       long long int*
      |         %I64lld
nicegift.cpp:7:19: warning: format '%d' expects argument of type 'int*', but argument 3 has type 'long long int*' [-Wformat=]
    7 |  scanf("%I64d %I64d\n",&a,&k);
      |               ~~~~^       ~~
      |                   |       |
      |                   int*    long long int*
      |               %I64lld
nicegift.cpp:9:14: warning: format '%d' expects argument of type 'int*', but argument 2 has type 'long long int*' [-Wformat=]
    9 |   scanf("%I64d",&f[i]);
      |          ~~~~^  ~~~~~
      |              |  |
      |              |  long long int*
      |              int*
      |          %I64lld
nicegift.cpp:25:16: warning: format '%d' expects argument of type 'int', but argument 2 has type 'long long int' [-Wformat=]
   25 |    printf("%I64d ",d);
      |            ~~~~^   ~
      |                |   |
      |                int long long int
      |            %I64lld
nicegift.cpp:30:17: warning: format '%d' expects argument of type 'int', but argument 2 has type 'long long int' [-Wformat=]
   30 |     printf("%I64d ",j);
      |             ~~~~^   ~
      |                 |   |
      |                 int long long int
      |             %I64lld
nicegift.cpp:7:7: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
    7 |  scanf("%I64d %I64d\n",&a,&k);
      |  ~~~~~^~~~~~~~~~~~~~~~~~~~~~~
nicegift.cpp:9:8: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
    9 |   scanf("%I64d",&f[i]);
      |   ~~~~~^~~~~~~~~~~~~~~
# 결과 실행 시간 메모리 Grader output
1 Incorrect 1 ms 204 KB Unexpected end of file - int32 expected
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 1 ms 204 KB Unexpected end of file - int32 expected
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 1 ms 204 KB Unexpected end of file - int32 expected
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 1102 ms 120300 KB Not all heaps are empty in the end
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 1 ms 204 KB Unexpected end of file - int32 expected
2 Halted 0 ms 0 KB -