QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#627380#7615. Sequence Foldingrotcar07WA 30ms5672kbC++20835b2024-10-10 15:44:542024-10-10 15:44:55

Judging History

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

  • [2024-10-10 15:44:55]
  • 评测
  • 测评结果:WA
  • 用时:30ms
  • 内存:5672kb
  • [2024-10-10 15:44:54]
  • 提交

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(int i=0;i<=j;i++){
            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),ans++;
                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';
}

詳細信息

Test #1:

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

input:

8 3
1 5 8

output:

2

result:

ok single line: '2'

Test #2:

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

input:

1 1
1

output:

0

result:

ok single line: '0'

Test #3:

score: -100
Wrong Answer
time: 30ms
memory: 5672kb

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:

100023

result:

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