# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
40517 | 2018-02-03T14:55:04 Z | Pajaraja | Ice Hockey World Championship (CEOI15_bobek) | C++14 | 618 ms | 9044 KB |
#include <bits/stdc++.h> using namespace std; long long a[40],c[2000000]; long long binarna(int l,int r,long long val) { if(l==r) return l; int s=(l+r)/2; if(c[s]>val) return binarna(l,s,val); return binarna(s+1,r,val); } int main() { int n; long long m,sol=0; scanf("%d %lld",&n,&m); for(int i=0;i<n;i++) scanf("%lld",&a[i]); int p=n/2; for(int i=0;i<(1<<p);i++) { int ma=i; long long pr=0; for(int j=0;j<p;j++) { if(ma%2==0) pr+=a[j]; ma/=2; } c[i]=pr; } c[1<<p]=2000000000000000000LL; sort(c,c+(1<<p)+1); int q=n-p; for(int i=0;i<(1<<q);i++) { int ma=i; long long pr=0; for(int j=0;j<q;j++) { if(ma%2==0) pr+=a[p+j]; ma/=2; } sol+=binarna(0,(1<<p),m-pr); } printf("%lld",sol); }
Compilation message
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 2 ms | 252 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 2 ms | 484 KB | Output is correct |
2 | Correct | 2 ms | 484 KB | Output is correct |
3 | Correct | 1 ms | 484 KB | Output is correct |
4 | Correct | 1 ms | 484 KB | Output is correct |
5 | Correct | 2 ms | 484 KB | Output is correct |
6 | Correct | 2 ms | 532 KB | Output is correct |
7 | Correct | 1 ms | 532 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 2 ms | 548 KB | Output is correct |
2 | Correct | 2 ms | 716 KB | Output is correct |
3 | Correct | 2 ms | 716 KB | Output is correct |
4 | Correct | 1 ms | 716 KB | Output is correct |
5 | Correct | 2 ms | 716 KB | Output is correct |
6 | Correct | 2 ms | 716 KB | Output is correct |
7 | Correct | 2 ms | 716 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 2 ms | 716 KB | Output is correct |
2 | Correct | 2 ms | 716 KB | Output is correct |
3 | Correct | 2 ms | 716 KB | Output is correct |
4 | Correct | 2 ms | 716 KB | Output is correct |
5 | Correct | 2 ms | 716 KB | Output is correct |
6 | Correct | 2 ms | 716 KB | Output is correct |
7 | Correct | 2 ms | 716 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 40 ms | 1180 KB | Output is correct |
2 | Correct | 131 ms | 2716 KB | Output is correct |
3 | Correct | 589 ms | 8860 KB | Output is correct |
4 | Correct | 126 ms | 8860 KB | Output is correct |
5 | Correct | 20 ms | 8860 KB | Output is correct |
6 | Correct | 10 ms | 8860 KB | Output is correct |
7 | Correct | 21 ms | 8860 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 57 ms | 8860 KB | Output is correct |
2 | Correct | 42 ms | 8860 KB | Output is correct |
3 | Correct | 246 ms | 8860 KB | Output is correct |
4 | Correct | 1 ms | 8860 KB | Output is correct |
5 | Correct | 9 ms | 8860 KB | Output is correct |
6 | Correct | 20 ms | 8860 KB | Output is correct |
7 | Correct | 18 ms | 8860 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 89 ms | 8860 KB | Output is correct |
2 | Correct | 213 ms | 8860 KB | Output is correct |
3 | Correct | 204 ms | 8860 KB | Output is correct |
4 | Correct | 2 ms | 8860 KB | Output is correct |
5 | Correct | 104 ms | 8860 KB | Output is correct |
6 | Correct | 327 ms | 8864 KB | Output is correct |
7 | Correct | 108 ms | 8864 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 454 ms | 8864 KB | Output is correct |
2 | Correct | 39 ms | 8864 KB | Output is correct |
3 | Correct | 12 ms | 8864 KB | Output is correct |
4 | Correct | 2 ms | 8864 KB | Output is correct |
5 | Correct | 11 ms | 8864 KB | Output is correct |
6 | Correct | 240 ms | 8864 KB | Output is correct |
7 | Correct | 18 ms | 8864 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 40 ms | 8864 KB | Output is correct |
2 | Correct | 119 ms | 8864 KB | Output is correct |
3 | Correct | 11 ms | 8864 KB | Output is correct |
4 | Correct | 12 ms | 8864 KB | Output is correct |
5 | Correct | 142 ms | 8864 KB | Output is correct |
6 | Correct | 30 ms | 8864 KB | Output is correct |
7 | Correct | 317 ms | 8864 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 489 ms | 9036 KB | Output is correct |
2 | Correct | 42 ms | 9036 KB | Output is correct |
3 | Correct | 13 ms | 9036 KB | Output is correct |
4 | Correct | 618 ms | 9044 KB | Output is correct |
5 | Correct | 165 ms | 9044 KB | Output is correct |
6 | Correct | 20 ms | 9044 KB | Output is correct |
7 | Correct | 37 ms | 9044 KB | Output is correct |