結果

問題 No.37 遊園地のアトラクション
コンテスト
ユーザー 184
提出日時 2014-10-10 16:33:06
言語 C++11
(gcc 15.2.0 + boost 1.89.0)
コンパイル:
g++-15 -O2 -lm -std=gnu++11 -Wuninitialized -DONLINE_JUDGE -o a.out _filename_
実行:
./a.out
結果
WA  
実行時間 -
コード長 778 bytes
記録
記録タグの例:
初AC ショートコード 純ショートコード 純主流ショートコード 最速実行時間
コンパイル時間 514 ms
コンパイル使用メモリ 88,284 KB
実行使用メモリ 6,400 KB
最終ジャッジ日時 2026-06-03 23:37:24
合計ジャッジ時間 2,211 ms
ジャッジサーバーID
(参考情報)
judge3_0 / judge2_1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample WA * 4
other WA * 27
権限があれば一括ダウンロードができます

ソースコード

diff #
raw source code

#include <cstdlib>
#include <cstdio>
#include <cstring>
#include <algorithm>
#include <iostream>
#include <map>
#include <vector>
#include <queue>

using namespace std;


/*
184 //名前が 184
最強の解き方!!!いってみただけ。
no37
*/ 

int main(){
	int t,n;
	scanf("%d%d",&t,&n);//%d%d%d%d",&n,&v,&x,&y,&ax,&ay);
	int v[20],c[20];
	for(int i=0;i<n;i++)scanf("%d",&c[i]);
	for(int i=0;i<n;i++)scanf("%d",&v[i]);	
	int dp[100000]={};
	dp[0]=1;
	int last=0;
	srand(1);
	int max=0;
	for(int i=0;i<1000;i++){
		int cnt[20]={};
		int cs=0;
		int r;
		int vl=0;
		while(cs<=t){
			r=rand()%15;
			if(cs+c[r]>t)break;
			cs+=c[r];
			vl+=v[r]>>cnt[r]++;
		}
		if(max<vl)max=vl;
	}
	printf("%d\n",max);
	
	return 0;
} 
0