# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
374224 | 2021-03-06T23:37:52 Z | MilosMilutinovic | Ice Hockey World Championship (CEOI15_bobek) | C++14 | 550 ms | 8664 KB |
#include <bits/stdc++.h> using namespace std; #define ll long long #define pb push_back const int N=45; ll a[N]; int main(){ int n;scanf("%i",&n); ll m;scanf("%lld",&m); for(int i=0;i<n;i++)scanf("%lld",&a[i]); int b=n/2; vector<ll> all; ll ans=1; for(int i=1;i<(1<<b);i++){ ll sum=0LL; for(int j=0;j<b;j++){ if(i&(1<<j))sum+=a[j]; } all.pb(sum); if(sum<=m)ans++; //printf("%lld\n",sum); } sort(all.begin(),all.end()); int sz=n-b; auto Get=[&](ll x){ if(x>m)return 0; return (int)(lower_bound(all.begin(),all.end(),m-x)-all.begin()); }; for(int i=1;i<(1<<sz);i++){ ll sum=0LL; for(int j=0;j<sz;j++){ if(i&(1<<j))sum+=a[b+j]; } //printf("%lld\n",sum); ans+=Get(sum); if(sum<=m)ans++; } printf("%lld",ans); }
Compilation message
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | 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 | 512 KB | Output is correct |
5 | Correct | 1 ms | 384 KB | Output is correct |
6 | Correct | 1 ms | 364 KB | Output is correct |
7 | Correct | 1 ms | 384 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 372 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 | Incorrect | 1 ms | 364 KB | Output isn't correct |
6 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | 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 | Incorrect | 1 ms | 364 KB | Output isn't correct |
6 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Incorrect | 34 ms | 1000 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Incorrect | 45 ms | 1508 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Incorrect | 76 ms | 1508 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 363 ms | 4572 KB | Output is correct |
2 | Correct | 31 ms | 1000 KB | Output is correct |
3 | Correct | 11 ms | 748 KB | Output is correct |
4 | Correct | 1 ms | 364 KB | Output is correct |
5 | Incorrect | 9 ms | 748 KB | Output isn't correct |
6 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 33 ms | 1000 KB | Output is correct |
2 | Correct | 99 ms | 2528 KB | Output is correct |
3 | Correct | 12 ms | 748 KB | Output is correct |
4 | Correct | 10 ms | 748 KB | Output is correct |
5 | Incorrect | 122 ms | 2528 KB | Output isn't correct |
6 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 420 ms | 8664 KB | Output is correct |
2 | Correct | 35 ms | 1000 KB | Output is correct |
3 | Correct | 11 ms | 748 KB | Output is correct |
4 | Correct | 550 ms | 8664 KB | Output is correct |
5 | Incorrect | 154 ms | 4572 KB | Output isn't correct |
6 | Halted | 0 ms | 0 KB | - |