QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#325903#7615. Sequence FoldingFeet_McYeetWA 1ms3812kbC++171.8kb2024-02-12 03:59:452024-02-12 03:59:46

Judging History

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

  • [2024-02-12 03:59:46]
  • 评测
  • 测评结果:WA
  • 用时:1ms
  • 内存:3812kb
  • [2024-02-12 03:59:45]
  • 提交

answer

#include <algorithm>
#include <array>
#include <vector>
#include <utility>
#include <iostream>
#include <cassert>
#include <set>
#include <random>
#include <climits>
#include <map>
#include <queue>
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<long long, long long> pll;
#define forn(i,n) for (int i = 0; i<n; i++)
#define forl(i,l,h) for (int i = l; i<h; i++)
#define el << '\n'
#define nl cout << '\n'
#define spc << ' '
#define pb push_back
#define all(x) x.begin(), x.end()
#define sz(x) (int) x.size()
#define fi first
#define se second
#define rsz resize
const int inf = 1000000000;
const ll inf2 = 2000000000000000000;

int main() {
    cin.tie(NULL); ios_base::sync_with_stdio(false);
    int n, m; cin >> n >> m;
    set<pii> pm, npm;
    forn(i,m) {
        int a; cin >> a;
        pm.insert({a-1, 1});
    }
    int tot = 0;
    while ((n = n/2)>0) {
        for (pii i : pm) {
            pii temp = {2*n-1 - i.fi, 0};
            auto ot = pm.lower_bound(temp);
            if (i.fi < n) {
                if (ot != pm.end() && (*ot).fi == temp.fi) {
                    if ((*ot).se == i.se) npm.insert(i);
                    else npm.insert({i.fi, 1});
                }
                else {
                    if (i.se==1) {
                        npm.insert({i.fi, 2});
                        tot++;
                    }
                }
            }
            else {
                if (ot != pm.end() && (*ot).fi != temp.fi) {
                    if (i.se==1) {
                        npm.insert({temp.fi, 2});
                        tot++;
                    }
                }
            }
        }
        swap(pm, npm);
        npm.clear();
    }
    cout << tot << endl;
}

Details

Tip: Click on the bar to expand more detailed information

Test #1:

score: 100
Accepted
time: 1ms
memory: 3524kb

input:

8 3
1 5 8

output:

2

result:

ok single line: '2'

Test #2:

score: 0
Accepted
time: 1ms
memory: 3812kb

input:

1 1
1

output:

0

result:

ok single line: '0'

Test #3:

score: -100
Wrong Answer
time: 1ms
memory: 3556kb

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:

1

result:

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