QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#561641 | #9241. Sphinx | Wawi | 0 | 1ms | 3852kb | C++17 | 2.7kb | 2024-09-13 03:23:08 | 2024-09-13 03:23:09 |
answer
#include "sphinx.h"
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
/*
*/
// int perform_experiment(vector<int> e){
// return e.size();
// }
vector<int> find_colours(int n, vector<int> x, vector<int> y){
vector<int> ans(n);
vector<int> e, reset(n, -1);
int sz = 1;
while(sz < n) sz*=2;
for(int i = 0; i < n;i++){
for(int cond = 0; cond < 2;cond++){
e = reset;
for(int j = 0; j < n;j++){
if(j%2==cond) e[j] = i;
}
int x = perform_experiment(e);
if(x == n) continue;
queue<array<int,6>> q;
q.push({0, sz/2 - 1, sz/2, x, n, 0});
while(q.size()){
auto [l,r,v, previous_x, previous_size, tttt] = q.front();
q.pop();
e = reset;
int curr = l;
int tt = min(r, n - 1);
for(int j = l; j <= tt;j++){
if(j%2 == cond) e[j] = i;
}
for(int j = 0; j < l;j++) e[j] = n;
for(int j = tt + 1; j < n;j++) e[j] = n;
x = perform_experiment(e);
int crs = v/2;
int add = 2 - (l == 0) - (tt == n-1);
int current_size = tt - l + 1, current_x = x - add;
if(tttt == 1 && current_size == current_x) continue;
if(current_size == 2 && current_x == 1){
ans[l + cond] = i;
continue;
}
// if it doesn't contain all of the prev ones then we don't have to put in the other segment
if(current_size - current_x == previous_size - previous_x){
q.push({l, l + crs - 1, crs, current_x, current_size, 0});
}
// if the current x is equal to the size + 1 then the other segment contains everything!
else if(current_x == current_size){
q.push({r + 1, r + v, v, previous_x, previous_size, 1});
}
// check if the current x contains all of the previous ones, if so then we don't have to put in the other segment (only condition remaining)
else{
q.push({l, l + crs - 1, crs, current_x, current_size, 0});
q.push({r + 1, r + v, v, previous_x, previous_size, 1});
}
}
}
}
return ans;
}
// void solve(){
// }
// int main(){
// ios::sync_with_stdio(false);
// cin.tie(0);
// cout.tie(0);
// int t=1;
// cin >> t;
// while(t--) solve();
// return 0;
// }
Details
Tip: Click on the bar to expand more detailed information
Subtask #1:
score: 0
Wrong Answer
Test #1:
score: 3
Accepted
time: 1ms
memory: 3852kb
input:
1978433568 2 1 0 1 1978433568 1 1978433568 2 1978433568 2 1978433568 1 1978433568 2 1978433568 2 1978433568 2 1978433568 2
output:
877694080 0 -1 877694080 0 2 877694080 2 -1 877694080 -1 0 877694080 -1 2 877694080 2 0 877694080 1 -1 877694080 -1 1 877694081 0 0
result:
ok #experiments: 8
Test #2:
score: 0
Wrong Answer
time: 0ms
memory: 3796kb
input:
1978433568 2 1 0 1 1978433568 2 1978433568 1 1978433568 2 1978433568 2 1978433568 1 1978433568 2 1978433568 2 1978433568 2
output:
877694080 0 -1 877694080 -1 0 877694080 -1 2 877694080 2 0 877694080 1 -1 877694080 1 2 877694080 2 -1 877694080 -1 1 877694081 0 0
result:
wrong answer Vertices 0 and 1 do not have the same color, but they do in returned answer
Subtask #2:
score: 0
Skipped
Dependency #1:
0%
Subtask #3:
score: 0
Runtime Error
Test #34:
score: 0
Runtime Error
input:
1978433568 250 249 0 1 1 2 2 3 3 4 4 5 5 6 6 7 7 8 8 9 9 10 10 11 11 12 12 13 13 14 14 15 15 16 16 17 17 18 18 19 19 20 20 21 21 22 22 23 23 24 24 25 25 26 26 27 27 28 28 29 29 30 30 31 31 32 32 33 33 34 34 35 35 36 36 37 37 38 38 39 39 40 40 41 41 42 42 43 43 44 44 45 45 46 46 47 47 48 48 49 49 50 ...
output:
877694080 0 -1 0 -1 0 -1 0 -1 0 -1 0 -1 0 -1 0 -1 0 -1 0 -1 0 -1 0 -1 0 -1 0 -1 0 -1 0 -1 0 -1 0 -1 0 -1 0 -1 0 -1 0 -1 0 -1 0 -1 0 -1 0 -1 0 -1 0 -1 0 -1 0 -1 0 -1 0 -1 0 -1 0 -1 0 -1 0 -1 0 -1 0 -1 0 -1 0 -1 0 -1 0 -1 0 -1 0 -1 0 -1 0 -1 0 -1 0 -1 0 -1 0 -1 0 -1 0 -1 0 -1 0 -1 0 -1 0 -1 0 -1 0 -1 ...
result:
Subtask #4:
score: 0
Runtime Error
Test #43:
score: 0
Runtime Error
input:
1978433568 250 31125 0 1 0 2 0 3 0 4 0 5 0 6 0 7 0 8 0 9 0 10 0 11 0 12 0 13 0 14 0 15 0 16 0 17 0 18 0 19 0 20 0 21 0 22 0 23 0 24 0 25 0 26 0 27 0 28 0 29 0 30 0 31 0 32 0 33 0 34 0 35 0 36 0 37 0 38 0 39 0 40 0 41 0 42 0 43 0 44 0 45 0 46 0 47 0 48 0 49 0 50 0 51 0 52 0 53 0 54 0 55 0 56 0 57 0 5...
output:
877694080 0 -1 0 -1 0 -1 0 -1 0 -1 0 -1 0 -1 0 -1 0 -1 0 -1 0 -1 0 -1 0 -1 0 -1 0 -1 0 -1 0 -1 0 -1 0 -1 0 -1 0 -1 0 -1 0 -1 0 -1 0 -1 0 -1 0 -1 0 -1 0 -1 0 -1 0 -1 0 -1 0 -1 0 -1 0 -1 0 -1 0 -1 0 -1 0 -1 0 -1 0 -1 0 -1 0 -1 0 -1 0 -1 0 -1 0 -1 0 -1 0 -1 0 -1 0 -1 0 -1 0 -1 0 -1 0 -1 0 -1 0 -1 0 -1 ...
result:
Subtask #5:
score: 0
Skipped
Dependency #1:
0%