# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
362384 | 2021-02-02T20:13:41 Z | shahriarkhan | Ice Hockey World Championship (CEOI15_bobek) | C++14 | 405 ms | 20936 KB |
#include<bits/stdc++.h> using namespace std ; const int mx = 45 ; int n , fs , ss ; long long m , ans = 0 , a[mx] ; vector<long long> vf , vs ; int main() { scanf("%d%lld",&n,&m) ; for(int i = 1 ; i <= n ; ++i) { scanf("%lld",&a[i]) ; } fs = n/2 , ss = n - fs ; for(int i = 0 ; i < (1<<fs) ; ++i) { long long sum = 0 ; for(int j = 0 ; j < fs ; ++j) { if(i&(1<<j)) sum += a[j+1] ; } vf.push_back(sum) ; } for(int i = 0 ; i < (1<<ss) ; ++i) { long long sum = 0 ; for(int j = 0 ; j < ss ; ++j) { if(i&(1<<j)) sum += a[j+fs+1] ; } vs.push_back(sum) ; } sort(vf.begin(),vf.end()) ; sort(vs.begin(),vs.end()) ; for(long long i : vf) { if(i>m) break ; long long cnt = (upper_bound(vs.begin(),vs.end(),m-i) - vs.begin()) ; ans += cnt ; } printf("%lld\n",ans) ; return 0 ; }
Compilation message
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 0 ms | 364 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 364 KB | Output is correct |
2 | Correct | 0 ms | 364 KB | Output is correct |
3 | Correct | 0 ms | 364 KB | Output is correct |
4 | Correct | 0 ms | 364 KB | Output is correct |
5 | Correct | 0 ms | 364 KB | Output is correct |
6 | Correct | 0 ms | 364 KB | Output is correct |
7 | Correct | 0 ms | 364 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 364 KB | Output is correct |
2 | Correct | 1 ms | 364 KB | Output is correct |
3 | Correct | 1 ms | 364 KB | Output is correct |
4 | Correct | 1 ms | 364 KB | Output is correct |
5 | Correct | 1 ms | 364 KB | Output is correct |
6 | Correct | 1 ms | 364 KB | Output is correct |
7 | Correct | 1 ms | 364 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 364 KB | Output is correct |
2 | Correct | 1 ms | 364 KB | Output is correct |
3 | Correct | 1 ms | 364 KB | Output is correct |
4 | Correct | 1 ms | 364 KB | Output is correct |
5 | Correct | 1 ms | 364 KB | Output is correct |
6 | Correct | 1 ms | 364 KB | Output is correct |
7 | Correct | 1 ms | 364 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 30 ms | 2024 KB | Output is correct |
2 | Correct | 93 ms | 5468 KB | Output is correct |
3 | Correct | 405 ms | 20808 KB | Output is correct |
4 | Correct | 92 ms | 5468 KB | Output is correct |
5 | Correct | 15 ms | 1636 KB | Output is correct |
6 | Correct | 10 ms | 1004 KB | Output is correct |
7 | Correct | 20 ms | 1656 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 42 ms | 2912 KB | Output is correct |
2 | Correct | 33 ms | 2024 KB | Output is correct |
3 | Correct | 156 ms | 10580 KB | Output is correct |
4 | Correct | 0 ms | 364 KB | Output is correct |
5 | Correct | 7 ms | 1004 KB | Output is correct |
6 | Correct | 20 ms | 1636 KB | Output is correct |
7 | Correct | 19 ms | 1636 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 68 ms | 3676 KB | Output is correct |
2 | Correct | 137 ms | 6624 KB | Output is correct |
3 | Correct | 138 ms | 6624 KB | Output is correct |
4 | Correct | 1 ms | 364 KB | Output is correct |
5 | Correct | 87 ms | 6624 KB | Output is correct |
6 | Correct | 331 ms | 20936 KB | Output is correct |
7 | Correct | 122 ms | 6624 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 283 ms | 12752 KB | Output is correct |
2 | Correct | 31 ms | 2024 KB | Output is correct |
3 | Correct | 11 ms | 1004 KB | Output is correct |
4 | Correct | 1 ms | 364 KB | Output is correct |
5 | Correct | 8 ms | 1004 KB | Output is correct |
6 | Correct | 272 ms | 12752 KB | Output is correct |
7 | Correct | 18 ms | 1636 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 32 ms | 2024 KB | Output is correct |
2 | Correct | 91 ms | 5468 KB | Output is correct |
3 | Correct | 10 ms | 1004 KB | Output is correct |
4 | Correct | 11 ms | 1004 KB | Output is correct |
5 | Correct | 94 ms | 6624 KB | Output is correct |
6 | Correct | 30 ms | 2024 KB | Output is correct |
7 | Correct | 336 ms | 20808 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 396 ms | 20880 KB | Output is correct |
2 | Correct | 32 ms | 2024 KB | Output is correct |
3 | Correct | 11 ms | 1004 KB | Output is correct |
4 | Correct | 405 ms | 20912 KB | Output is correct |
5 | Correct | 128 ms | 10580 KB | Output is correct |
6 | Correct | 20 ms | 1636 KB | Output is correct |
7 | Correct | 38 ms | 2912 KB | Output is correct |