結果
問題 | No.2462 七人カノン |
ユーザー |
![]() |
提出日時 | 2023-09-08 21:29:39 |
言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 104 ms / 2,000 ms |
コード長 | 1,027 bytes |
コンパイル時間 | 1,751 ms |
コンパイル使用メモリ | 170,828 KB |
実行使用メモリ | 10,816 KB |
最終ジャッジ日時 | 2024-06-26 14:19:41 |
合計ジャッジ時間 | 9,026 ms |
ジャッジサーバーID (参考情報) |
judge2 / judge5 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 23 |
コンパイルメッセージ
main.cpp: In function 'void BellaKira()': main.cpp:41:27: warning: structured bindings only available with '-std=c++17' or '-std=gnu++17' [-Wc++17-extensions] 41 | for (auto [l,r]:G[i]) | ^
ソースコード
// 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(); } }