# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
510065 | 2022-01-14T16:04:06 Z | CraniXort | Ice Hockey World Championship (CEOI15_bobek) | C++17 | 208 ms | 33408 KB |
#include <bits/stdc++.h> #define fin std::cin #define fout std::cout // std::ifstream fin("hockey.in"); // std::ofstream fout("hockey.out"); void compute(std::vector <long long>& v) { std::vector <long long> x; std::stack <long long> toAdd; x.push_back(0); for(auto value: v) { for(auto sum: x) toAdd.push(value + sum); while(toAdd.empty() == false) { x.push_back(toAdd.top()); toAdd.pop(); } } std::sort(x.begin(), x.end()); v = x; } void print(std::vector <long long> &v) { for(int i: v) fout << i << ' '; fout << '\n'; } int main() { std::ios_base::sync_with_stdio(false); std::cin.tie(NULL); int n; long long maxsum; fin >> n >> maxsum; std::vector <long long> a, b; for(int i = 0, value; i < n / 2; i ++) { fin >> value; a.push_back(value); } for(int i = n / 2, value; i < n; i ++){ fin >> value; b.push_back(value); } compute(a); compute(b); // print(a); // print(b); long long ans = 0; for(int i = 0, j = b.size() - 1; i < a.size(); i ++) { while(j >= 0 and a[i] + b[j] > maxsum) j --; ans = ans + (j + 1); } fout << ans << '\n'; return 0; }
Compilation message
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 0 ms | 204 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 0 ms | 204 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 | 0 ms | 204 KB | Output is correct |
6 | Correct | 1 ms | 204 KB | Output is correct |
7 | Correct | 0 ms | 204 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Incorrect | 0 ms | 204 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Incorrect | 0 ms | 332 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 16 ms | 3960 KB | Output is correct |
2 | Correct | 56 ms | 8556 KB | Output is correct |
3 | Correct | 208 ms | 33408 KB | Output is correct |
4 | Correct | 52 ms | 8556 KB | Output is correct |
5 | Correct | 8 ms | 2272 KB | Output is correct |
6 | Correct | 5 ms | 1352 KB | Output is correct |
7 | Correct | 12 ms | 2404 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 20 ms | 4448 KB | Output is correct |
2 | Correct | 16 ms | 3960 KB | Output is correct |
3 | Correct | 71 ms | 16796 KB | Output is correct |
4 | Correct | 0 ms | 204 KB | Output is correct |
5 | Correct | 3 ms | 1352 KB | Output is correct |
6 | Correct | 10 ms | 2408 KB | Output is correct |
7 | Correct | 10 ms | 2392 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 33 ms | 7608 KB | Output is correct |
2 | Correct | 74 ms | 14808 KB | Output is correct |
3 | Correct | 78 ms | 14712 KB | Output is correct |
4 | Correct | 0 ms | 204 KB | Output is correct |
5 | Correct | 46 ms | 14812 KB | Output is correct |
6 | Correct | 153 ms | 33408 KB | Output is correct |
7 | Correct | 70 ms | 14840 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Incorrect | 60 ms | 29312 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Incorrect | 8 ms | 3908 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Incorrect | 84 ms | 33340 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |