답안 #1107832

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
1107832 2024-11-02T07:13:59 Z KasymK Gift (IZhO18_nicegift) C++17
0 / 100
196 ms 23852 KB
#include "bits/stdc++.h"
using namespace std;
#define ff first
#define ss second
#define all(v) v.begin(), v.end()
#define ll long long
#define pb push_back
#define pii pair<int, int>
#define pli pair<ll, int>
#define pll pair<ll, ll>
#define tr(i, c) for(auto i = c.begin(); i != c.end(); ++i)
#define wr puts("----------------")
template<class T>bool umin(T& a,T b){if(a>b){a=b;return 1;}return 0;}
template<class T>bool umax(T& a,T b){if(a<b){a=b;return 1;}return 0;}
const int N = 1e6+6;
ll v[N];

int main(){
	int n, k;
	scanf("%d%d", &n, &k);
	for(int i = 1; i <= n; ++i){
		ll x;
		scanf("%lld", &x);
		v[i] = x;
	}
	if(n%k==0){
		printf("%d\n", n/k);
		int a = 1;
		while(a<=n){
			printf("%lld ", v[1]);
			int cnt = 0;
			while(cnt<k)
				printf("%d ", a+cnt), cnt++;
			a += k;
			puts("");
		}
		return 0;
	}
	puts("-1");
	return 0;
}

Compilation message

nicegift.cpp: In function 'int main()':
nicegift.cpp:20:7: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
   20 |  scanf("%d%d", &n, &k);
      |  ~~~~~^~~~~~~~~~~~~~~~
nicegift.cpp:23:8: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
   23 |   scanf("%lld", &x);
      |   ~~~~~^~~~~~~~~~~~
# 결과 실행 시간 메모리 Grader output
1 Incorrect 1 ms 336 KB Not all heaps are empty in the end
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 1 ms 336 KB Not all heaps are empty in the end
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 1 ms 336 KB Not all heaps are empty in the end
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 196 ms 22600 KB n=1000000
2 Correct 135 ms 23852 KB n=666666
3 Correct 74 ms 13896 KB n=400000
4 Incorrect 28 ms 8528 KB Jury has the answer but participant has not
5 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 1 ms 336 KB Not all heaps are empty in the end
2 Halted 0 ms 0 KB -