結果

問題 No.37 遊園地のアトラクション
ユーザー 184
提出日時 2014-10-10 16:33:06
言語 C++11(廃止可能性あり)
(gcc 13.3.0)
結果
WA  
実行時間 -
コード長 778 bytes
コンパイル時間 799 ms
コンパイル使用メモリ 66,028 KB
実行使用メモリ 5,248 KB
最終ジャッジ日時 2024-12-30 08:21:50
合計ジャッジ時間 2,350 ms
ジャッジサーバーID
(参考情報)
judge5 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 4
other AC * 7 WA * 20
権限があれば一括ダウンロードができます
コンパイルメッセージ
main.cpp: In function ‘int main()’:
main.cpp:21:14: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
   21 |         scanf("%d%d",&t,&n);//%d%d%d%d",&n,&v,&x,&y,&ax,&ay);
      |         ~~~~~^~~~~~~~~~~~~~
main.cpp:23:34: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
   23 |         for(int i=0;i<n;i++)scanf("%d",&c[i]);
      |                             ~~~~~^~~~~~~~~~~~
main.cpp:24:34: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
   24 |         for(int i=0;i<n;i++)scanf("%d",&v[i]);
      |                             ~~~~~^~~~~~~~~~~~

ソースコード

diff #

#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