QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#21242#2810. SpeedrunQingyu0 0ms0kbC++204.2kb2022-03-03 23:49:362023-01-17 10:52:07

Judging History

你现在查看的是测评时间为 2023-01-17 10:52:07 的历史记录

  • [2024-06-05 09:12:27]
  • 管理员手动重测本题所有提交记录
  • 测评结果:0
  • 用时:0ms
  • 内存:0kb
  • [2024-05-20 18:51:32]
  • 管理员手动重测本题所有提交记录
  • 测评结果:0
  • 用时:0ms
  • 内存:0kb
  • [2023-08-10 23:21:45]
  • System Update: QOJ starts to keep a history of the judgings of all the submissions.
  • [2023-01-17 10:52:07]
  • 评测
  • 测评结果:0
  • 用时:0ms
  • 内存:0kb
  • [2022-03-03 23:49:36]
  • 提交

speedrun

#ifndef CPL_TEMPLATE
#define CPL_TEMPLATE
/*
	Normie's Template v2.5
	Changes:
    Added warning against using pragmas on USACO.
*/
// Standard library in one include.
#include <bits/stdc++.h>
using namespace std;
 
// ordered_set library.
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;
#define ordered_set(el) tree<el,null_type,less<el>,rb_tree_tag,tree_order_statistics_node_update>
 
// AtCoder library. (Comment out these two lines if you're not submitting in AtCoder.) (Or if you want to use it in other judges, run expander.py first.)
//#include <atcoder/all>
//using namespace atcoder;
 
//Pragmas (Comment out these three lines if you're submitting in szkopul or USACO.)
// #pragma comment(linker, "/stack:200000000")
// #pragma GCC optimize("Ofast,unroll-loops,tree-vectorize")
// #pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,avx2,tune=native")
 
//File I/O.
#define FILE_IN "cseq.inp"
#define FILE_OUT "cseq.out"
#define ofile freopen(FILE_IN,"r",stdin);freopen(FILE_OUT,"w",stdout)
 
//Fast I/O.
#define fio ios::sync_with_stdio(0);cin.tie(0)
#define nfio cin.tie(0)
#define endl "\n"
 
//Order checking.
#define ord(a,b,c) ((a>=b)and(b>=c))
 
//min/max redefines, so i dont have to resolve annoying compile errors.
 
// Fast min/max assigns to use with AVX.
// Requires g++ 9.2.0.
template<typename T>
__attribute__((always_inline)) void chkmin(T& a, const T& b) {
    a=(a<b)?a:b;
}
 
template<typename T>
__attribute__((always_inline)) void chkmax(T& a, const T& b) {
    a=(a>b)?a:b;
}
 
//Constants.
#define MOD (ll(998244353))
#define MAX 300001
#define mag 320
const long double PI=3.14159265358979;
 
//Pairs and 3-pairs.
#define p1 first
#define p2 second.first
#define p3 second.second
#define fi first
#define se second
#define pii(element_type) pair<element_type,element_type>
#define piii(element_type) pair<element_type,pii(element_type)>
 
//Quick power of 2.
#define pow2(x) (ll(1)<<x)
 
//Short for-loops.
#define ff(i,__,___) for(int i=__;i<=___;i++)
#define rr(i,__,___) for(int i=__;i>=___;i--)
 
//Typedefs.
#define bi BigInt
typedef long long ll;
typedef long double ld;
typedef short sh;
 
// Binpow and stuff
ll BOW(ll a, ll x, ll p)
{
	if (!x) return 1;
	ll res=BOW(a,x/2,p);
	res*=res;
	res%=p;
	if (x%2) res*=a;
	return res%p;
}
ll INV(ll a, ll p)
{
	return BOW(a,p-2,p);
}
//---------END-------//
#endif
#include "speedrun.h"
vector<ll> gt[1001],vec;
ll par[1001],nxt[1001];
ll i,j,k,t,u,v,a,b,n;
void dfs(int x, int p) {
  vec.push_back(x);
	par[x]=p;
  for (auto g : gt[x]) if (g-p) dfs(g,x);
}
void assignHints (int subtask , int N, int A[], int B[]) {
  if (subtask==1) {
    setHintLen(N);
    for (i=1;i<N;i++) {
      setHint(A[i],B[i],1);
      setHint(B[i],A[i],1);
    }
  }
  else {
    for (i=1;i<N;i++) {
      gt[A[i]].push_back(B[i]);
      gt[B[i]].push_back(A[i]);
    }
  	dfs(1,0);
  	for (i=1;i<N;i++) nxt[vec[i-1]]=(vec[i]);
    nxt[vec[N-1]]=0;
    setHintLen(20);
    for (i=1;i<=N;i++) {
      for (j=0;j<10;j++) setHint(i,j+1,(par[i]&(1<<j))>>j);
      for (j=0;j<10;j++) setHint(i,j+11,(nxt[i]&(1<<j))>>j);
    }
  }
}
void dfs2(int x, int p) {
	for (int g=1;g<=n;g++) if (getHint(g)) gt[x].push_back(g);
  	for (auto g : gt[x]) if (g-p) {
      goTo(g);
      dfs2(g,x);
    }
  	if (p) goTo(p);
}
void speedrun(int subtask , int N, int start ){
  n=N;
  	if (subtask==1) {
      dfs2(start,0);
    }
 	else {
      u=start;
      while(u!=1) {
        par[u]=0;
      	for (j=0;j<10;j++) {
          v=getHint(j+1);
          par[u]^=v<<j;
        }
       	goTo(par[u]);
        u=par[u];
      }
      while(true) {
        nxt[u]=0;
      	for (j=0;j<10;j++) {
          v=getHint(j+11);
          nxt[u]^=v<<j;
        }
        if (nxt[u]==0) break;
        a=nxt[u];
        while(true) {
          v=goTo(a);
          if (v==0) {
       		par[u]=0;
            for (j=0;j<10;j++) {
              v=getHint(j+1);
              par[u]^=v<<j;
            }
            goTo(par[u]);
            u=par[u];
          }
          else {
            u=a;
          }
        }
      }
    }
}
 

详细

Subtask #1:

score: 0
Time Limit Exceeded

Test #1:

score: 0
Time Limit Exceeded

input:

1
1 1000
1 119
1 453
1 454
2 59
3 113
3 657
3 824
4 494
5 33
5 550
5 937
6 287
7 222
7 577
7 742
8 626
9 896
10 204
11 638
12 305
12 552
12 791
13 246
14 840
15 95
15 316
15 772
16 109
16 551
16 846
17 581
18 142
19 601
19 744
19 977
20 361
20 404
20 845
21 245
21 410
21 518
22 351
23 971
24 497
24 ...

output:

1 1 1000
1 2 1 119 1
1 2 119 1 1
1 2 1 453 1
1 2 453 1 1
1 2 1 454 1
1 2 454 1 1
1 2 2 59 1
1 2 59 2 1
1 2 3 113 1
1 2 113 3 1
1 2 3 657 1
1 2 657 3 1
1 2 3 824 1
1 2 824 3 1
1 2 4 494 1
1 2 494 4 1
1 2 5 33 1
1 2 33 5 1
1 2 5 550 1
1 2 550 5 1
1 2 5 937 1
1 2 937 5 1
1 2 6 287 1
1 2 287 6 1
1 2 7 2...

input:

2
1 1000 500
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
0
0
0...

output:

2 2 1
2 2 2
2 2 3
2 2 4
2 2 5
2 2 6
2 2 7
2 2 8
2 2 9
2 2 10
2 2 11
2 2 12
2 2 13
2 2 14
2 2 15
2 2 16
2 2 17
2 2 18
2 2 19
2 2 20
2 2 21
2 2 22
2 2 23
2 2 24
2 2 25
2 2 26
2 2 27
2 2 28
2 2 29
2 2 30
2 2 31
2 2 32
2 2 33
2 2 34
2 2 35
2 2 36
2 2 37
2 2 38
2 2 39
2 2 40
2 2 41
2 2 42
2 2 43
2 2 44
2...

result:

wrong answer Solution didn't visit every node

Subtask #2:

score: 0
Time Limit Exceeded

Test #5:

score: 0
Time Limit Exceeded

input:

1
2 1000
1 133
2 133
3 133
4 133
5 133
6 133
7 133
8 133
9 133
10 133
11 133
12 133
13 133
14 133
15 133
16 133
17 133
18 133
19 133
20 133
21 133
22 133
23 133
24 133
25 133
26 133
27 133
28 133
29 133
30 133
31 133
32 133
33 133
34 133
35 133
36 133
37 133
38 133
39 133
40 133
41 133
42 133
43 133...

output:

1 1 20
1 2 1 1 0
1 2 1 2 0
1 2 1 3 0
1 2 1 4 0
1 2 1 5 0
1 2 1 6 0
1 2 1 7 0
1 2 1 8 0
1 2 1 9 0
1 2 1 10 0
1 2 1 11 1
1 2 1 12 0
1 2 1 13 1
1 2 1 14 0
1 2 1 15 0
1 2 1 16 0
1 2 1 17 0
1 2 1 18 1
1 2 1 19 0
1 2 1 20 0
1 2 2 1 1
1 2 2 2 0
1 2 2 3 1
1 2 2 4 0
1 2 2 5 0
1 2 2 6 0
1 2 2 7 0
1 2 2 8 1
1 ...

input:

2
2 1000 651
1
0
1
0
0
0
0
1
0
0
1
1
0
0
0
0
0
0
0
0
0
1
1
0
1
0
0
0
0
1
0
0
1
0
1
0
0
0
0
0
0
0
0
0
1
1
0
1
0
0
0
0
0
0
0
0
0
1
1
0
1
0
0
0
0
0
0
0
0
0
1
1
0
1
0
0
0
0
0
0
0
0
0
1
1
0
1
0
0
0
0
0
0
0
0
0
1
1
0
1
0
0
0
0
0
0
0
0
0
1
1
0
1
0
0
0
0
0
0
0
0
0
1
1
0
1
0
0
0
0
0
0
0
0
0
1
1
0
1
0
0
0
0
0...

output:

2 2 1
2 2 2
2 2 3
2 2 4
2 2 5
2 2 6
2 2 7
2 2 8
2 2 9
2 2 10
2 3 133
2 2 1
2 2 2
2 2 3
2 2 4
2 2 5
2 2 6
2 2 7
2 2 8
2 2 9
2 2 10
2 3 1
2 2 11
2 2 12
2 2 13
2 2 14
2 2 15
2 2 16
2 2 17
2 2 18
2 2 19
2 2 20
2 3 133
2 3 133
2 2 1
2 2 2
2 2 3
2 2 4
2 2 5
2 2 6
2 2 7
2 2 8
2 2 9
2 2 10
2 3 1
2 3 133
2 3...

result:

wrong answer Used too many wrong interactions

Subtask #3:

score: 0
Time Limit Exceeded

Test #7:

score: 0
Time Limit Exceeded

input:

1
3 1000
1 20
1 569
2 69
2 72
3 510
3 811
4 278
4 994
5 890
5 918
6 97
6 577
7 11
7 791
8 138
8 653
9 219
9 539
10 22
10 151
11 527
12 195
12 420
13 187
13 293
14 265
14 476
15 594
15 988
16 424
16 881
17 407
17 613
18 178
18 471
19 400
19 896
20 95
21 221
21 949
22 624
23 247
23 361
24 140
24 169
2...

output:

1 1 20
1 2 1 1 0
1 2 1 2 0
1 2 1 3 0
1 2 1 4 0
1 2 1 5 0
1 2 1 6 0
1 2 1 7 0
1 2 1 8 0
1 2 1 9 0
1 2 1 10 0
1 2 1 11 0
1 2 1 12 0
1 2 1 13 1
1 2 1 14 0
1 2 1 15 1
1 2 1 16 0
1 2 1 17 0
1 2 1 18 0
1 2 1 19 0
1 2 1 20 0
1 2 2 1 0
1 2 2 2 0
1 2 2 3 0
1 2 2 4 1
1 2 2 5 0
1 2 2 6 0
1 2 2 7 1
1 2 2 8 0
1 ...

input:

2
3 1000 986
0
0
1
1
0
1
0
0
1
0
1
0
1
1
0
1
1
0
1
1
0
1
0
0
0
0
0
0
0
1
0
0
1
1
0
0
0
1
0
1
0
1
1
1
0
1
0
1
0
1
1
1
0
0
1
1
0
0
1
0
1
0
1
0
1
1
1
1
0
0
0
0
0
0
1
0
1
1
0
0
1
0
1
0
0
1
1
1
1
0
0
0
1
1
1
1
0
1
1
0
0
0
0
1
1
0
0
0
1
1
1
0
1
0
0
0
0
0
1
0
1
0
0
0
1
0
1
1
1
1
0
1
0
0
0
0
1
0
0
1
0
0
1
0...

output:

2 2 1
2 2 2
2 2 3
2 2 4
2 2 5
2 2 6
2 2 7
2 2 8
2 2 9
2 2 10
2 3 300
2 2 1
2 2 2
2 2 3
2 2 4
2 2 5
2 2 6
2 2 7
2 2 8
2 2 9
2 2 10
2 3 438
2 2 1
2 2 2
2 2 3
2 2 4
2 2 5
2 2 6
2 2 7
2 2 8
2 2 9
2 2 10
2 3 128
2 2 1
2 2 2
2 2 3
2 2 4
2 2 5
2 2 6
2 2 7
2 2 8
2 2 9
2 2 10
2 3 849
2 2 1
2 2 2
2 2 3
2 2 4
...

result:

wrong answer Used too many wrong interactions

Subtask #4:

score: 0
Time Limit Exceeded

Test #10:

score: 0
Time Limit Exceeded

input:

1
4 1000
1 103
1 881
2 195
2 740
3 224
4 558
5 749
5 788
6 189
7 221
8 362
9 267
9 547
10 205
10 813
10 926
11 23
12 687
13 225
14 366
14 768
15 58
15 156
15 869
16 79
16 225
17 61
17 437
18 500
18 534
18 768
18 989
19 300
20 909
21 970
22 245
22 425
23 528
23 669
23 809
23 890
24 121
24 778
25 845
...

output:

1 1 20
1 2 1 1 0
1 2 1 2 0
1 2 1 3 0
1 2 1 4 0
1 2 1 5 0
1 2 1 6 0
1 2 1 7 0
1 2 1 8 0
1 2 1 9 0
1 2 1 10 0
1 2 1 11 1
1 2 1 12 1
1 2 1 13 1
1 2 1 14 0
1 2 1 15 0
1 2 1 16 1
1 2 1 17 1
1 2 1 18 0
1 2 1 19 0
1 2 1 20 0
1 2 2 1 0
1 2 2 2 0
1 2 2 3 1
1 2 2 4 0
1 2 2 5 0
1 2 2 6 1
1 2 2 7 1
1 2 2 8 1
1 ...

input:

2
4 1000 196
1
0
0
0
0
1
1
0
1
1
1
0
0
1
0
1
1
1
0
1
1
1
0
1
0
0
1
1
0
0
1
0
1
1
0
0
1
1
0
1
0
1
0
1
0
1
1
1
0
0
0
0
0
1
1
0
0
1
0
0
1
1
1
1
0
1
0
0
0
1
1
0
0
0
1
1
1
0
1
0
0
1
0
0
0
1
0
1
0
0
1
1
1
0
0
1
0
1
1
1
0
0
1
1
1
0
1
1
0
1
0
1
0
1
1
1
0
0
0
0
1
1
1
1
1
0
0
0
0
0
0
1
0
0
1
1
1
0
0
1
0
0
1
1...

output:

2 2 1
2 2 2
2 2 3
2 2 4
2 2 5
2 2 6
2 2 7
2 2 8
2 2 9
2 2 10
2 3 865
2 2 1
2 2 2
2 2 3
2 2 4
2 2 5
2 2 6
2 2 7
2 2 8
2 2 9
2 2 10
2 3 884
2 2 1
2 2 2
2 2 3
2 2 4
2 2 5
2 2 6
2 2 7
2 2 8
2 2 9
2 2 10
2 3 306
2 2 1
2 2 2
2 2 3
2 2 4
2 2 5
2 2 6
2 2 7
2 2 8
2 2 9
2 2 10
2 3 345
2 2 1
2 2 2
2 2 3
2 2 4
...

result:

wrong answer Solution didn't visit every node

Subtask #5:

score: 0
Time Limit Exceeded

Test #16:

score: 0
Time Limit Exceeded

input:

1
5 1000
1 296
1 974
2 414
3 777
4 158
4 918
5 535
5 799
5 952
6 290
7 17
7 420
8 223
9 600
10 743
11 189
11 239
11 530
11 619
12 27
12 451
13 580
14 165
15 552
15 753
16 883
16 936
17 292
17 398
17 904
18 355
18 678
19 807
20 577
21 392
21 744
22 600
23 582
23 717
23 915
24 70
24 254
24 492
25 115
...

output:

1 1 20
1 2 1 1 0
1 2 1 2 0
1 2 1 3 0
1 2 1 4 0
1 2 1 5 0
1 2 1 6 0
1 2 1 7 0
1 2 1 8 0
1 2 1 9 0
1 2 1 10 0
1 2 1 11 0
1 2 1 12 0
1 2 1 13 0
1 2 1 14 1
1 2 1 15 0
1 2 1 16 1
1 2 1 17 0
1 2 1 18 0
1 2 1 19 1
1 2 1 20 0
1 2 2 1 0
1 2 2 2 1
1 2 2 3 1
1 2 2 4 1
1 2 2 5 1
1 2 2 6 0
1 2 2 7 0
1 2 2 8 1
1 ...

input:

2
5 1000 274
1
0
1
1
0
1
0
0
1
0
1
1
1
0
0
0
0
1
0
1
0
1
0
1
0
0
0
1
0
1
0
0
1
1
1
1
1
1
0
0
0
1
0
1
1
0
0
0
0
1
0
0
1
0
1
0
0
1
0
0
0
0
1
1
0
1
0
1
0
0
0
0
0
0
1
0
1
0
0
1
1
1
0
1
0
1
0
1
1
1
1
1
0
1
0
1
1
0
1
0
1
1
0
1
0
1
0
0
1
1
0
1
0
0
1
1
1
1
0
0
1
0
1
1
1
1
0
1
1
1
1
1
0
0
1
1
1
0
1
0
0
0
1
1...

output:

2 2 1
2 2 2
2 2 3
2 2 4
2 2 5
2 2 6
2 2 7
2 2 8
2 2 9
2 2 10
2 3 301
2 2 1
2 2 2
2 2 3
2 2 4
2 2 5
2 2 6
2 2 7
2 2 8
2 2 9
2 2 10
2 3 323
2 2 1
2 2 2
2 2 3
2 2 4
2 2 5
2 2 6
2 2 7
2 2 8
2 2 9
2 2 10
2 3 162
2 2 1
2 2 2
2 2 3
2 2 4
2 2 5
2 2 6
2 2 7
2 2 8
2 2 9
2 2 10
2 3 287
2 2 1
2 2 2
2 2 3
2 2 4
...

result:

wrong answer Used too many wrong interactions