結果

問題 No.412 花火大会
ユーザー alpha_virginisalpha_virginis
提出日時 2016-08-12 23:32:26
言語 C++14
(gcc 13.2.0 + boost 1.83.0)
結果
AC  
実行時間 2 ms / 2,000 ms
コード長 1,274 bytes
コンパイル時間 1,540 ms
コンパイル使用メモリ 168,816 KB
実行使用メモリ 4,380 KB
最終ジャッジ日時 2023-08-07 12:38:06
合計ジャッジ時間 2,527 ms
ジャッジサーバーID
(参考情報)
judge12 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1 ms
4,380 KB
testcase_01 AC 1 ms
4,376 KB
testcase_02 AC 2 ms
4,376 KB
testcase_03 AC 2 ms
4,376 KB
testcase_04 AC 1 ms
4,376 KB
testcase_05 AC 2 ms
4,376 KB
testcase_06 AC 1 ms
4,376 KB
testcase_07 AC 1 ms
4,376 KB
testcase_08 AC 2 ms
4,380 KB
testcase_09 AC 1 ms
4,376 KB
testcase_10 AC 2 ms
4,376 KB
testcase_11 AC 2 ms
4,380 KB
testcase_12 AC 1 ms
4,376 KB
testcase_13 AC 2 ms
4,380 KB
testcase_14 AC 1 ms
4,376 KB
testcase_15 AC 1 ms
4,376 KB
testcase_16 AC 1 ms
4,380 KB
testcase_17 AC 2 ms
4,376 KB
testcase_18 AC 1 ms
4,380 KB
testcase_19 AC 1 ms
4,380 KB
testcase_20 AC 1 ms
4,380 KB
testcase_21 AC 2 ms
4,376 KB
権限があれば一括ダウンロードができます

ソースコード

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;
}
0