# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
92157 | 2019-01-01T19:06:26 Z | davitmarg | Gift (IZhO18_nicegift) | C++17 | 921 ms | 22392 KB |
/* DEATH-MATCH Davit-Marg */ #include <iostream> #include <algorithm> #include <cmath> #include <vector> #include <string> #include <cstring> #include <map> #include <set> #include <queue> #include <deque> #include <stack> #include <iterator> #include <ctype.h> #include <stdlib.h> #include <cassert> #include <fstream> #define mod 998244353ll #define LL long long #define LD long double #define MP make_pair #define PB push_back using namespace std; LL gcd(LL a, LL b) { while (b) { a %= b; swap(a, b); } return a; } LL n,k,a[1000006],d,v; int main() { cin >> n >> k; for (LL i = 0; i < n; i++) scanf("%lld",a+i); d = k/gcd(n,k); if (a[0] % d != 0) { cout << -1 << endl; return 0; } cout << d * n / k; for (LL i = 0; i < d*n; i++) { v %= k; if (v == 0) cout<<endl << a[0] / d << " "; cout<<(i%n)+1<<" "; v++; } cout << endl; return 0; } /* 4 3 6 6 6 6 14 7 10 10 10 10 10 10 10 10 10 10 10 10 10 10 */
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 2 ms | 376 KB | Not all heaps are empty in the end |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 2 ms | 376 KB | Not all heaps are empty in the end |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 2 ms | 376 KB | Not all heaps are empty in the end |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 921 ms | 22392 KB | n=1000000 |
2 | Correct | 482 ms | 14584 KB | n=666666 |
3 | Correct | 208 ms | 8880 KB | n=400000 |
4 | Correct | 641 ms | 21200 KB | n=285714 |
5 | Correct | 7 ms | 1016 KB | n=20000 |
6 | Correct | 484 ms | 19192 KB | n=181818 |
7 | Correct | 4 ms | 632 KB | n=10000 |
8 | Correct | 35 ms | 2040 KB | n=6666 |
9 | Correct | 3 ms | 376 KB | n=4000 |
10 | Correct | 192 ms | 9464 KB | n=2857 |
11 | Correct | 2 ms | 376 KB | n=2000 |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 2 ms | 376 KB | Not all heaps are empty in the end |
2 | Halted | 0 ms | 0 KB | - |