結果
| 問題 |
No.412 花火大会
|
| ユーザー |
goodbaton
|
| 提出日時 | 2016-08-13 13:32:05 |
| 言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
| 結果 |
AC
|
| 実行時間 | 8 ms / 2,000 ms |
| コード長 | 1,566 bytes |
| コンパイル時間 | 850 ms |
| コンパイル使用メモリ | 83,984 KB |
| 実行使用メモリ | 5,248 KB |
| 最終ジャッジ日時 | 2024-11-07 16:37:07 |
| 合計ジャッジ時間 | 1,665 ms |
|
ジャッジサーバーID (参考情報) |
judge2 / judge5 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 4 |
| other | AC * 18 |
コンパイルメッセージ
main.cpp: In function ‘int main()’:
main.cpp:62:29: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
62 | for(int i=0;i<3;i++) scanf("%d",b+i);
| ~~~~~^~~~~~~~~~
main.cpp:63:8: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
63 | scanf("%d",&n);
| ~~~~~^~~~~~~~~
main.cpp:64:29: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
64 | for(int i=0;i<n;i++) scanf("%d",e+i);
| ~~~~~^~~~~~~~~~
ソースコード
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <cstring>
#include <iostream>
#include <string>
#include <algorithm>
#include <vector>
#include <queue>
#include <stack>
#include <map>
#include <set>
#include <functional>
#include <cassert>
typedef long long ll;
using namespace std;
#define debug(x) cerr << #x << " = " << x << endl;
#define mod 1000000007 //1e9+7(prime number)
#define INF 1000000000 //1e9
#define LLINF 2000000000000000000LL //2e18
#define SIZE 10000
int b[3];
void calc(int *array,int size, int *result){
for(int i=0;i<(1<<size);i++){
int s[3] = {};
for(int j=0;j<size;j++){
if(!(i & (1<<j))) continue;
for(int k=0;k<3;k++){
if(b[k] <= array[j]){
s[k]++;
break;
}
}
}
s[0]=min(s[0],3);
s[1]=min(s[1],2);
s[2]=min(s[2],1);
result[s[0]*6 + s[1]*2 + s[2]] ++;
}
}
int main(){
int n,e[SIZE];
int res1[24] = {},res2[24] = {};
for(int i=0;i<3;i++) scanf("%d",b+i);
scanf("%d",&n);
for(int i=0;i<n;i++) scanf("%d",e+i);
if(n<3){
puts("0");
return 0;
}
sort(b,b+3,greater<int>());
calc(e,n/2,res1);
calc(e+(n/2),n-(n/2),res2);
ll ans = 0;
for(int i=0;i<24;i++){
for(int j=0;j<24;j++){
int s[3];
s[0] = i/6 + j/6;
s[1] = i/2%3 + j/2%3;
s[2] = i%2 + j%2;
s[1] += max(s[0]-1,0);
s[2] += max(s[1]-1,0);
if(s[0]>0 && s[1]>0 && s[2]>0){
ans += (ll)res1[i] * res2[j];
}
}
}
printf("%lld\n",ans);
return 0;
}
goodbaton