結果

問題 No.412 花火大会
ユーザー alpha_virginis
提出日時 2016-08-12 23:32:26
言語 C++14
(gcc 13.3.0 + boost 1.87.0)
結果
AC  
実行時間 2 ms / 2,000 ms
コード長 1,274 bytes
コンパイル時間 2,082 ms
コンパイル使用メモリ 169,616 KB
実行使用メモリ 5,248 KB
最終ジャッジ日時 2024-11-07 16:35:16
合計ジャッジ時間 2,854 ms
ジャッジサーバーID
(参考情報)
judge4 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 4
other AC * 18
権限があれば一括ダウンロードができます

ソースコード

diff #
プレゼンテーションモードにする

#include <bits/stdc++.h>
template<typename T> T in() { abort(); return T(); }
template<> std::string in() { std::string str; std::cin >> str; return str; }
template<> int in() { int x; scanf("%d", &x); return x; }
template<typename T> void out(T x) { abort(); }
template<> void out(const char* x) { printf("%s\n", x); }
template<> void out(std::string x) { std::cout << x << std::endl; }
template<> void out(int x) { printf("%d\n", x); }
template<> void out(long x) { printf("%ld\n", x); }
template<typename T>
T pow(T x, long n) {
T res = 1;
T p = x;
while( n != 0 ) {
if( n & 0x01 ) res *= p;
p *= p;
n >>= 1;
}
return res;
}
int xs[3];
int n;
int ys[128];
int main() {
for(int i = 0; i < 3; ++i) {
xs[i] = in<int>();
}
n = in<int>();
for(int i = 0; i < n; ++i) ys[i] = in<int>();
std::sort(xs, xs + 3);
std::reverse(xs, xs + 3);
std::sort(ys, ys + n);
std::reverse(ys, ys + n);
long res = 0;
for(int i = 0; i < n; ++i) {
if( not ( ys[i] >= xs[0] ) ) break;
for(int j = i + 1; j < n; ++j) {
if( not ( ys[j] >= xs[1] ) ) break;
for(int k = j + 1; k < n; ++k) {
if( not ( ys[k] >= xs[2] ) ) break;
res += pow(2LL, n - k - 1);
}
}
}
out(res);
return 0;
}
הההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההה
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
0