QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#755307 | #9541. Expanding Array | zhisheng | WA | 1ms | 3568kb | C++23 | 1.9kb | 2024-11-16 17:00:13 | 2024-11-16 17:00:15 |
Judging History
answer
#include <bits/stdc++.h>
using namespace std;
#define int long long
mt19937_64 rng(random_device{}());
int random(int l,int r) {
return rng()%(r - l + 1) + l;
}
signed main() {
ios::sync_with_stdio(0),cin.tie(0);
auto solve = [&]() {
int n;
cin >> n;
vector <vector <int>> v(n + 1);
vector <int> a(n + 1);
unordered_set <int> st;
for(int i=1;i<=n;i++) {
cin >> a[i];
}
for(int i=1;i<n;i++) {
v[i].push_back(a[i]);
v[i].push_back(a[i+1]);
}
for(int i=1;i<n;i++) {
unordered_map<int,int> mp;
for(auto x : v[i]) {
mp[x] ++ ;
}
for(int j=1;j<=2000;j++) {
int p = random(0,v[i].size()-2);
int op = random(1,3);
if(op==1) {
int val = (v[i][p]&v[i][p+1]);
if(!mp.count(val)) {
v[i].insert(v[i].begin() + p,val);
mp[val] ++ ;
}
}
else if(op==2) {
int val = (v[i][p]|v[i][p+1]);
if(!mp.count(val)) {
v[i].insert(v[i].begin() + p,val);
mp[val] ++ ;
}
}
else {
int val = (v[i][p]^v[i][p+1]);
if(!mp.count(val)) {
v[i].insert(v[i].begin() + p,val);
mp[val] ++ ;
}
}
}
}
for(int i=1;i<=n;i++) {
for(auto x : v[i]) {
// cout << x << " ";
st.insert(x);
}
}
cout << st.size() << "\n";
};
int t=1;
// cin >> t;
while(t--) {
solve();
}
return 0;
}
Details
Tip: Click on the bar to expand more detailed information
Test #1:
score: 100
Accepted
time: 0ms
memory: 3568kb
input:
2 2 3
output:
4
result:
ok single line: '4'
Test #2:
score: 0
Accepted
time: 0ms
memory: 3500kb
input:
2 3 4
output:
4
result:
ok single line: '4'
Test #3:
score: 0
Accepted
time: 0ms
memory: 3560kb
input:
2 3 5
output:
8
result:
ok single line: '8'
Test #4:
score: -100
Wrong Answer
time: 1ms
memory: 3560kb
input:
10 37760128 12721860 37519778 33518004 2760086 4473592 65451644 83416788 44877547 36766460
output:
54
result:
wrong answer 1st lines differ - expected: '56', found: '54'