# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
106167 | 2019-04-17T00:46:10 Z | xiaowuc1 | Ice Hockey World Championship (CEOI15_bobek) | C++14 | 369 ms | 20952 KB |
#include <algorithm> #include <cassert> #include <cstring> #include <iomanip> #include <iostream> #include <map> #include <queue> #include <random> #include <set> #include <vector> using namespace std; typedef long long ll; typedef pair<int, int> pii; typedef pair<ll, int> plli; typedef vector<vector<ll>> matrix; void gen(vector<ll>& init, vector<ll>& ret) { for(int mask = 0; mask < 1 << init.size(); mask++) { ll curr = 0; for(int i = 0; i < init.size(); i++) { if(mask&(1LL<<i)) curr += init[i]; } ret.push_back(curr); } sort(ret.begin(), ret.end()); } void solve() { int n; ll thresh; cin >> n >> thresh; vector<ll> a, b; for(int i = 0; i < n; i++) { ll t; cin >> t; (i%2?a:b).push_back(t); } vector<ll> ar, br; gen(a, ar); gen(b, br); ll ret = 0; int j = br.size()-1; for(int i = 0; i < ar.size() && j >= 0; i++) { while(j >= 0 && ar[i] + br[j] > thresh) j--; ret += j+1; } cout << ret << endl; } int main() { ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL); /* int t; cin >> t; for(int i = 1; i <= t; i++) { cout << "Case #" << i << ": "; solve(); } */ solve(); }
Compilation message
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 2 ms | 512 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 2 ms | 384 KB | Output is correct |
2 | Correct | 2 ms | 384 KB | Output is correct |
3 | Correct | 2 ms | 384 KB | Output is correct |
4 | Correct | 3 ms | 384 KB | Output is correct |
5 | Correct | 3 ms | 384 KB | Output is correct |
6 | Correct | 2 ms | 384 KB | Output is correct |
7 | Correct | 2 ms | 384 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 3 ms | 384 KB | Output is correct |
2 | Correct | 2 ms | 384 KB | Output is correct |
3 | Correct | 3 ms | 384 KB | Output is correct |
4 | Correct | 2 ms | 384 KB | Output is correct |
5 | Correct | 2 ms | 384 KB | Output is correct |
6 | Correct | 3 ms | 384 KB | Output is correct |
7 | Correct | 3 ms | 384 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 2 ms | 384 KB | Output is correct |
2 | Correct | 2 ms | 384 KB | Output is correct |
3 | Correct | 3 ms | 384 KB | Output is correct |
4 | Correct | 2 ms | 384 KB | Output is correct |
5 | Correct | 3 ms | 384 KB | Output is correct |
6 | Correct | 3 ms | 384 KB | Output is correct |
7 | Correct | 3 ms | 384 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 30 ms | 2044 KB | Output is correct |
2 | Correct | 87 ms | 5428 KB | Output is correct |
3 | Correct | 366 ms | 20932 KB | Output is correct |
4 | Correct | 85 ms | 5480 KB | Output is correct |
5 | Correct | 18 ms | 1660 KB | Output is correct |
6 | Correct | 11 ms | 1024 KB | Output is correct |
7 | Correct | 20 ms | 1660 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 43 ms | 2932 KB | Output is correct |
2 | Correct | 30 ms | 2044 KB | Output is correct |
3 | Correct | 160 ms | 10596 KB | Output is correct |
4 | Correct | 2 ms | 384 KB | Output is correct |
5 | Correct | 9 ms | 1048 KB | Output is correct |
6 | Correct | 20 ms | 1660 KB | Output is correct |
7 | Correct | 20 ms | 1660 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 65 ms | 3620 KB | Output is correct |
2 | Correct | 145 ms | 6696 KB | Output is correct |
3 | Correct | 127 ms | 6632 KB | Output is correct |
4 | Correct | 2 ms | 384 KB | Output is correct |
5 | Correct | 90 ms | 6632 KB | Output is correct |
6 | Correct | 339 ms | 20936 KB | Output is correct |
7 | Correct | 132 ms | 6788 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 253 ms | 12876 KB | Output is correct |
2 | Correct | 31 ms | 2044 KB | Output is correct |
3 | Correct | 11 ms | 1024 KB | Output is correct |
4 | Correct | 2 ms | 384 KB | Output is correct |
5 | Correct | 9 ms | 1024 KB | Output is correct |
6 | Correct | 268 ms | 13008 KB | Output is correct |
7 | Correct | 20 ms | 1660 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 37 ms | 2036 KB | Output is correct |
2 | Correct | 77 ms | 5480 KB | Output is correct |
3 | Correct | 10 ms | 1024 KB | Output is correct |
4 | Correct | 11 ms | 1024 KB | Output is correct |
5 | Correct | 93 ms | 6632 KB | Output is correct |
6 | Correct | 30 ms | 2044 KB | Output is correct |
7 | Correct | 359 ms | 20952 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 355 ms | 20948 KB | Output is correct |
2 | Correct | 32 ms | 2044 KB | Output is correct |
3 | Correct | 13 ms | 1024 KB | Output is correct |
4 | Correct | 369 ms | 20928 KB | Output is correct |
5 | Correct | 120 ms | 10592 KB | Output is correct |
6 | Correct | 20 ms | 1632 KB | Output is correct |
7 | Correct | 45 ms | 2928 KB | Output is correct |