結果
| 問題 |
No.2462 七人カノン
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2021-06-01 16:01:00 |
| 言語 | C++17(gcc12) (gcc 12.3.0 + boost 1.87.0) |
| 結果 |
CE
(最新)
AC
(最初)
|
| 実行時間 | - |
| コード長 | 2,193 bytes |
| コンパイル時間 | 535 ms |
| コンパイル使用メモリ | 45,544 KB |
| 最終ジャッジ日時 | 2025-01-21 21:01:56 |
|
ジャッジサーバーID (参考情報) |
judge5 / judge1 |
(要ログイン)
コンパイルエラー時のメッセージ・ソースコードは、提出者また管理者しか表示できないようにしております。(リジャッジ後のコンパイルエラーは公開されます)
ただし、clay言語の場合は開発者のデバッグのため、公開されます。
ただし、clay言語の場合は開発者のデバッグのため、公開されます。
コンパイルメッセージ
main.cpp:15:10: fatal error: testlib.h: No such file or directory
15 | #include "testlib.h"
| ^~~~~~~~~~~
compilation terminated.
ソースコード
#include <iostream>
#include <vector>
#include <string>
#include <map>
#include <set>
#include <queue>
#include <algorithm>
#include <cmath>
#include <iomanip>
#include <random>
#include <stdio.h>
#include <fstream>
#include <functional>
#include <cassert>
#include "testlib.h"
using namespace std;
#define rep(i,n,c) for (int i=0;i<n;i+=c)
#define append push_back
#define all(x) (x).begin(), (x).end()
template<class T>
using vec = vector<T>;
template<class T>
using vvec = vec<vec<T>>;
template<class T>
using vvvec = vec<vvec<T>>;
using ll = long long;
using pii = pair<int,int>;
using pll = pair<ll,ll>;
template<class T>
bool chmin(T &a, T b){
if (a>b){
a = b;
return true;
}
return false;
}
template<class T>
bool chmax(T &a, T b){
if (a<b){
a = b;
return true;
}
return false;
}
template<class T>
T sum(vec<T> x){
T res=0;
for (auto e:x){
res += e;
}
return res;
}
template<class T>
void printv(vec<T> x){
for (auto e:x){
cout<<e<<" ";
}
cout<<"\n";
}
int cnt[100001];
long double standout[100001];
int main(int argc, char* argv[]){
registerValidation(argc,argv);
ios::sync_with_stdio(false);
std::cin.tie(nullptr);
cout<<setprecision(10);
int N,Q;
int I,S,T;
N = inf.readInt(1,100000);
inf.readSpace();
Q = inf.readInt(1,100000);
inf.readEoln();
vec<vec<pii>> play(N,vec<pii>(0));
for (int i=0;i<Q;i++){
I = inf.readInt(1,N);
inf.readSpace();
S = inf.readInt(0,100000);
inf.readSpace();
T = inf.readInt(S+1,100000);
inf.readEoln();
I -= 1;
cnt[S] += 1;
cnt[T] -= 1;
play[I].append({S,T});
}
inf.readEof();
for (int t=1;t<100001;t++){
cnt[t] += cnt[t-1];
}
for (int t=0;t<100001;t++){
if (cnt[t]>0){
long double k = cnt[t];
standout[t] = (long double)(1/k);
}
if (t>0){
standout[t] += standout[t-1];
}
}
long double res;
int pre = -1;
for (int i=0;i<N;i++){
res = 0;
sort(all(play[i]));
pre = -1;
for (auto[s,t]:play[i]){
res += standout[t-1];
assert (pre < s);
if (s>0){
res -= standout[s-1];
}
pre = t;
}
cout<<res<<"\n";
}
}