QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#325900 | #7615. Sequence Folding | Feet_McYeet | WA | 0ms | 3576kb | C++17 | 1.7kb | 2024-02-12 03:55:52 | 2024-02-12 03:55:53 |
Judging History
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};
pii ot = *pm.lower_bound(temp);
if (i.fi < n) {
if (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.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: 0
Wrong Answer
time: 0ms
memory: 3576kb
input:
8 3 1 5 8
output:
1
result:
wrong answer 1st lines differ - expected: '2', found: '1'