Submission #153921

# Submission time Handle Problem Language Result Execution time Memory
153921 2019-09-17T13:42:58 Z andrew Gift (IZhO18_nicegift) C++17
0 / 100
372 ms 36216 KB
#include <bits/stdc++.h>
#include<ext/pb_ds/assoc_container.hpp>
#include<ext/pb_ds/tree_policy.hpp>

#pragma GCC optimize("-O3")
#pragma GCC optimize("Ofast")
#pragma GCC optimize("unroll-loops")

#define fi first
#define se second
#define p_b push_back
#define pll pair<ll,ll>
#define pii pair<int,int>
#define m_p make_pair
#define all(x) x.begin(),x.end()
#define sset ordered_set
#define sqr(x) (x)*(x)
#define pw(x) (1ll << x)

using namespace std;
using namespace __gnu_pbds;
typedef long long ll;
typedef long double ld;
const ll MAXN = 1123456;
const ll N = 2e5;
mt19937_64 rnd(chrono::system_clock::now().time_since_epoch().count());

template <typename T>
using ordered_set = tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;

template <typename T> void vout(T s){cout << s << endl;exit(0);}



int main(){
    ios_base :: sync_with_stdio(0);
    cin.tie(0);

    ll n, k;

    cin >> n >> k;

    vector <ll> a(n + 1);

    for(int i = 1; i <= n; i++)cin >> a[i];

    if(*min_element(a.begin() + 1, a.end()) == *max_element(a.begin() + 1, a.end())){
        if(n % k)vout(-1);
        cout << n / k << "\n";
        for(int i = 1; i <= n; i += k){
            cout << a[1] << " ";
            for(int j = 1; j <= k; j++)cout << " " << j + i - 1;
            cout << "\n";
        }
        return 0;
    }else{
        cout << "3\n2 3 1\n1 3 2\n2 2 4\n";
    }

    return 0;
}
# Verdict Execution time Memory Grader output
1 Correct 3 ms 504 KB n=4
2 Incorrect 3 ms 376 KB Taken too much stones from the heap
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 3 ms 504 KB n=4
2 Incorrect 3 ms 376 KB Taken too much stones from the heap
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 3 ms 504 KB n=4
2 Incorrect 3 ms 376 KB Taken too much stones from the heap
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 372 ms 36216 KB n=1000000
2 Correct 235 ms 22632 KB n=666666
3 Correct 133 ms 12852 KB n=400000
4 Incorrect 62 ms 6520 KB Jury has the answer but participant has not
5 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 3 ms 504 KB n=4
2 Incorrect 3 ms 376 KB Taken too much stones from the heap
3 Halted 0 ms 0 KB -