# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
581799 |
2022-06-23T06:33:22 Z |
MrDeboo |
Library (JOI18_library) |
C++17 |
|
74 ms |
312 KB |
#include <cstdio>
#include <vector>
#include <bits/stdc++.h>
#include "library.h"
using namespace std;
vector<pair<int,int>>vec;
int N,L,R,n;
int Slv(){
int g=0;
for(auto &i:vec){
if(i.first>=L&&i.second<=R)g++;
}
return g;
}
int Range(int l,int r){
vector<int>v(n);
for(int w=l;w<=r;w++)v[w]=1;
L=l;
R=r;
int k=Query(v)+Slv();
return k;
}
void Solve(int GGGG){
n=GGGG;
vector<int>vct[n];
N=exp2(ceil(log2(n)));
for(int i=0;i<n;i++){
while(1){
int l=i+1,r=n-1,mid,f=0;
while(l<=r){
mid=(l+r)/2;
if(Range(i,mid)<mid-i+1){
r=mid-1;
f=mid;
}else l=mid+1;
}
if(f==0)break;
l=i;r=f-1;
int g=0;
while(l<=r){
mid=(l+r)/2;
if(Range(mid,f)<f-mid+1){
l=mid+1;
g=mid;
}else r=mid-1;
}
vec.push_back({g,f});
vct[g].push_back(f);
vct[f].push_back(g);
}
}
vector<int>res;
deque<int>dq;
for(int i=0;i<n&&dq.empty();i++){
if(vct[i].size()==1)dq.push_back(i);
}
vector<bool>bl(n);
while(dq.size()){
int a=dq.front();
dq.pop_front();
if(bl[a])continue;
bl[a]=1;
res.push_back(a+1);
for(auto &i:vct[a])dq.push_back(i);
}
Answer(res);
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
59 ms |
208 KB |
# of queries: 4077 |
2 |
Correct |
64 ms |
312 KB |
# of queries: 4057 |
3 |
Correct |
64 ms |
208 KB |
# of queries: 4282 |
4 |
Correct |
59 ms |
304 KB |
# of queries: 4268 |
5 |
Correct |
69 ms |
300 KB |
# of queries: 4283 |
6 |
Correct |
65 ms |
296 KB |
# of queries: 4282 |
7 |
Correct |
74 ms |
288 KB |
# of queries: 4272 |
8 |
Correct |
50 ms |
308 KB |
# of queries: 4084 |
9 |
Correct |
55 ms |
304 KB |
# of queries: 4262 |
10 |
Correct |
29 ms |
208 KB |
# of queries: 2496 |
11 |
Incorrect |
0 ms |
208 KB |
Wrong Answer [4] |
12 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
59 ms |
208 KB |
# of queries: 4077 |
2 |
Correct |
64 ms |
312 KB |
# of queries: 4057 |
3 |
Correct |
64 ms |
208 KB |
# of queries: 4282 |
4 |
Correct |
59 ms |
304 KB |
# of queries: 4268 |
5 |
Correct |
69 ms |
300 KB |
# of queries: 4283 |
6 |
Correct |
65 ms |
296 KB |
# of queries: 4282 |
7 |
Correct |
74 ms |
288 KB |
# of queries: 4272 |
8 |
Correct |
50 ms |
308 KB |
# of queries: 4084 |
9 |
Correct |
55 ms |
304 KB |
# of queries: 4262 |
10 |
Correct |
29 ms |
208 KB |
# of queries: 2496 |
11 |
Incorrect |
0 ms |
208 KB |
Wrong Answer [4] |
12 |
Halted |
0 ms |
0 KB |
- |