Submission #3421050
Source Code Expand
#include<cstdio> #include<iostream> #include<cstring> #define RG register #define LL long long using namespace std; const int N=1e5+10; int n,k,a[N],b[N]; LL ans; template<typename I> inline I read(){ char ch=getchar(); I x=0, f=1; while(ch<'0' || ch>'9') {if(ch=='-') f=-1;ch=getchar();} while(ch>='0' && ch<='9') {x=x*10+ch-'0'; ch=getchar();} return x*f;} template<typename I>inline I mx(const I a,const I b){return a>b ? a : b;} int main() { //freopen("IntegerotS.in","r",stdin); n=read(); k=read(); for(RG int i=1;i<=n;i++) { a[i]=read(); b[i]=read(); if((a[i]&k)==a[i]) ans+=b[i]; } for(RG int i=0;i<=30;i++) { if(((1<<i)&k)==0) continue; int tt=(k^(1<<i))|((1<<i)-1); LL re=0; for(RG int i=1;i<=n;i++) if((a[i]&tt)==a[i]) re+=b[i]; ans=mx(ans,re); } printf("%lld\n",ans); return 0; }
Submission Info
Submission Time | |
---|---|
Task | D - IntegerotS |
User | aoweiyin |
Language | C++ (GCC 5.4.1) |
Score | 0 |
Code Size | 849 Byte |
Status | CE |
Compile Error
./Main.cpp: In function ‘int main()’: ./Main.cpp:19:9: error: no matching function for call to ‘read()’ n=read(); k=read(); ^ ./Main.cpp:10:31: note: candidate: template<class I> I read() template<typename I> inline I read(){ ^ ./Main.cpp:10:31: note: template argument deduction/substitution failed: ./Main.cpp:19:9: note: couldn't deduce template parameter ‘I’ n=read(); k=read(); ^ ./Main.cpp:19:19: error: no matching function for call to ‘read()’ n=read(); k=read(); ^ ./Main.cpp:10:31: note: candidate: template<class I> I read() template<typename I> inline I read(){ ^ ./Main.cpp:10:31: note: template argument deduction/substitution failed: ./Main.cpp:19:19: note: couldn't deduce template parameter ‘I’ n=read(); k=read(); ^ ./Main.cpp:22:13: error: no matching function for call to ‘read()’ a[i]=read(); b[i]=read(); ^ ./Main.cpp:10:31: note: candidate: t...