Submission #682817

# Submission time Handle Problem Language Result Execution time Memory
682817 2023-01-17T04:53:50 Z iskhakkutbilim Gift (IZhO18_nicegift) C++14
0 / 100
274 ms 44500 KB
#include <bits/stdc++.h>
using namespace std;

#define int long long
#define ff first
#define ss second
#define all(a) a.begin(), a.end()
const int M = 1e9 + 7;
const int N = 1e6 + 1;

main(){
   ios::sync_with_stdio(0);
   cin.tie(0); cout.tie(0);
	int n, k; cin >> n >> k;
	int a[n];
	for(int i = 0;i < n; i++){
		cin >> a[i];
	}
	set<int> st(a, a + n);
	if(st.size() == 1){
		if(n%k!= 0){
			cout << -1;
		}else{
			cout << n / k << '\n';
			deque<int> q;
			for(int i = 0;i < n; i++) q.push_back(i);
			for(int i = 0;i < n / k; i++){
				cout << a[0] << ' ';
				int c = k;
				while(c--){
					cout << q.front()+1 << ' ';
					q.pop_front();
				}
				cout << '\n';
			}
		}
		return 0;
	}
	return 0;
}

Compilation message

nicegift.cpp:11:1: warning: ISO C++ forbids declaration of 'main' with no type [-Wreturn-type]
   11 | main(){
      | ^~~~
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 212 KB Unexpected end of file - int32 expected
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 212 KB Unexpected end of file - int32 expected
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 212 KB Unexpected end of file - int32 expected
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 274 ms 44500 KB n=1000000
2 Correct 168 ms 28004 KB n=666666
3 Correct 98 ms 16076 KB n=400000
4 Incorrect 44 ms 6360 KB Jury has the answer but participant has not
5 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 212 KB Unexpected end of file - int32 expected
2 Halted 0 ms 0 KB -