# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
682237 | 2023-01-16T04:59:41 Z | MilosMilutinovic | Happiness (Balkan15_HAPPINESS) | C++14 | 2000 ms | 13984 KB |
#include "happiness.h" #include <bits/stdc++.h> using namespace std; multiset<long long> c; bool Process(multiset<long long> st) { vector<long long> v; for (auto x : st) { v.push_back(x); } vector<long long> pref(1, 1); for (auto x : st) { pref.push_back(pref.back() + x); } for (int i = 0; i < (int) v.size(); i++) { if (pref[i] < v[i]) { return false; } } return true; } bool init(int coinsCount, long long maxCoinSize, long long coins[]) { for (int i = 0; i < coinsCount; i++) { c.insert(coins[i]); } return Process(c); } bool is_happy(int event, int coinsCount, long long coins[]) { if (event == -1) { for (int i = 0; i < coinsCount; i++) { c.erase(c.find(coins[i])); } } else { for (int i = 0; i < coinsCount; i++) { c.insert(coins[i]); } } return Process(c); }
Compilation message
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 212 KB | Output is correct |
2 | Correct | 1 ms | 212 KB | Output is correct |
3 | Correct | 1 ms | 212 KB | Output is correct |
4 | Correct | 1 ms | 212 KB | Output is correct |
5 | Correct | 2 ms | 340 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 212 KB | Output is correct |
2 | Correct | 1 ms | 212 KB | Output is correct |
3 | Correct | 1 ms | 212 KB | Output is correct |
4 | Correct | 1 ms | 212 KB | Output is correct |
5 | Correct | 2 ms | 340 KB | Output is correct |
6 | Correct | 6 ms | 488 KB | Output is correct |
7 | Correct | 7 ms | 484 KB | Output is correct |
8 | Correct | 663 ms | 1872 KB | Output is correct |
9 | Correct | 730 ms | 1828 KB | Output is correct |
10 | Correct | 797 ms | 1848 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 212 KB | Output is correct |
2 | Correct | 1 ms | 212 KB | Output is correct |
3 | Correct | 1 ms | 212 KB | Output is correct |
4 | Correct | 1 ms | 212 KB | Output is correct |
5 | Correct | 2 ms | 340 KB | Output is correct |
6 | Execution timed out | 2052 ms | 13984 KB | Time limit exceeded |
7 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 212 KB | Output is correct |
2 | Correct | 1 ms | 212 KB | Output is correct |
3 | Correct | 1 ms | 212 KB | Output is correct |
4 | Correct | 1 ms | 212 KB | Output is correct |
5 | Correct | 2 ms | 340 KB | Output is correct |
6 | Correct | 6 ms | 488 KB | Output is correct |
7 | Correct | 7 ms | 484 KB | Output is correct |
8 | Correct | 663 ms | 1872 KB | Output is correct |
9 | Correct | 730 ms | 1828 KB | Output is correct |
10 | Correct | 797 ms | 1848 KB | Output is correct |
11 | Execution timed out | 2052 ms | 13984 KB | Time limit exceeded |
12 | Halted | 0 ms | 0 KB | - |