結果

問題 No.2462 七人カノン
ユーザー LynkcatLynkcat
提出日時 2023-09-08 21:29:39
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 109 ms / 2,000 ms
コード長 1,027 bytes
コンパイル時間 1,722 ms
コンパイル使用メモリ 168,648 KB
実行使用メモリ 10,692 KB
最終ジャッジ日時 2023-09-08 21:29:50
合計ジャッジ時間 9,872 ms
ジャッジサーバーID
(参考情報)
judge11 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 5 ms
7,508 KB
testcase_01 AC 5 ms
7,588 KB
testcase_02 AC 5 ms
7,400 KB
testcase_03 AC 6 ms
7,640 KB
testcase_04 AC 6 ms
7,428 KB
testcase_05 AC 6 ms
7,524 KB
testcase_06 AC 6 ms
7,412 KB
testcase_07 AC 5 ms
7,560 KB
testcase_08 AC 6 ms
7,412 KB
testcase_09 AC 12 ms
7,468 KB
testcase_10 AC 6 ms
7,472 KB
testcase_11 AC 6 ms
7,480 KB
testcase_12 AC 6 ms
7,416 KB
testcase_13 AC 88 ms
9,920 KB
testcase_14 AC 96 ms
9,952 KB
testcase_15 AC 88 ms
9,820 KB
testcase_16 AC 108 ms
10,116 KB
testcase_17 AC 107 ms
10,052 KB
testcase_18 AC 45 ms
7,448 KB
testcase_19 AC 45 ms
7,400 KB
testcase_20 AC 95 ms
10,548 KB
testcase_21 AC 98 ms
10,500 KB
testcase_22 AC 98 ms
10,692 KB
testcase_23 AC 97 ms
10,668 KB
testcase_24 AC 80 ms
8,960 KB
testcase_25 AC 109 ms
10,572 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
main.cpp: 関数 ‘void BellaKira()’ 内:
main.cpp:41:27: 警告: structured bindings only available with ‘-std=c++17’ or ‘-std=gnu++17’ [-Wc++17-extensions]
   41 |                 for (auto [l,r]:G[i])
      |                           ^

ソースコード

diff #

// Problem: No.2462 七人カノン
// Contest: yukicoder
// URL: https://yukicoder.me/problems/no/2462
// Memory Limit: 512 MB
// Time Limit: 2000 ms
// 
// Powered by CP Editor (https://cpeditor.org)

#include<bits/stdc++.h>
#define poly vector<int>
#define IOS ios::sync_with_stdio(false)
#define ll long long
#define mp make_pair
#define mt make_tuple
#define pa pair < int,int >
#define fi first
#define se second
#define inf 1e18
#define mod 998244353
#define sz(x) (int)((x).size())
#define int ll
#define N 100005
using namespace std;
int n,Q,s[N];
vector<pa>G[N];
double pre[N];
void BellaKira()
{
	cin>>n>>Q;
	for (int i=1;i<=Q;i++)
	{
		int x,l,r;
		cin>>x>>l>>r;
		s[l+1]++,s[r+1]--;
		G[x].push_back(mp(l,r));
	}
	for (int i=1;i<=100000;i++) s[i]+=s[i-1],pre[i]=pre[i-1]+(s[i]==0?0.0:1.0/s[i]);
	for (int i=1;i<=n;i++)
	{
		double ans=0;
		for (auto [l,r]:G[i])
			ans+=pre[r]-pre[l];
		cout<<fixed<<setprecision(10)<<ans<<'\n';
	}
}
signed main()
{
	IOS;
	cin.tie(0);
	int T=1;
	while (T--)
	{
		BellaKira();
	}
}
0