답안 #92060

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
92060 2019-01-01T10:09:33 Z davitmarg Gift (IZhO18_nicegift) C++17
0 / 100
932 ms 20920 KB
/*
DEATH-MATCH
Davit-Marg
*/
#include <iostream>
#include <algorithm>
#include <cmath>
#include <vector>
#include <string>
#include <cstring>
#include <map>
#include <set>
#include <queue>
#include <deque>
#include <stack>
#include <iterator>
#include <ctype.h>
#include <stdlib.h>  
#include <cassert>
#include <fstream>  
#define mod 998244353ll
#define LL long long
#define LD long double
#define MP make_pair
#define PB push_back
using namespace std;

LL n,k,a[1000006],d,v;

int main()
{
	cin >> n >> k;
	for (int i = 0; i < n; i++)
		scanf("%d",a+i);
	d = n % k + 1;
	if (a[0] % d != 0)
	{
		cout << -1 << endl;
		return 0;
	}
	cout << d * n / k;
	for (int i = 0; i < d*n; i++)
	{
		v %= k;
		if (v == 0)
			cout<<endl << a[0] / d << " ";
		cout<<(i%n)+1<<" ";
		v++;
	}
	cout << endl;
	return 0;
}

/*

14 5
5 5 5 5 5 5 5 5 5 5 5 5 5 5 

*/

Compilation message

nicegift.cpp: In function 'int main()':
nicegift.cpp:34:17: warning: format '%d' expects argument of type 'int*', but argument 2 has type 'long long int*' [-Wformat=]
   scanf("%d",a+i);
              ~~~^
nicegift.cpp:34:8: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
   scanf("%d",a+i);
   ~~~~~^~~~~~~~~~
# 결과 실행 시간 메모리 Grader output
1 Incorrect 2 ms 376 KB Not all heaps are empty in the end
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 2 ms 376 KB Not all heaps are empty in the end
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 2 ms 376 KB Not all heaps are empty in the end
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 932 ms 20920 KB Not all heaps are empty in the end
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 2 ms 376 KB Not all heaps are empty in the end
2 Halted 0 ms 0 KB -