# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
275287 | 2020-08-20T05:12:56 Z | 임성재(#5103) | Happiness (Balkan15_HAPPINESS) | C++17 | 18 ms | 2944 KB |
#include "happiness.h" #include<bits/stdc++.h> using namespace std; #define fast ios::sync_with_stdio(false); cin.tie(0); #define fi first #define se second #define em emplace #define eb emplace_back #define all(v) (v).begin(), (v).end() #define mp make_pair typedef long long ll; typedef pair<int,int> pii; typedef pair<ll,ll> pll; const int inf = 1e9; const ll INF = 1e18; int n, m; int cnt[111]; bool init(int coinsCount, long long maxCoinSize, long long coins[]) { n = coinsCount; m = maxCoinSize; for(int i=0; i<n; i++) { cnt[coins[i]]++; } ll sum = 0; for(int i=1; i<=m; i++) { if(cnt[i] && sum + 1 < i) return false; sum += cnt[i] * i; } return true; } bool is_happy(int event, int coinsCount, long long coins[]) { n = coinsCount; for(int i=0; i<n; i++) { cnt[coins[i]] += event; } ll sum = 0; for(int i=1; i<=m; i++) { //cout << i << " " << sum << endl; if(cnt[i] && sum + 1 < i) return false; sum += cnt[i] * i; } return true; }
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 256 KB | Output is correct |
2 | Correct | 0 ms | 256 KB | Output is correct |
3 | Correct | 0 ms | 256 KB | Output is correct |
4 | Correct | 1 ms | 256 KB | Output is correct |
5 | Correct | 1 ms | 256 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 256 KB | Output is correct |
2 | Correct | 0 ms | 256 KB | Output is correct |
3 | Correct | 0 ms | 256 KB | Output is correct |
4 | Correct | 1 ms | 256 KB | Output is correct |
5 | Correct | 1 ms | 256 KB | Output is correct |
6 | Runtime error | 1 ms | 512 KB | Execution killed with signal 11 |
7 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 256 KB | Output is correct |
2 | Correct | 0 ms | 256 KB | Output is correct |
3 | Correct | 0 ms | 256 KB | Output is correct |
4 | Correct | 1 ms | 256 KB | Output is correct |
5 | Correct | 1 ms | 256 KB | Output is correct |
6 | Runtime error | 18 ms | 2944 KB | Execution killed with signal 11 |
7 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 256 KB | Output is correct |
2 | Correct | 0 ms | 256 KB | Output is correct |
3 | Correct | 0 ms | 256 KB | Output is correct |
4 | Correct | 1 ms | 256 KB | Output is correct |
5 | Correct | 1 ms | 256 KB | Output is correct |
6 | Runtime error | 1 ms | 512 KB | Execution killed with signal 11 |
7 | Halted | 0 ms | 0 KB | - |