# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
482667 | 2021-10-26T02:59:37 Z | robell | Ice Hockey World Championship (CEOI15_bobek) | C++14 | 195 ms | 16844 KB |
#pragma GCC optimize("O2") #include <bits/stdc++.h> #include <ext/pb_ds/assoc_container.hpp> using namespace std; using namespace __gnu_pbds; typedef tree<int,null_type,less<int>,rb_tree_tag, tree_order_statistics_node_update> indexed_set; typedef long long ll; #define int long long #define pb push_back #define eb emplace_back #define countbits __builtin_popcount #define beg0 __builtin_clz #define terminal0 __builtin_ctz #define f first #define s second int mod=1e9+7; void setIO(){ ios::sync_with_stdio(0); cin.tie(0); cout.tie(0); } void setIO(string f){ freopen((f+".in").c_str(),"r",stdin); freopen((f+".out").c_str(),"w",stdout); setIO(); } ll N, M, c[40]; ll s1[(1<<20)], s2[(1<<20)]; vector<int> v1, v2; vector<ll> vals; vector<ll> counts={0}; void setup1(){ for (int i=1;i<(1<<v1.size());i++){ for (int j=0;j<v1.size();j++){ if (i&(1<<j)){ int n = i&(~(1<<j)); s1[i]=s1[n]+v1[j]; break; } } } } void setup2(){ for (int i=1;i<(1<<v2.size());i++){ for (int j=0;j<v2.size();j++){ if (i&(1<<j)){ int n = i&(~(1<<j)); s2[i]=s2[n]+v2[j]; break; } } } } int32_t main(){ setIO(); cin >> N >> M; s1[0]=0;s2[0]=0; for (int i=0;i<N;i++){cin >> c[i];} int h1 = (1<<(N/2)), h2 = (1<<((N+1)/2)); for (int i=0;i<N/2;i++) v1.pb(c[i]); for (int i=N/2;i<N;i++) v2.pb(c[i]); setup1();setup2(); sort(s1,s1+h1);sort(s2,s2+h2); ll col = 0, ind = 0; for (int i=h1-1;i>=0;i--){ while (s1[i]+s2[ind]<=M && ind<h2) ind++; col+=ind; } cout << col << "\n"; }
Compilation message
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 0 ms | 204 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 0 ms | 332 KB | Output is correct |
2 | Correct | 0 ms | 204 KB | Output is correct |
3 | Correct | 1 ms | 204 KB | Output is correct |
4 | Correct | 0 ms | 204 KB | Output is correct |
5 | Correct | 0 ms | 204 KB | Output is correct |
6 | Correct | 0 ms | 204 KB | Output is correct |
7 | Correct | 0 ms | 204 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 204 KB | Output is correct |
2 | Correct | 0 ms | 204 KB | Output is correct |
3 | Correct | 1 ms | 204 KB | Output is correct |
4 | Correct | 1 ms | 204 KB | Output is correct |
5 | Correct | 0 ms | 204 KB | Output is correct |
6 | Correct | 1 ms | 332 KB | Output is correct |
7 | Correct | 0 ms | 332 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 0 ms | 332 KB | Output is correct |
2 | Correct | 0 ms | 204 KB | Output is correct |
3 | Correct | 0 ms | 204 KB | Output is correct |
4 | Correct | 0 ms | 204 KB | Output is correct |
5 | Correct | 1 ms | 332 KB | Output is correct |
6 | Correct | 0 ms | 204 KB | Output is correct |
7 | Correct | 0 ms | 332 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 12 ms | 1868 KB | Output is correct |
2 | Correct | 43 ms | 4404 KB | Output is correct |
3 | Correct | 195 ms | 16720 KB | Output is correct |
4 | Correct | 41 ms | 4408 KB | Output is correct |
5 | Correct | 5 ms | 1356 KB | Output is correct |
6 | Correct | 4 ms | 844 KB | Output is correct |
7 | Correct | 9 ms | 1352 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 21 ms | 2364 KB | Output is correct |
2 | Correct | 14 ms | 1864 KB | Output is correct |
3 | Correct | 62 ms | 8444 KB | Output is correct |
4 | Correct | 1 ms | 204 KB | Output is correct |
5 | Correct | 4 ms | 844 KB | Output is correct |
6 | Correct | 10 ms | 1356 KB | Output is correct |
7 | Correct | 13 ms | 1356 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 31 ms | 3400 KB | Output is correct |
2 | Correct | 62 ms | 6476 KB | Output is correct |
3 | Correct | 68 ms | 6348 KB | Output is correct |
4 | Correct | 3 ms | 332 KB | Output is correct |
5 | Correct | 26 ms | 6476 KB | Output is correct |
6 | Correct | 137 ms | 16704 KB | Output is correct |
7 | Correct | 61 ms | 6476 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 129 ms | 12620 KB | Output is correct |
2 | Correct | 18 ms | 1864 KB | Output is correct |
3 | Correct | 5 ms | 716 KB | Output is correct |
4 | Correct | 0 ms | 204 KB | Output is correct |
5 | Correct | 3 ms | 844 KB | Output is correct |
6 | Correct | 140 ms | 12608 KB | Output is correct |
7 | Correct | 9 ms | 1360 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 15 ms | 1868 KB | Output is correct |
2 | Correct | 42 ms | 4404 KB | Output is correct |
3 | Correct | 5 ms | 844 KB | Output is correct |
4 | Correct | 5 ms | 844 KB | Output is correct |
5 | Correct | 31 ms | 6480 KB | Output is correct |
6 | Correct | 14 ms | 1868 KB | Output is correct |
7 | Correct | 176 ms | 16716 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 172 ms | 16716 KB | Output is correct |
2 | Correct | 16 ms | 1872 KB | Output is correct |
3 | Correct | 5 ms | 848 KB | Output is correct |
4 | Correct | 190 ms | 16844 KB | Output is correct |
5 | Correct | 45 ms | 8524 KB | Output is correct |
6 | Correct | 9 ms | 1260 KB | Output is correct |
7 | Correct | 19 ms | 2384 KB | Output is correct |