結果
問題 | No.945 YKC饅頭 |
ユーザー | hotman78 |
提出日時 | 2019-12-08 12:16:35 |
言語 | C++14 (gcc 12.3.0 + boost 1.83.0) |
結果 |
CE
(最新)
AC
(最初)
|
実行時間 | - |
コード長 | 12,491 bytes |
コンパイル時間 | 2,253 ms |
コンパイル使用メモリ | 199,300 KB |
最終ジャッジ日時 | 2024-04-27 03:01:09 |
合計ジャッジ時間 | 3,030 ms |
ジャッジサーバーID (参考情報) |
judge3 / judge5 |
(要ログイン)
コンパイルエラー時のメッセージ・ソースコードは、提出者また管理者しか表示できないようにしております。(リジャッジ後のコンパイルエラーは公開されます)
ただし、clay言語の場合は開発者のデバッグのため、公開されます。
ただし、clay言語の場合は開発者のデバッグのため、公開されます。
コンパイルメッセージ
main.cpp:87:9: error: non-local lambda expression cannot have a capture-default 87 | auto Y=[&](auto f){return[&](auto... args){return f(f, args...);};}; | ^ main.cpp:93:19: warning: use of 'auto' in parameter declaration only available with '-std=c++20' or '-fconcepts' 93 | inline bool chmin(auto& s,const auto& t){bool res=s>t;s=min(s,t);return res;} | ^~~~ main.cpp:93:33: warning: use of 'auto' in parameter declaration only available with '-std=c++20' or '-fconcepts' 93 | inline bool chmin(auto& s,const auto& t){bool res=s>t;s=min(s,t);return res;} | ^~~~ main.cpp:94:19: warning: use of 'auto' in parameter declaration only available with '-std=c++20' or '-fconcepts' 94 | inline bool chmax(auto& s,const auto& t){bool res=s<t;s=max(s,t);return res;} | ^~~~ main.cpp:94:33: warning: use of 'auto' in parameter declaration only available with '-std=c++20' or '-fconcepts' 94 | inline bool chmax(auto& s,const auto& t){bool res=s<t;s=max(s,t);return res;} | ^~~~ main.cpp:159:17: warning: use of 'auto' in parameter declaration only available with '-std=c++20' or '-fconcepts' 159 | auto update(auto a,auto b){return b==ee?a:b;} | ^~~~ main.cpp:159:24: warning: use of 'auto' in parameter declaration only available with '-std=c++20' or '-fconcepts' 159 | auto update(auto a,auto b){return b==ee?a:b;} | ^~~~ main.cpp:239:17: warning: use of 'auto' in parameter declaration only available with '-std=c++20' or '-fconcepts' 239 | auto update(auto a,auto b){return b==ee?a:b;} | ^~~~ main.cpp:239:24: warning: use of 'auto' in parameter declaration only available with '-std=c++20' or '-fconcepts' 239 | auto update(auto a,auto b){return b==ee?a:b;} | ^~~~
ソースコード
#pragma GCC optimize("Ofast") #pragma GCC target ("avx") #include<bits/stdc++.h> using namespace::std; //struct __INIT{__INIT(){cin.tie(0);ios::sync_with_stdio(false);cout<<fixed<<setprecision(15);}} __init; __attribute__((constructor)) void init(){ cin.tie(0); ios::sync_with_stdio(false); cout<<fixed<<setprecision(15); } // random_device rd; // mt19937 mt(rd()); // #include <boost/numeric/interval.hpp> // #include <boost/numeric/interval/io.hpp> // #include <boost/intrusive/rbtree.hpp> // #include <boost/dynamic_bitset.hpp> // #include <boost/geometry.hpp> // #include <boost/geometry/geometries/linestring.hpp> // #include <boost/geometry/geometries/polygon.hpp> // #include <boost/geometry/geometries/point_xy.hpp> // #include <boost/math/tools/minima.hpp> // using boost::math::tools::brent_find_minima; // #include <boost/multiprecision/cpp_dec_float.hpp> // #include <boost/multiprecision/cpp_int.hpp> // namespace mp = boost::multiprecision; // typedef mp::number<mp::cpp_dec_float<256>> cdouble; // typedef mp::cpp_int cint; // #include <boost/unordered_map.hpp> #include<ext/pb_ds/assoc_container.hpp> #include<ext/pb_ds/tree_policy.hpp> #include <ext/pb_ds/priority_queue.hpp> #include<ext/pb_ds/tag_and_trait.hpp> template<typename T=long long>using pbds=__gnu_pbds::tree<T,__gnu_pbds::null_type,less<T>,__gnu_pbds::rb_tree_tag,__gnu_pbds::tree_order_statistics_node_update>; template<typename T=long long>using pbds_map=__gnu_pbds::tree<T,T,less<T>,__gnu_pbds::rb_tree_tag,__gnu_pbds::tree_order_statistics_node_update>; template<typename T=long long>using pqueue =__gnu_pbds::priority_queue<T, less<T>,__gnu_pbds::rc_binomial_heap_tag>; typedef long long lint; typedef long long ll; typedef long double ldouble; typedef vector<lint> vec; typedef vector<vector<lint>> mat; typedef vector<vector<vector<lint>>> mat3; typedef vector<double> dvec; typedef vector<vector<double>> dmat; typedef vector<vector<vector<double>>> dmat3; typedef vector<string> svec; typedef vector<vector<string>> smat; typedef vector<vector<vector<string>>> smat3; template<typename T>using Vec=vector<T>; template<typename T>using Mat=vector<vector<T>>; template<typename T>using Mat3=vector<vector<vector<T>>>; template<typename T>using Mat4=vector<vector<vector<vector<T>>>>; template<typename S,typename T>using pvec=vector<pair<S,T>>; template<typename S,typename T>using pmat=vector<vector<pair<S,T>>>; template<typename S,typename T>using pmat3=vector<vector<vector<pair<S,T>>>>; template<typename S,typename T>using pmat4=vector<vector<vector<vector<pair<S,T>>>>>; template<typename... T>using tvec=vector<tuple<T...>>; template<typename... T>using tmat=vector<vector<tuple<T...>>>; template<typename... T>using tmat3=vector<vector<vector<tuple<T...>>>>; template<typename... T>using tmat4=vector<vector<vector<vector<tuple<T...>>>>>; #define rep(i, n) for(lint i = 0; i < (lint)(n); i++) #define irep(i) for(lint i = 0;; i++) #define irep1(i) for(lint i = 1;; i++) #define irep2(i) for(lint i = 2;; i++) #define rrep(i, n) for(lint i = (lint)(n-1); i >-1; i--) #define rrepi(i,a,b) for(lint i = (lint)(b-1); i >a-1; i--) #define repi(i,a,b) for(lint i=lint(a);i<lint(b);i++) #define rep2(i,a,b,c) for(lint i=lint(a);i>lint(b);i+=c) #define all(x) (x).begin(),(x).end() #define PI 3.141592653589793 #define dist(x1,y1,x2,y2) (pow(pow(x2-x1,2)+pow(y2-y1,2),0.5)) //#define input(a,n) lint n;cin>>n;vector<lint>a(n);rep(i,n)cin>>a[i]; #define SUM(v) accumulate(all(v),0LL) #define INF (1LL<<60) #define IINF (1<<30) #define EPS (1e-10) #define LINF 9223372036854775807 //#define MOD 998244353LL #define MOD 1000000007LL #define endl "\n" template<typename T>inline void numout(T t){bool f=0;for(auto i:t){cout<<(f?" ":"")<<i<INF/2?i:"INF";f=1;}cout<<endl;} template<typename T>inline void numout2(T t){for(auto i:t)numout(i);} template<typename T>inline void output(T t){bool f=0;for(auto i:t){cout<<(f?" ":"")<<i;f=1;}cout<<endl;} template<typename T>inline void output2(T t){for(auto i:t)output(i);} template<typename T>inline void _output(T t){bool f=0;for(int i=0;i<t.size();i++){cout<<f?"":" "<<t[i];f=1;}cout<<endl;} template<typename T>inline void _output2(T t){for(int i=0;i<t.size();i++)output(t[i]);} auto Y=[&](auto f){return[&](auto... args){return f(f, args...);};}; template<typename T=lint>T in(){return *istream_iterator<T>(cin);} template<typename T=lint>inline T gcd(T a,T b){return b?gcd(b,a%b):a;} template<typename T=lint>inline T lcm(T a,T b){return a/gcd(a,b)*b;} template<typename T>inline T minq(T a,T b){return min(a,b);} template<typename T>inline T maxq(T a,T b){return max(a,b);} inline bool chmin(auto& s,const auto& t){bool res=s>t;s=min(s,t);return res;} inline bool chmax(auto& s,const auto& t){bool res=s<t;s=max(s,t);return res;} const vector<lint> dx={-1,1,0,0,1,1,-1,-1}; const vector<lint> dy={0,0,-1,1,1,-1,1,-1}; template<typename T,typename E>class LSEG{ lint n=1; vector<T> node; vector<E> lazy; T et; E ee; public: LSEG(int size,T et,E ee):et(et),ee(ee){ while(n<size)n<<=1; node.resize(2*n-1,et); lazy.resize(2*n-1,ee); } inline void update(int a,int b,const E& x){ update(a,b,x,0,0,n); } inline T get(const int& a,const int& b){ return get(a,b,0,0,n); } private: inline void eval(const int& k,const int& len){ if(lazy[k]==ee) return; if(k*2+1<n*2-1){ lazy[k*2+1]=g(lazy[k*2+1],lazy[k]); lazy[k*2+2]=g(lazy[k*2+2],lazy[k]); } node[k]=h(node[k],lazy[k],len); lazy[k]=ee; } //0-indexed [a,b) T update(const int& a,const int& b,const E& x,const int& k,const int& l,const int& r){ eval(k,r-l); //区間外 if(r<=a||b<=l)return node[k]; //全部区間内 if(a<=l&&r<=b){ lazy[k]=g(lazy[k],x); return h(node[k],lazy[k],r-l); } //一部区間内 return node[k]=f(update(a,b,x,2*k+1,l,(l+r)/2),update(a,b,x,2*k+2,(l+r)/2,r)); } //0-indexed [a,b) T get(const int& a,const int& b,const int& k,const int& l,const int& r){ eval(k,r-l); //区間外 if(r<=a||b<=l)return et; //全部区間内 if(a<=l&&r<=b)return node[k]; //一部区間内 return f(get(a,b,2*k+1,l,(l+r)/2),get(a,b,2*k+2,(l+r)/2,r)); } T f(T a,T b){ return a+b; } T h(T a,E b,lint len){ return update(a,b); } E g(E a,E b){ return update(a,b); } auto update(auto a,auto b){return b==ee?a:b;} }; template<typename T=long long,typename E=T> struct segment{ private: T et; E ee; lint n; lint size; struct node{ T val; E lazy; node *lch,*rch; node(segment &seg):lch(nullptr),rch(nullptr){val=seg.et;lazy=seg.ee;} }; node* root; public: segment(int size,T et,E ee):et(et),ee(ee),n(1),size(size){ while(n<size)n<<=1; root=new node(*this); } segment(T et,E ee):et(et),ee(ee),n((1LL<<61)-1),size(1LL<<60){ root=new node(*this); } inline void update(const int& a,const int& b,const E& x){ update(a,b,x,0,0,n,root); } inline T get(const int& a,const int& b){ return get(a,b,0,0,n,root); } private: //0-indexed [a,b) T update(const int& a,const int& b,const E& x,const int& k,const int& l,const int& r,node* t){ eval(t,r-l,k); //区間外 if(r<=a||b<=l)return t->val; //全部区間内 if(a<=l&&r<=b){ t->lazy=g(t->lazy,x); eval(t,r-l,k); return h(t->val,t->lazy,r-l); } //一部区間内 if(!t->lch)t->lch=new node(*this); if(!t->rch)t->rch=new node(*this); return t->val=f(update(a,b,x,2*k+1,l,(l+r)/2,t->lch),update(a,b,x,2*k+2,(l+r)/2,r,t->rch)); } //0-indexed [a,b) T get(const int& a,const int& b,const int& k,const int& l,const int& r,node* t){ eval(t,r-l,k); //区間外 if(r<=a||b<=l)return et; //全部区間内 if(a<=l&&r<=b)return t->val; //一部区間内 if(!t->lch)t->lch=new node(*this); if(!t->rch)t->rch=new node(*this); return f(get(a,b,2*k+1,l,(l+r)/2,t->lch),get(a,b,2*k+2,(l+r)/2,r,t->rch)); } inline void eval(node* t,const int& len,const int& k){ if(t->lazy==ee) return; if(k*2+1<n*2-1){ if(t->lch==nullptr)t->lch=new node(*this); if(t->rch==nullptr)t->rch=new node(*this); t->lch->lazy=g(t->lch->lazy,t->lazy); t->rch->lazy=g(t->rch->lazy,t->lazy); } t->val=h(t->val,t->lazy,len); t->lazy=ee; } T f(T a,T b){ return a; } T h(T a,E b,lint len){ return update(a,b); } E g(E a,E b){ return update(a,b); } auto update(auto a,auto b){return b==ee?a:b;} }; template<typename T> class dual_segment{ struct node; using np=node*; using lint=long long; struct node{ T val; np ch[2]={nullptr,nullptr}; node(T val):val(val){} }; np root=nullptr; lint n=1,sz; T e; function<T(T,T)>f; public: dual_segment(lint sz,T e,function<T(T,T)>f):sz(sz),e(e),f(f){while(n<sz)n<<=1;} inline void set(lint l,lint r,T x){set(l,r,x,-n,n,root);} inline T get(lint x){return get(x,-n,n,root);} private: void eval(np& t){ if(t->val==e)return; if(!t->ch[0])t->ch[0]=new node(e); if(!t->ch[1])t->ch[1]=new node(e); t->ch[0]->val=f(t->ch[0]->val,t->val); t->ch[1]->val=f(t->ch[1]->val,t->val); t->val=e; } void set(lint a,lint b,T x,lint l,lint r,np& t){ if(!t)t=new node(e); if(r-l>1)eval(t); if(r<=a||b<=l)return; else if(a<=l&&r<=b)t->val=f(t->val,x); else if(r-l>1){ set(a,b,x,l,(l+r)/2,t->ch[0]); set(a,b,x,(l+r)/2,r,t->ch[1]); } } T get(lint x,lint l,lint r,np& t){ if(!t)t=new node(e); if(r-l>1)eval(t); if(x<l||r<=x)return e; else if(r-l==1){ return t->val; } else return f(get(x,l,(l+r)/2,t->ch[0]),get(x,(l+r)/2,r,t->ch[1])); } }; int main(){ lint n,m; cin>>n>>m; dual_segment<lint> seg(n,0,[](auto a,auto b){ return b==0?a:b; }); vec s(m),t(m); vec u(m); rep(i,m){ string x; cin>>s[i]>>t[i]>>x; if(x=="Y")u[i]=1; if(x=="K")u[i]=2; if(x=="C")u[i]=3; s[i]--; } reverse(all(s)); reverse(all(t)); reverse(all(u)); rep(i,m){ seg.set(s[i],t[i],u[i]); } lint y=0,c=0,k=0; rep(i,n){ if(seg.get(i)==1)y++; if(seg.get(i)==2)k++; if(seg.get(i)==3)c++; } cout<<y<<" "<<k<<" "<<c<<endl; } // int main(){ // int n; // string s; // cin>>n>>s; // auto seg=make_segment<pair<lint,lint>,lint>(n,make_pair(0LL,0LL),0LL, // [](const auto& a,const auto& b){ // return make_pair(max(a.first,b.first),min(a.second,b.second)); // }, // [](const auto& a,const auto& b){ // return a+b; // }, // [](const auto& a,const auto& b,const int& len){ // return make_pair(a.first+b,a.second+b); // }); // int cu=0; // map<int,char>c; // int judge=0; // rep(i,s.size()){ // if(s[i]=='L'){if(cu)cu--;} // else if(s[i]=='R')cu++; // else{ // if(c[cu]=='('){ // seg.update(cu,n,-1); // judge--; // } // if(c[cu]==')'){ // seg.update(cu,n,1); // judge++; // } // if(s[i]=='('){ // seg.update(cu,n,1); // judge++; // } // else if(s[i]==')'){ // seg.update(cu,n,-1); // judge--; // } // else seg.update(cu,n,0); // c[cu]=s[i]; // } // if(i)cout<<" "; // if(judge!=0||seg.get(0,n).second<0){ // cout<<-1; // }else{ // cout<<seg.get(0,n).first; // } // } // cout<<endl; // }