QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#640431 | #1086. Bank Security Unification | Cure_Beauty | RE | 1ms | 5696kb | C++14 | 1.0kb | 2024-10-14 12:26:34 | 2024-10-14 12:26:36 |
Judging History
answer
#include<iostream>
#include<cstdio>
#include<algorithm>
using std::cin;using std::cout;
constexpr int N=1000006,V=522;
int n,k;
long long a[N],f[N];
namespace sub1_9{
signed main(){
for(int i=2;i<=n;++i)
for(int j=1;j<i;++j)
f[i]=std::max(f[i],f[j]+(a[j]&a[i]));
cout<<*std::max_element(f+1,f+n+1);
return 0;
}
}
namespace sub10_13{
long long b[V];
signed main(){
for(int i=0;i<512;++i) b[i]=-1e18;
b[a[1]]=0;
for(int i=2;i<=n;++i){
for(int j=0;j<512;++j) f[i]=std::max(f[i],b[j]+(j&a[i]));
if(f[i]>b[a[i]]) b[a[i]]=f[i];
}
cout<<*std::max_element(f+1,f+n+1);
return 0;
}
}
signed main(){
// freopen("rose.in","r",stdin);
// freopen("rose.out","w",stdout);
std::ios::sync_with_stdio(false);
cin.tie(nullptr);cout.tie(nullptr);
cin>>n;for(int i=1;i<=n;++i) cin>>a[i];k=*std::max_element(a+1,a+n+1);
if(n<=5000) return sub1_9::main();
if(k<512) return sub10_13::main();
return sub10_13::main();cout<<"芙羽心音";
}//第一百三回 施毒计金桂自焚身 昧真禅雨村空遇旧
Details
Tip: Click on the bar to expand more detailed information
Test #1:
score: 100
Accepted
time: 1ms
memory: 5672kb
input:
5 1 2 3 1 3
output:
5
result:
ok answer is '5'
Test #2:
score: 0
Accepted
time: 1ms
memory: 5612kb
input:
4 1 2 4 0
output:
0
result:
ok answer is '0'
Test #3:
score: 0
Accepted
time: 1ms
memory: 5696kb
input:
2 1000000000000 1000000000000
output:
1000000000000
result:
ok answer is '1000000000000'
Test #4:
score: 0
Accepted
time: 1ms
memory: 5588kb
input:
100 42357619991 34637578715 14383875856 65298594968 204835436802 17842451301 27263566591 56672847581 9938910048 37783918480 178688553850 31652616803 34569713543 278151742734 458183081930 36307485267 52046737444 29733829337 156411959819 70476873663 322768771475 306850928242 68922415915 108092954267 1...
output:
4105724254392
result:
ok answer is '4105724254392'
Test #5:
score: 0
Accepted
time: 0ms
memory: 5592kb
input:
200 32491481529 22326116709 38413035282 6379551923 17186666096 710945826 99671547638 21583864468 43358433566 110817310097 58936170734 12118139703 99298292577 7807334015 283126465825 29798702686 966557737 78175604253 84922374374 66149759365 4499380469 17953982120 22738453560 35389367375 71164988711 1...
output:
4385401630265
result:
ok answer is '4385401630265'
Test #6:
score: 0
Accepted
time: 1ms
memory: 5592kb
input:
300 0 0 0 7227130 0 44665356632 741540074 3252 1053109 0 0 3343976697 299282315 7 57190829 0 4379965174 17883634737 17400873810 3693 134 144164936555 320312270 0 0 423566 549 0 1979 0 0 0 2462345997 1021629061 483112 0 172597 11 0 0 0 0 3189174969 64832 14166776345 69159 0 0 56330326146 0 1206275174...
output:
2110095119925
result:
ok answer is '2110095119925'
Test #7:
score: -100
Runtime Error
input:
1000000 380994485120 380994485121 380994485122 380994485123 380994485124 380994485125 380994485126 380994485127 380994485128 380994485129 380994485130 380994485131 380994485132 380994485133 380994485134 380994485135 380994485136 380994485137 380994485138 380994485139 380994485140 380994485141 380994...