QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#325905 | #7615. Sequence Folding | Feet_McYeet | WA | 12ms | 5112kb | C++17 | 1.8kb | 2024-02-12 04:01:58 | 2024-02-12 04:02:00 |
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);
ll n; int m; cin >> n >> m;
set<pair<ll, short>> pm, npm;
forn(i,m) {
int a; cin >> a;
pm.insert({a-1, 1});
}
int tot = 0;
while ((n = n/2)>0) {
for (pair<ll, short> i : pm) {
pair<ll, short> 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: 3572kb
input:
8 3 1 5 8
output:
2
result:
ok single line: '2'
Test #2:
score: 0
Accepted
time: 1ms
memory: 3796kb
input:
1 1 1
output:
0
result:
ok single line: '0'
Test #3:
score: -100
Wrong Answer
time: 12ms
memory: 5112kb
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:
12528
result:
wrong answer 1st lines differ - expected: '99999', found: '12528'