結果

問題 No.475 最終日 - Writerの怠慢
ユーザー chaemonchaemon
提出日時 2016-12-23 02:08:28
言語 C++14
(gcc 13.2.0 + boost 1.83.0)
結果
AC  
実行時間 35 ms / 2,000 ms
コード長 982 bytes
コンパイル時間 1,638 ms
コンパイル使用メモリ 169,436 KB
実行使用メモリ 4,380 KB
最終ジャッジ日時 2023-08-25 16:38:42
合計ジャッジ時間 2,688 ms
ジャッジサーバーID
(参考情報)
judge11 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
4,380 KB
testcase_01 AC 1 ms
4,380 KB
testcase_02 AC 2 ms
4,376 KB
testcase_03 AC 5 ms
4,376 KB
testcase_04 AC 35 ms
4,380 KB
testcase_05 AC 34 ms
4,376 KB
testcase_06 AC 34 ms
4,380 KB
testcase_07 AC 34 ms
4,380 KB
testcase_08 AC 34 ms
4,380 KB
testcase_09 AC 34 ms
4,376 KB
testcase_10 AC 34 ms
4,380 KB
testcase_11 AC 34 ms
4,380 KB
testcase_12 AC 23 ms
4,380 KB
testcase_13 AC 24 ms
4,376 KB
testcase_14 AC 1 ms
4,376 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
main.cpp: 関数 ‘int main()’ 内:
main.cpp:40:39: 警告: ‘score_writer’ may be used uninitialized [-Wmaybe-uninitialized]
   40 |                 while(j<scores.size() and scores[j]+s<=score_writer)j++;
      |                       ~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
main.cpp:20:13: 備考: ‘score_writer’ はここで定義されています
   20 |         int score_writer;//, score_tester;
      |             ^~~~~~~~~~~~

ソースコード

diff #

#include <bits/stdc++.h>
using namespace std;

int score(int star,int rank){
	return (int)(50.0L*(long double)star+50.0L*(long double)star/(0.8L+0.2L*rank));
}

void test(){
	int star = 3;
	for(int rank=1;rank<=10;rank++){
		cout<<rank<<" "<<score(star,rank)<<endl;
	}
}

int N,star,writer;//,tester;

int main(){
//	test();
	vector<int> scores;
	int score_writer;//, score_tester;
	cin>>N>>star>>writer;//>>tester;
	for(int i=0;i<N;i++){
		int s;
		cin>>s;
		if(i==writer)score_writer = s + star*100;
//		else if(i==tester)score_tester = s + star*100;
		else scores.push_back(s);
	}
	sort(scores.begin(),scores.end());
	/*
	if(score_tester>score_writer){
		printf("0.0\n");
		return 0;
	}
	*/
	long double ans = 1.0L;
	int j = 0;
	for(int rank=1;rank<=N-1;rank++){
		int s = score(star,rank);
		while(j<scores.size() and scores[j]+s<=score_writer)j++;
//		cerr<<" "<<j-(rank-1)<<" "<<N-rank<<endl;
		ans*=(j-(rank-1))/(long double)(N-rank);
	}
	printf("%.12Lf\n",ans);
	return 0;
}
0