QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#627398#7615. Sequence Foldingrotcar07WA 39ms9448kbC++20943b2024-10-10 15:48:462024-10-10 15:48:46

Judging History

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

  • [2024-10-10 15:48:46]
  • 评测
  • 测评结果:WA
  • 用时:39ms
  • 内存:9448kb
  • [2024-10-10 15:48:46]
  • 提交

answer

#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
int main(){
    ll n;int m;
    cin>>n>>m;
    vector<pair<ll,int>> v(m);
    int ans=0;
    for(auto &x:v) cin>>x.first,x.second=1;
    for(;n>1;n>>=1){
        vector<pair<ll,int>> tmp;
        int j=int(v.size())-1;
        // for(auto x:v) cout<<x.first<<' '<<x.second<<'\n';
        // cout<<'\n';
        for(int i=0;i<=j;){
            auto [a,b]=v[i];auto [c,d]=v[j];
            if(a+c==n+1){
                if(b&&d) tmp.emplace_back(a,1);
                else if(b||d) tmp.emplace_back(a,0);
                i++;j--;
            }
            else if(a+c<=n){
                ans++;tmp.emplace_back(a,0);
                i++;
            }
            else{
                ans++;tmp.emplace_back(n+1-c,0);
                j--;
            }
        }
        swap(tmp,v);
        // cout<<ans<<"\n\n";
    }
    cout<<ans<<'\n';
}

Details

Tip: Click on the bar to expand more detailed information

Test #1:

score: 100
Accepted
time: 0ms
memory: 3596kb

input:

8 3
1 5 8

output:

2

result:

ok single line: '2'

Test #2:

score: 0
Accepted
time: 0ms
memory: 3820kb

input:

1 1
1

output:

0

result:

ok single line: '0'

Test #3:

score: -100
Wrong Answer
time: 39ms
memory: 9448kb

input:

17179869184 100000
138476 774165 993977 1152277 1236393 1244970 1534017 1693701 1763926 1778781 1842066 1874644 1885666 2120429 2485344 2977941 3158255 3340476 3504862 4000117 4066652 4197639 4338723 4389163 4576965 4761601 5097091 5175412 5295902 5810551 5855982 6001770 6111262 6163309 6351547 6582...

output:

1649927

result:

wrong answer 1st lines differ - expected: '99999', found: '1649927'