QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#767314 | #9541. Expanding Array | aaaxxx | WA | 0ms | 3564kb | C++14 | 4.8kb | 2024-11-20 20:31:46 | 2024-11-20 20:31:50 |
Judging History
answer
#pragma optimize(2) // O(2) --
#include <iostream>
#include <vector>
#include <map>
#include <queue>
#include <set>
#include <string>
#include <string.h>
#include <algorithm>
#include <cmath>
#include <numeric>
#include <functional>
#include <iomanip>
#include <unordered_set>
#include <unordered_map>
#include <type_traits>
#include <ctime>
#include <utility>
#include <chrono>
#include <assert.h>
#include <cctype>
#include <tuple>
#include <any>
#include <cmath>
using namespace std;
using i32 = int;
using i64 = long long;
using u32 = unsigned int;
using u64 = unsigned long long;
using f32 = float;
using f64 = double;
using pii = pair<i32, i32>;
using pll = pair<i64, i64>;
#pragma region
template <typename T>
using Set_U = unordered_set<T>;
template <typename T>
using Set_UM = unordered_multiset<T>;
template <typename T, typename X>
using Map_U = unordered_map<T, X>;
template <typename T, typename X, typename H>
using Map_UH = unordered_map<T, X, H>;
template <typename T, typename X>
using Map_UM = unordered_multimap<T, X>;
const i32 MAXN = 2e5 + 10;
const i32 mod = 998244353;
const i32 inf = numeric_limits<i32>::max();
const i64 INF = numeric_limits<i64>::max();
// reload <<
namespace std {
ostream& operator<<(ostream& os, const pii& p) {
os << p.first << " " << p.second;
return os;
}
ostream& operator<<(ostream& os, const pll& p) {
os << p.first << " " << p.second;
return os;
}
template <typename T>
ostream& operator<<(ostream& os, const vector<T>& v) {
for (auto i : v) {
os << i << " ";
}
os << "\n";
return os;
}
template <typename T>
ostream& operator<<(ostream& os, const set<T>& v) {
for (auto i : v) {
os << i << " ";
}
os << "\n";
return os;
}
template <typename Key, typename Val>
ostream& operator<<(ostream& os, const map<Key, Val>& mp) {
for (auto i : mp) {
os << i.first << " " << i.second << "\n";
}
return os;
}
template<typename T>
istream& operator>>(istream& is, vector<T>& v) {
for (i32 i = 1; i < v.size(); i++) {
is >> v[i];
}
return is;
}
template <typename... T>
void read(T &...args) {
([&args]()
{ cin >> args; }(), ...);
}
template <typename... T>
struct hash_pair {
template <class T1, class T2>
u64 operator()(const pair<T1, T2>& p)const {
auto hash1 = hash<T1>{}(p.first);
auto hash2 = hash<T2>{}(p.second);
return hash1 ^ hash2;
}
};
}
namespace math {
i64 qpow(i64 a, i64 b) {
i64 ans = 1;
while (b) {
if (b & 1) ans = ans * a;
a = a * a;
b >>= 1;
}
return ans;
}
i64 qpow(i64 a, i64 b, i64 mod) {
i64 ans = 1;
while (b) {
if (b & 1) ans = ans * a % mod;
a = a * a % mod;
b >>= 1;
}
return ans;
}
i64 inv(i64 a, i64 mod) {
return qpow(a, mod - 2, mod);
}
vector<i64> inv_n(vector<i64>& a, i64 mod) {
i64 n = a.size();
vector<i64> s(n + 1, 0), sv(n + 1, 0), inv(n + 1, 0);
s[0] = 1;
for (i32 i = 1; i <= n; i++) s[i] = s[i - 1] * a[i - 1] % mod;
sv[n] = qpow(s[n], mod - 2);
for (i32 i = n; i >= 1; i--) sv[i - 1] = sv[i] * a[i] % mod;
for (i32 i = 1; i <= n; i++) inv[i] = sv[i] * s[i - 1] % mod;
return inv;
}
}
typedef long long ll;
void solve() {
ll n; cin >> n;
int a[n + 1];
for (int i = 1; i <= n; i++) {
cin >> a[i];
}
set<int> st;
for (int i = 1; i < n; i++) {
st.insert(a[i] ^ a[i + 1]);
st.insert(a[i] & a[i + 1]);
st.insert(a[i] | a[i + 1]);
st.insert(a[i] & (a[i] ^ a[i + 1]));
st.insert(a[i] | (a[i] ^ a[i + 1]));
st.insert((a[i] ^ a[i + 1]) | a[i + 1]);
st.insert((a[i] ^ a[i + 1]) & a[i + 1]);
}st.insert(0);
cout << st.size();
}
i32 main() {
ios::sync_with_stdio(false);
cin.tie(nullptr);
cout.tie(nullptr);
i32 t, check;
t = check = 1;
void TestArea();
void TimeTest();
//cin >> t;
while (check <= t) {
solve();
check++;
// timeTest();
}
return 0;
}
void TestArea()
{
solve();
}
void TimeTest()
{
auto start = chrono::steady_clock::now();
TestArea();
auto end = chrono::steady_clock::now();
auto duration = chrono::duration_cast<chrono::duration<double>>(end - start).count();
cout << "\ntime cost: " << duration << " /s";
}
詳細信息
Test #1:
score: 100
Accepted
time: 0ms
memory: 3532kb
input:
2 2 3
output:
4
result:
ok single line: '4'
Test #2:
score: 0
Accepted
time: 0ms
memory: 3512kb
input:
2 3 4
output:
4
result:
ok single line: '4'
Test #3:
score: -100
Wrong Answer
time: 0ms
memory: 3564kb
input:
2 3 5
output:
6
result:
wrong answer 1st lines differ - expected: '8', found: '6'