結果

問題 No.2462 七人カノン
ユーザー anago-pieanago-pie
提出日時 2023-09-08 22:16:48
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
TLE  
実行時間 -
コード長 953 bytes
コンパイル時間 1,966 ms
コンパイル使用メモリ 186,268 KB
実行使用メモリ 11,476 KB
最終ジャッジ日時 2023-09-08 22:16:55
合計ジャッジ時間 6,127 ms
ジャッジサーバーID
(参考情報)
judge11 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1 ms
11,476 KB
testcase_01 AC 1 ms
4,380 KB
testcase_02 AC 2 ms
4,380 KB
testcase_03 AC 6 ms
4,380 KB
testcase_04 AC 5 ms
4,380 KB
testcase_05 AC 5 ms
4,376 KB
testcase_06 AC 5 ms
4,376 KB
testcase_07 AC 5 ms
4,376 KB
testcase_08 AC 4 ms
4,380 KB
testcase_09 AC 4 ms
4,376 KB
testcase_10 AC 5 ms
4,376 KB
testcase_11 AC 5 ms
4,376 KB
testcase_12 AC 5 ms
4,376 KB
testcase_13 TLE -
testcase_14 -- -
testcase_15 -- -
testcase_16 -- -
testcase_17 -- -
testcase_18 -- -
testcase_19 -- -
testcase_20 -- -
testcase_21 -- -
testcase_22 -- -
testcase_23 -- -
testcase_24 -- -
testcase_25 -- -
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
#include <iterator>
using namespace std;
#define rep(i, n) for(int i=0; i<n; i++)
#define debug 1
using ll = long long;
using ld = long double;
const int mod = 998244353;
const double pi = atan2(0, -1);
#include <time.h>
#include <chrono>

int main() {
	int N, Q;
	cin >> N >> Q;
	vector<double> ans(N + 1, 0);
	set<int> list;
	map<int, vector<int>> mp;
	unordered_set<int> play;
	int sum = 0;
	int now = 0;
	rep(i, Q) {
		int p, s, t;
		cin >> p >> s >> t;
		list.insert(s);
		list.insert(t);
		mp[s].push_back(p);
		mp[t].push_back(p);
	}
	for (int time : list) {
		if (sum >= 1) {
			for (int x : play) {
				ans[x] += ((double)time - (double)now) / (double)sum;
			}
		}
		now = time;
		for (int x : mp[time]) {
			if (play.count(x)) {
				play.erase(x);
				sum--;
			}
			else {
				play.insert(x);
				sum++;
			}
		}
	}

	for (int i = 1; i <= N; i++) {
		cout << fixed << setprecision(10);
		cout << ans[i] << endl;
	}
}
0