QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#749157 | #7615. Sequence Folding | shstyle# | WA | 1ms | 5952kb | C++23 | 742b | 2024-11-14 22:52:07 | 2024-11-14 22:52:09 |
Judging History
answer
#include<bits/stdc++.h>
using namespace std;
const int N=1919810;
typedef long long ll;
typedef pair<ll,ll> PII;
ll n,m;
ll a[N],b[N];
vector<ll> e[100];
map<ll,int> mp;
int main(){
cin>>n>>m;
for(int i=1;i<=m;i++) scanf("%lld",&a[i]);
vector<ll> v;
for(int i=1;i<=m;i++) v.push_back(a[i]);
sort(v.begin(),v.end());
map<ll,int> mp;
for(auto j:v) mp[j]=1;
ll ans=0;
for(int i=60;i>0;i--){
ll tot=(1ll<<i);
while(v.size()&&v.back()>tot) break;
for(auto j:v){
ll nw=tot+1-j;
if(mp[j]==2) continue;
if(!mp.count(nw)||mp[nw]==2) continue;
ll res=min(j,nw);
mp[res]=2;
ans++;
}
}
cout<<ans<<endl;
}
Details
Tip: Click on the bar to expand more detailed information
Test #1:
score: 0
Wrong Answer
time: 1ms
memory: 5952kb
input:
8 3 1 5 8
output:
1
result:
wrong answer 1st lines differ - expected: '2', found: '1'