| # | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
|---|---|---|---|---|---|---|---|
| 368159 | cheissmart | Happiness (Balkan15_HAPPINESS) | C++14 | 2074 ms | 6636 KiB |
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include "happiness.h"
#include <bits/stdc++.h>
#define F first
#define S second
#define PB push_back
#define EB emplace_back
#define MP make_pair
#define V vector
#define ALL(v) (v).begin(), (v).end()
#define debug(x) cerr << "LINE(" << __LINE__ << ") -> " << #x << " is " << (x) << endl
using namespace std;
typedef long long ll;
typedef pair<int, int> pi;
typedef V<int> vi;
const int INF = 1e9 + 7;
const ll oo = 1e18;
multiset<int> s;
void add_coins(ll val) {
s.insert(val);
}
void del_coins(ll val) {
s.erase(s.find(val));
}
bool happy() {
ll sum = 0;
for(ll i:s) {
if(i > sum + 1) return false;
sum += i;
}
return true;
}
bool init(int coinsCount, long long maxCoinSize, long long coins[]) {
s.clear();
for(int i = 0; i < coinsCount; i++) {
add_coins(coins[i]);
}
return happy();
}
bool is_happy(int event, int coinsCount, long long coins[]) {
if(event == 1) { // add
for(int i = 0; i < coinsCount; i++)
add_coins(coins[i]);
} else { // del
for(int i = 0; i < coinsCount; i++)
del_coins(coins[i]);
}
return happy();
}
컴파일 시 표준 에러 (stderr) 메시지
| # | Verdict | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
| # | Verdict | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
| # | Verdict | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
| # | Verdict | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
