結果

問題 No.2462 七人カノン
ユーザー maeshunmaeshun
提出日時 2023-09-09 14:23:38
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 285 ms / 2,000 ms
コード長 1,095 bytes
コンパイル時間 3,838 ms
コンパイル使用メモリ 232,512 KB
実行使用メモリ 12,288 KB
最終ジャッジ日時 2023-09-09 14:23:53
合計ジャッジ時間 14,956 ms
ジャッジサーバーID
(参考情報)
judge15 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 3 ms
4,824 KB
testcase_01 AC 3 ms
4,988 KB
testcase_02 AC 4 ms
4,824 KB
testcase_03 AC 6 ms
5,116 KB
testcase_04 AC 7 ms
5,084 KB
testcase_05 AC 6 ms
5,184 KB
testcase_06 AC 6 ms
5,220 KB
testcase_07 AC 6 ms
5,148 KB
testcase_08 AC 5 ms
5,240 KB
testcase_09 AC 5 ms
5,248 KB
testcase_10 AC 6 ms
5,164 KB
testcase_11 AC 6 ms
5,168 KB
testcase_12 AC 7 ms
5,304 KB
testcase_13 AC 240 ms
10,232 KB
testcase_14 AC 274 ms
10,892 KB
testcase_15 AC 244 ms
10,232 KB
testcase_16 AC 285 ms
10,924 KB
testcase_17 AC 280 ms
11,024 KB
testcase_18 AC 188 ms
8,840 KB
testcase_19 AC 188 ms
8,948 KB
testcase_20 AC 268 ms
11,936 KB
testcase_21 AC 270 ms
12,004 KB
testcase_22 AC 274 ms
12,288 KB
testcase_23 AC 271 ms
12,052 KB
testcase_24 AC 236 ms
10,660 KB
testcase_25 AC 283 ms
12,056 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
main.cpp: 関数 ‘int main()’ 内:
main.cpp:48:26: 警告: structured bindings only available with ‘-std=c++17’ or ‘-std=gnu++17’ [-Wc++17-extensions]
   48 |                 for(auto [l, r] : I[i]){
      |                          ^

ソースコード

diff #

#include <bits/stdc++.h>
using namespace std;
#include <atcoder/all>
using namespace atcoder;
#define rep(i, n) for(int i=0;i<(n);++i)
#define rep1(i, n) for(int i=1;i<=(n);i++)
#define ll long long
using mint = modint998244353;
using P = pair<ll,ll>;
using lb = long double;
using T = tuple<ll, ll, ll>;
#ifdef LOCAL
#  include <debug_print.hpp>
#  define dbg(...) debug_print::multi_print(#__VA_ARGS__, __VA_ARGS__)
#else
#  define dbg(...) (static_cast<void>(0))
#endif

int main()
{
	int n, q;
	cin >> n >> q;
	vector<vector<pair<int, int>>> I(n);
	vector<int> imos(1e5+5);
	rep(i,q){
		int s, l ,r;
		cin >> s >> l >> r;
		--s;
		I[s].emplace_back(l,r);
		imos[l]++;
		imos[r]--;
	}
	vector<lb> sum(1e5+5);
	for(int i=0;i<=1e5+4;i++){
		imos[i+1] += imos[i];
	}
	for(int i=0;i<=1e5+4;i++){
		sum[i+1] += sum[i];
		if(imos[i]!=0){
			sum[i+1] += (lb)1/imos[i];
		}
	}
	for(int i=0;i<=10;i++){
		dbg(sum[i]);
	}
	vector<lb> ans(n);
	rep(i,n){
		for(auto [l, r] : I[i]){
			ans[i] += sum[r] - sum[l]; 
		}
	}
	cout << fixed << setprecision(16);
	rep(i,n){
		cout<<ans[i]<<endl;
	}
	return 0;
}
0