답안 #378754

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
378754 2021-03-17T03:51:06 Z wiwiho Gift (IZhO18_nicegift) C++14
19 / 100
371 ms 17644 KB
#include <bits/stdc++.h>

#define mp make_pair
#define F first
#define S second
#define eb emplace_back
#define printv(a, b) { \
    for(auto pv : a) b << pv << " "; \
    b << "\n"; \
}

using namespace std;

typedef long long ll;

using pll = pair<ll, ll>;
using pii = pair<int, int>;

const ll MAX = 1LL << 60;

ostream& operator<<(ostream& o, pll p){
    return o << '(' << p.F << ',' << p.S << ')';
}

ll iceil(ll a, ll b){
    return (a + b - 1) / b;
}

int main(){
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    
    ll n, k;
    cin >> n >> k;

    ll a = 0;
    for(int i = 1; i <= n; i++){
        ll t;
        cin >> t;
        if(i != 1) assert(a == t);
        a = t;
    }

    ll g = __gcd(n, k);
    if(a * n % k || n * k / g > 3000000){
        cout << "-1\n";
        return 0;
    }

    ll t = k / g;
    ll v = a / t;
    cout << n / g << "\n";
    int now = 0;
    for(int i = 0; i < n / g; i++){
        cout << v << " ";
        for(int j = 0; j < k; j++){
            cout << 1 + now % n << " ";
            now++;
        }
        cout << "\n";
    }

    return 0;
}
# 결과 실행 시간 메모리 Grader output
1 Runtime error 1 ms 492 KB Execution killed with signal 6
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Runtime error 1 ms 492 KB Execution killed with signal 6
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Runtime error 1 ms 492 KB Execution killed with signal 6
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 371 ms 14728 KB n=1000000
2 Correct 219 ms 8328 KB n=666666
3 Correct 113 ms 4204 KB n=400000
4 Correct 299 ms 17644 KB n=285714
5 Correct 8 ms 492 KB n=20000
6 Correct 286 ms 15852 KB n=181818
7 Correct 3 ms 364 KB n=10000
8 Correct 32 ms 1992 KB n=6666
9 Correct 2 ms 364 KB n=4000
10 Correct 187 ms 9636 KB n=2857
11 Correct 1 ms 384 KB n=2000
# 결과 실행 시간 메모리 Grader output
1 Runtime error 1 ms 492 KB Execution killed with signal 6
2 Halted 0 ms 0 KB -