답안 #93096

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
93096 2019-01-06T13:08:33 Z Moysenko Gift (IZhO18_nicegift) C++17
0 / 100
170 ms 8128 KB
/*ЗАПУСКАЕМ 
░ГУСЯ░▄▀▀▀▄░РАБОТЯГИ░░ 
▄███▀░◐░░░▌░░░░░░░ 
░░░░▌░░░░░▐░░░░░░░ 
░░░░▐░░░░░▐░░░░░░░ 
░░░░▌░░░░░▐▄▄░░░░░ 
░░░░▌░░░░▄▀▒▒▀▀▀▀▄ 
░░░▐░░░░▐▒▒▒▒▒▒▒▒▀▀▄ 
░░░▐░░░░▐▄▒▒▒▒▒▒▒▒▒▒▀▄ 
░░░░▀▄░░░░▀▄▒▒▒▒▒▒▒▒▒▒▀▄ 
░░░░░░▀▄▄▄▄▄█▄▄▄▄▄▄▄▄▄▄▄▀▄ 
░░░░░░░░░░░▌▌░▌▌░░░░░ 
░░░░░░░░░░░▌▌░▌▌░░░░░ 
░░░░░░░░░▄▄▌▌▄▌▌░░░░░
НАСТРОЙКА НА КРИТЫ ██████████████] 100% СОЧНОСТИ*/
#include <iostream>
#include <vector>
#include <algorithm>
#include <set>
#include <map>
#include <string>
#include <math.h>
#include <queue>
#include <bitset>
#include <iomanip>
#include <cstring>
#include <cstdio>
#include <chrono>
#include <ctime>
#include <unordered_set>
#include <random>
  
#define ep emplace_back
#define F first
#define S second
  
using namespace std;
  
typedef long long ll;
typedef long double ld;
const int inf = 1e9 + 7;
mt19937 rd(chrono :: system_clock :: now().time_since_epoch().count());
  
#pragma GCC optimize("unroll-loops") // развернуть цикл
#pragma GCC optimize("Ofast") // скомпилировать с о3
/*
#pragma GCC optimize("no-stack-protector") // что-то со стеком
#pragma GCC target("sse,sse2,sse3,ssse3,popcnt,abm,mmx,tune=native") // оптимизации процессора
#pragma GCC optimize("fast-math") // оптимизации сопроцессора
*/

const int siz = 1e6 + 10;
ll a[siz];

ll gcd(ll x, ll y){
	return (x ? gcd(y % x, x) : y);
}
 
int main(){
    ios::sync_with_stdio(0), cin.tie(0);
#ifdef LOCAL
    freopen("input.txt", "r", stdin);
    freopen("output.txt", "w", stdout);
#endif
 
    int n, k;
    cin >> n >> k;
    int i;
    for (i = 0; i < n; i++)
    	cin >> a[i];

    for (i = 1; i < n; i++)
    	if (a[i] != a[0]){
    		cout << "3\n2 3 1\n1 3 2\n2 2 4";
    		return 0;
    	}

    ll x = gcd(a[0], k), y = gcd(n, k);
    if ((x * y) % k != 0){
    	cout << -1;
    	return 0;
    }

    y = n / x;
    ll A = a[0] / x, B = n / y;
    int j;
    cout << B << '\n';
    for (i = 0; i < n; i++){
    	if (i % y == 0){
    		cout << A << ' ';
    		for (j = 0; j < k; j++)
    			cout << (i + j) % n + 1 << ' ';
    		cout << '\n';
    	}
    }

}
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 376 KB n=4
2 Incorrect 2 ms 376 KB Taken too much stones from the heap
3 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 376 KB n=4
2 Incorrect 2 ms 376 KB Taken too much stones from the heap
3 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 376 KB n=4
2 Incorrect 2 ms 376 KB Taken too much stones from the heap
3 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 170 ms 8128 KB Not all heaps are empty in the end
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 376 KB n=4
2 Incorrect 2 ms 376 KB Taken too much stones from the heap
3 Halted 0 ms 0 KB -