# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
1019699 | 2024-07-11T07:42:36 Z | NoLove | Happiness (Balkan15_HAPPINESS) | C++14 | 2000 ms | 6736 KB |
/** * author : Lăng Trọng Đạt * created: 11-07-2024 **/ #include <bits/stdc++.h> #include "happiness.h" using namespace std; #ifndef LANG_DAT #define db(...) ; #endif // LANG_DAT #define mp make_pair #define f first #define se second #define pb push_back #define all(v) (v).begin(), (v).end() using pii = pair<int, int>; using vi = vector<int>; #define FOR(i, a, b) for (int (i) = a; (i) <= (b); i++) void mx(int& a, int b) { if (b > a) a = b; } void mi(int& a, int b) { if (b < a) a = b; } #define si(x) (int)(x.size()) const int INF = 1e18; const int MOD = 1e9 + 7; multiset<long long> vals; bool check() { if (si(vals) <= 1) return true; db(vals) long long s = 1; for (long long i : vals) { if (s < i) return false; s += i; } return *vals.begin() == 1; } bool init(int coinsCount, long long maxCoinSize, long long coins[]) { FOR(i, 0, coinsCount - 1) vals.insert(coins[i]); return check(); } bool is_happy(int event, int coinsCount, long long coins[]) { db(vals) FOR(i, 0, coinsCount - 1) if (event == 1) vals.insert(coins[i]); else vals.erase(vals.find(coins[i])); return check(); }
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 344 KB | Output is correct |
2 | Correct | 0 ms | 348 KB | Output is correct |
3 | Correct | 0 ms | 348 KB | Output is correct |
4 | Correct | 1 ms | 600 KB | Output is correct |
5 | Correct | 0 ms | 348 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 344 KB | Output is correct |
2 | Correct | 0 ms | 348 KB | Output is correct |
3 | Correct | 0 ms | 348 KB | Output is correct |
4 | Correct | 1 ms | 600 KB | Output is correct |
5 | Correct | 0 ms | 348 KB | Output is correct |
6 | Correct | 1 ms | 348 KB | Output is correct |
7 | Correct | 1 ms | 348 KB | Output is correct |
8 | Correct | 81 ms | 1116 KB | Output is correct |
9 | Correct | 75 ms | 1116 KB | Output is correct |
10 | Correct | 84 ms | 1116 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 344 KB | Output is correct |
2 | Correct | 0 ms | 348 KB | Output is correct |
3 | Correct | 0 ms | 348 KB | Output is correct |
4 | Correct | 1 ms | 600 KB | Output is correct |
5 | Correct | 0 ms | 348 KB | Output is correct |
6 | Execution timed out | 2029 ms | 6736 KB | Time limit exceeded |
7 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 344 KB | Output is correct |
2 | Correct | 0 ms | 348 KB | Output is correct |
3 | Correct | 0 ms | 348 KB | Output is correct |
4 | Correct | 1 ms | 600 KB | Output is correct |
5 | Correct | 0 ms | 348 KB | Output is correct |
6 | Correct | 1 ms | 348 KB | Output is correct |
7 | Correct | 1 ms | 348 KB | Output is correct |
8 | Correct | 81 ms | 1116 KB | Output is correct |
9 | Correct | 75 ms | 1116 KB | Output is correct |
10 | Correct | 84 ms | 1116 KB | Output is correct |
11 | Execution timed out | 2029 ms | 6736 KB | Time limit exceeded |
12 | Halted | 0 ms | 0 KB | - |