QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#749157#7615. Sequence Foldingshstyle#WA 1ms5952kbC++23742b2024-11-14 22:52:072024-11-14 22:52:09

Judging History

你现在查看的是最新测评结果

  • [2024-11-14 22:52:09]
  • 评测
  • 测评结果:WA
  • 用时:1ms
  • 内存:5952kb
  • [2024-11-14 22:52:07]
  • 提交

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'