QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#828378#9914. 前往何方zhenjianuo20250 2657ms5816kbC++202.0kb2024-12-23 16:21:042024-12-23 16:21:05

Judging History

你现在查看的是最新测评结果

  • [2024-12-23 16:21:05]
  • 评测
  • 测评结果:0
  • 用时:2657ms
  • 内存:5816kb
  • [2024-12-23 16:21:04]
  • 提交

answer

#include<bits/stdc++.h>
#include "wheretoreach.h"
using namespace std;
#define vec vector
#define pb push_back
#define eb emplace_back
#define siz(vec) ((int)(vec).size())
#define all(vec) (vec).begin(),(vec).end()
template<class T>
void operator +=(vec<T> &a,T b){a.push_back(b);}
template<class T>
void operator --(vec<T> &a){a.pop_back();}
#define pii pair<int,int>
#define x first
#define y second
#define mp make_pair
#define exc(exp) if(exp)continue;
#define stop(exp) if(exp)break;
#define ret(exp) if(exp)return;
#define deb(var) cerr<<#var<<'='<<(var)<<"; "
#define debl(var) cerr<<#var<<'='<<(var)<<";\n"
#define ins insert
#define era erase
#define lb lower_bound
#define inf (long long)(1e9)
template<class T>
bool Min(T &x,T y){return x>y?x=y,1:0;}
template<class T>
bool Max(T &x,T y){return x<y?x=y,1:0;}

int add(int x);
int remove(int x);
void report(int x,int y);

int n,vis[10010],tmp[10010];
void sol(int l,int r,vec<int> w){
    ret(l>r);
    int mid=(l+r)>>1;

    vec<int> v;
    if(l==1&&r==n){
        v=w;
    }else{
        for(auto x:w)tmp[x]=0;
        fill(vis+l,vis+r+1,0);
        for(int T=1;T<=3;T++){
            for(int i=l;i<=r;i++){
                exc(vis[i]);
                int x=add(i);
                if(x>1)tmp[i]=1;
                if(x>1||vis[i]){
                    remove(i);
                }else{
                    vis[i]=1;
                }
            }
            for(auto x:w){
                exc(tmp[x]);
                if(x<=l){
                }else if(x<=r){

                }else{
                    if(add(x)>1)tmp[x]=1;
                    remove(x);
                }
            }
        }
        for(auto x:w){
            if(tmp[x])v+=x;
        }
    }

    if(l==r){
        for(auto x:w){
            report(l,x);
        }
    }else{
        sol(l,mid,w);
        sol(mid+1,r,w);
    }
}
void solve(int N){
    n=N;
    vec<int> v(n-1);
    iota(all(v),2);
    sol(1,n,v);
}

Details

Tip: Click on the bar to expand more detailed information

Subtask #1:

score: 0
Wrong Answer

Test #1:

score: 0
Wrong Answer
time: 346ms
memory: 4264kb

input:

500
310 77
468 235
218 93
58 406
223 334
159 243
204 48
144 107
492 288
447 165
102 407
340 299
450 126
140 234
209 62
111 204
453 306
4 476
126 358
183 317
360 489
149 158
232 22
326 372
92 383
410 24
199 14
401 480
69 329
192 167
409 152
426 354
435 60
146 404
334 187
208 305
123 55
30 79
469 72
2...

output:

-1
1

result:

wrong answer Wrong Answer (or #queries exceeded).

Subtask #2:

score: 0
Wrong Answer

Test #9:

score: 0
Wrong Answer
time: 942ms
memory: 4756kb

input:

2500
887 818
1296 878
1605 2107
803 2410
1919 1135
860 1160
1364 2414
1375 500
894 2173
2322 2449
211 1732
1821 573
413 1556
1574 1977
709 162
2002 1577
1626 1895
1563 688
2151 2293
661 69
317 1170
2335 1549
1481 1349
1500 779
1593 735
1824 2380
639 2334
1496 2335
1956 1384
2476 1583
1035 163
720 70...

output:

-1
2

result:

wrong answer Wrong Answer (or #queries exceeded).

Subtask #3:

score: 0
Wrong Answer

Test #17:

score: 0
Wrong Answer
time: 2657ms
memory: 5816kb

input:

10000
6139 8917
131 5800
5366 5247
1298 5035
3966 3518
4889 7202
6547 1919
5829 9494
8012 6029
3868 6403
1909 8116
5734 6122
2683 4779
9275 6673
7433 9042
7646 2032
3547 6306
1943 8382
4061 6428
8240 3548
460 2795
3451 4320
5904 6627
8709 7621
8706 3534
748 4873
8101 4261
5359 3304
6254 4687
6492 53...

output:

-1
3

result:

wrong answer Wrong Answer (or #queries exceeded).