# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
803434 | 2023-08-03T04:28:34 Z | raysh07 | Ice Hockey World Championship (CEOI15_bobek) | C++17 | 50 ms | 33224 KB |
#include <bits/stdc++.h> using namespace std; #define int long long #define INF (int)1e18 #define f first #define s second mt19937_64 RNG(chrono::steady_clock::now().time_since_epoch().count()); vector <int> gen(vector <int> a){ if (a.size() == 0){ vector <int> res; res.push_back(0); return res; } int x = a.back(); a.pop_back(); vector <int> v = gen(a); vector <int> res; int p1 = 0; for (auto y : v){ while (p1 != v.size() && v[p1] + x < y){ res.push_back(v[p1] + x); p1++; } res.push_back(y); } while (p1 != v.size()){ res.push_back(v[p1] + x); p1++; } return res; } void Solve() { int n, m; cin >> n >> m; vector <int> a, b; for (int i = 0; i < n; i++){ int x; cin >> x; if (i < 20){ a.push_back(x); } else { b.push_back(x); } } vector <int> v1 = gen(a); vector <int> v2 = gen(b); // sort(v1.begin(), v1.end()); // sort(v2.begin(), v2.end()); int ptr = 0; int ans = 0; reverse(v1.begin(), v1.end()); for (auto x : v1){ while (ptr != v2.size() && x + v2[ptr] <= m){ ptr++; } ans += ptr; } cout << ans << "\n"; } int32_t main() { auto begin = std::chrono::high_resolution_clock::now(); ios_base::sync_with_stdio(0); cin.tie(0); int t = 1; // cin >> t; for(int i = 1; i <= t; i++) { //cout << "Case #" << i << ": "; Solve(); } auto end = std::chrono::high_resolution_clock::now(); auto elapsed = std::chrono::duration_cast<std::chrono::nanoseconds>(end - begin); cerr << "Time measured: " << elapsed.count() * 1e-9 << " seconds.\n"; return 0; }
Compilation message
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 0 ms | 212 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 0 ms | 212 KB | Output is correct |
2 | Correct | 1 ms | 212 KB | Output is correct |
3 | Correct | 0 ms | 212 KB | Output is correct |
4 | Correct | 0 ms | 340 KB | Output is correct |
5 | Correct | 0 ms | 340 KB | Output is correct |
6 | Correct | 1 ms | 340 KB | Output is correct |
7 | Correct | 0 ms | 212 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 3 ms | 1992 KB | Output is correct |
2 | Correct | 2 ms | 1232 KB | Output is correct |
3 | Correct | 3 ms | 1992 KB | Output is correct |
4 | Correct | 0 ms | 212 KB | Output is correct |
5 | Correct | 2 ms | 1232 KB | Output is correct |
6 | Correct | 24 ms | 12732 KB | Output is correct |
7 | Correct | 3 ms | 1992 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 22 ms | 12716 KB | Output is correct |
2 | Correct | 5 ms | 3536 KB | Output is correct |
3 | Correct | 2 ms | 1232 KB | Output is correct |
4 | Correct | 2 ms | 1232 KB | Output is correct |
5 | Correct | 14 ms | 12744 KB | Output is correct |
6 | Correct | 3 ms | 1992 KB | Output is correct |
7 | Correct | 3 ms | 1928 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 22 ms | 12752 KB | Output is correct |
2 | Correct | 23 ms | 12708 KB | Output is correct |
3 | Correct | 49 ms | 33172 KB | Output is correct |
4 | Correct | 26 ms | 12772 KB | Output is correct |
5 | Correct | 14 ms | 12744 KB | Output is correct |
6 | Correct | 14 ms | 12752 KB | Output is correct |
7 | Correct | 25 ms | 12740 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 20 ms | 12776 KB | Output is correct |
2 | Correct | 20 ms | 12796 KB | Output is correct |
3 | Correct | 25 ms | 14620 KB | Output is correct |
4 | Correct | 1 ms | 212 KB | Output is correct |
5 | Correct | 14 ms | 12804 KB | Output is correct |
6 | Correct | 17 ms | 12732 KB | Output is correct |
7 | Correct | 24 ms | 12776 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 22 ms | 12796 KB | Output is correct |
2 | Correct | 23 ms | 12756 KB | Output is correct |
3 | Correct | 23 ms | 12804 KB | Output is correct |
4 | Correct | 6 ms | 3536 KB | Output is correct |
5 | Correct | 15 ms | 12816 KB | Output is correct |
6 | Correct | 30 ms | 33164 KB | Output is correct |
7 | Correct | 24 ms | 12792 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 37 ms | 20764 KB | Output is correct |
2 | Correct | 22 ms | 12796 KB | Output is correct |
3 | Correct | 24 ms | 12772 KB | Output is correct |
4 | Correct | 1 ms | 856 KB | Output is correct |
5 | Correct | 14 ms | 12808 KB | Output is correct |
6 | Correct | 35 ms | 20848 KB | Output is correct |
7 | Correct | 22 ms | 12808 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 22 ms | 12788 KB | Output is correct |
2 | Correct | 23 ms | 12772 KB | Output is correct |
3 | Correct | 23 ms | 12756 KB | Output is correct |
4 | Correct | 28 ms | 12816 KB | Output is correct |
5 | Correct | 15 ms | 12800 KB | Output is correct |
6 | Correct | 22 ms | 12796 KB | Output is correct |
7 | Correct | 42 ms | 33052 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 46 ms | 33156 KB | Output is correct |
2 | Correct | 29 ms | 12868 KB | Output is correct |
3 | Correct | 26 ms | 12744 KB | Output is correct |
4 | Correct | 50 ms | 33224 KB | Output is correct |
5 | Correct | 21 ms | 14748 KB | Output is correct |
6 | Correct | 22 ms | 12744 KB | Output is correct |
7 | Correct | 23 ms | 12812 KB | Output is correct |