QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#116225#6661. 야유회xtqqwq#0 2263ms10028kbC++143.9kb2023-06-28 12:24:092024-05-31 18:21:38

Judging History

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

  • [2024-05-31 18:21:38]
  • 评测
  • 测评结果:0
  • 用时:2263ms
  • 内存:10028kb
  • [2023-08-10 23:21:45]
  • System Update: QOJ starts to keep a history of the judgings of all the submissions.
  • [2023-06-28 12:24:09]
  • 提交

answer

#include<bits/stdc++.h>
#include "workshop.h"

#define pb push_back
#define fi first
#define se second
#define mp make_pair

using namespace std;

typedef long long ll;
typedef unsigned long long ull;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
typedef long double ld;

template <typename T> bool chkmin(T &x,T y){return x>y?x=y,1:0;}
template <typename T> bool chkmax(T &x,T y){return x<y?x=y,1:0;}

const int B=28,M=100000;
int cnt;
int per[100005];
mt19937 mrand(1);

namespace sub1{

const int C=5,N=7;
int pw[10];
int p[1000005],col[1000005];
vector<int> adj[1000005];
bool vis[1000005];

int id(int x,int y,int z){return (x-1)*N*N+(y-1)*N+z;}

void change(int x){
	int num[C]={0};
	for(auto v:adj[x]) num[col[v]]++;
	vector<int> co(0);
	int mina=1<<30;
	for(int k=0;k<C;k++){
		if(chkmin(mina,num[k])) co.clear(),co.pb(k);
		else if(mina==num[k]) co.pb(k);
	}
	int pl=mrand()%co.size();
	cnt-=num[col[x]];
	cnt+=mina;
	col[x]=co[pl];
}

void work(){
	pw[0]=1;
	for(int i=1;i<=6;i++) pw[i]=pw[i-1]*N;
	for(int i=0;i<N;i++){
		int mask=0;
		for(int j=0;j<6;j++) mask+=pw[j]*i;
		vis[mask]=1;
	}
	for(int i=0;i<pw[6];i++){
		if(vis[i]) continue;
		int t=i/pw[5];
		for(int j=0;j<N;j++){
			int to=i%pw[5]*N+j;
			if(vis[to]) continue;
			adj[i].pb(to);
			adj[to].pb(i);
		}
	}
	for(int i=1;i<=pw[6];i++) p[i]=i;
	while(1){
		cnt=0;
		for(int i=1;i<=pw[6];i++) col[i]=mrand()%C;
		for(int i=1;i<=pw[6];i++) for(auto v:adj[i]) if(col[i]==col[v]) cnt++;
		cnt>>=1;
		for(int i=1;i<=1000;i++){
			// cout<<"cnt "<<cnt<<endl;
			shuffle(p+1,p+pw[6]+1,mrand);
			for(int i=1;i<=pw[6];i++) change(p[i]);
			if(!cnt) break;
		}
		if(!cnt) break;
	}
}

}

namespace sub2{

const int C=4,N=4;
int pw[10];
int p[1000005],col[1000005];
vector<int> adj[1000005];
bool vis[1000005];

int id(int x,int y,int z){return (x-1)*N*N+(y-1)*N+z;}

void change(int x){
	int num[C]={0};
	for(auto v:adj[x]) num[col[v]]++;
	vector<int> co(0);
	int mina=1<<30;
	for(int k=0;k<C;k++){
		if(chkmin(mina,num[k])) co.clear(),co.pb(k);
		else if(mina==num[k]) co.pb(k);
	}
	int pl=mrand()%co.size();
	cnt-=num[col[x]];
	cnt+=mina;
	col[x]=co[pl];
}

void work(){
	pw[0]=1;
	for(int i=1;i<=6;i++) pw[i]=pw[i-1]*N;
	for(int i=0;i<N;i++){
		int mask=0;
		for(int j=0;j<6;j++) mask+=pw[j]*i;
		vis[mask]=1;
	}
	for(int i=0;i<pw[6];i++){
		if(vis[i]) continue;
		int t=i/pw[5];
		for(int j=0;j<N;j++){
			int to=i%pw[5]*N+j;
			if(vis[to]) continue;
			adj[i].pb(to);
			adj[to].pb(i);
		}
	}
	for(int i=1;i<=pw[6];i++) p[i]=i;
	while(1){
		cnt=0;
		for(int i=1;i<=pw[6];i++) col[i]=mrand()%C;
		for(int i=1;i<=pw[6];i++) for(auto v:adj[i]) if(col[i]==col[v]) cnt++;
		cnt>>=1;
		for(int i=1;i<=1000;i++){
			// cout<<"cnt "<<cnt<<endl;
			shuffle(p+1,p+pw[6]+1,mrand);
			for(int i=1;i<=pw[6];i++) change(p[i]);
			if(!cnt) break;
		}
		if(!cnt) break;
	}
}

}

void init(){
	for(int i=0;i<M;i++) per[i]=i;
	shuffle(per,per+M,mrand);
	sub1::work();
	sub2::work();
}

int morning(int my_num,int right_num){
	return per[my_num]%B*B+per[right_num]%B;
}

int afternoon(int left_num, int my_num, int right_num){
	int t1=left_num/B;
	int t2=my_num/B;
	int t3=right_num/B;
	int t4=right_num%B;
	return t1*B*B*B+t2*B*B+t3*B+t4;
}

int evening(int left_num, int my_num, int right_num){
	int b=sub1::N;
	int t1=left_num/B/B/B;
	int t2=my_num/B/B/B;
	int t3=right_num/B/B/B;
	int t4=right_num%(B*B*B)/B/B;
	int t5=right_num%(B*B)/B;
	int t6=right_num%B;
	int a1=t1%b;
	int a2=t2%b;
	int a3=t3%b;
	int a4=t4%b;
	int a5=t5%b;
	int a6=t6%b;
	int b1=t1/b;
	int b2=t2/b;
	int b3=t3/b;
	int b4=t4/b;
	int b5=t5/b;
	int b6=t6/b;
	int mask1=a1*b*b*b*b*b+a2*b*b*b*b+a3*b*b*b+a4*b*b+a5*b+a6;
	int mask2=b1*b*b*b*b*b+b2*b*b*b*b+b3*b*b*b+b4*b*b+b5*b+b6;
	if(sub1::vis[mask1]) return sub2::col[mask2]+sub1::C;
	else return sub1::col[mask1];
}

Details

Tip: Click on the bar to expand more detailed information

Subtask #1:

score: 0
Wrong Answer

Test #1:

score: 5
Accepted
time: 1678ms = 1677ms + 1ms
memory: 3484kb,4296kb

input:

2dc2b1d4-8de2-INPUT-bcd3-aa55b691fdb3
1
2
40 40
0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39
40 40
0 3 1 5 7 9 6 4 2 10 8 23 21 25 27 29 26 24 22 30 28 13 11 15 17 19 16 14 12 20 18 33 31 35 37 39 36 34 32 38

output:

dd180566-1d37-PIPE-b85d-c176ae85727d
5 2
28 28 28 28
89 88 8b 8a 8d 8c 8f 8e 81 80 83 82 85 84 87 86 99 98 9b 9a 9d 9c 9f 9e 91 90 93 92 95 94 97 96 a9 a8 ab aa ad ac af ae 
0000001e 000001c9 000001d0 0000018a 00000058 000001fe 000001ce 00000292 0000004e 000000ee 00000297 000001a6 0000021e 000002a0 ...

input:

dd180566-1d37-PIPE-b85d-c176ae85727d
5 2
28 28 28 28
89 88 8b 8a 8d 8c 8f 8e 81 80 83 82 85 84 87 86 99 98 9b 9a 9d 9c 9f 9e 91 90 93 92 95 94 97 96 a9 a8 ab aa ad ac af ae 
0000001e 000001c9 000001d0 0000018a 00000058 000001fe 000001ce 00000292 0000004e 000000ee 00000297 000001a6 0000021e 000002a0 ...

output:

4468cc07-dabe-OUTPUT-ba95-7ddd49645c94
5

result:

ok Correct, m = 5

Test #2:

score: 5
Accepted
time: 1611ms = 1610ms + 1ms
memory: 3752kb,4180kb

input:

2dc2b1d4-8de2-INPUT-bcd3-aa55b691fdb3
1
2
40 7
6 9 4 2 1 5 7
40 10
6 9 4 2 0 1 5 7 3 8

output:

dd180566-1d37-PIPE-b85d-c176ae85727d
5 2
7 6 4 2
8f 80 8d 8b 88 8c 8e 
000001be 000000d2 00000059 000001d2 000001c8 000001f6 
0003b9c9 00011882 00027ec8 000428a6 
88 8a 
a 9 7 5
8f 80 8d 8b 89 88 8c 8e 8a 81 
000001be 000000d2 00000059 000001dc 0000001e 000001c8 000001f6 00000294 0000018a 
0003b9c9 ...

input:

dd180566-1d37-PIPE-b85d-c176ae85727d
5 2
7 6 4 2
8f 80 8d 8b 88 8c 8e 
000001be 000000d2 00000059 000001d2 000001c8 000001f6 
0003b9c9 00011882 00027ec8 000428a6 
88 8a 
a 9 7 5
8f 80 8d 8b 89 88 8c 8e 8a 81 
000001be 000000d2 00000059 000001dc 0000001e 000001c8 000001f6 00000294 0000018a 
0003b9c9 ...

output:

4468cc07-dabe-OUTPUT-ba95-7ddd49645c94
5

result:

ok Correct, m = 5

Test #3:

score: 5
Accepted
time: 2013ms = 2012ms + 1ms

input:

2dc2b1d4-8de2-INPUT-bcd3-aa55b691fdb3
1
25000
40 40
12 4 16 7 26 21 10 20 0 32 15 3 33 37 23 8 34 38 13 1 29 18 17 25 39 35 31 24 36 28 30 9 14 5 19 22 2 27 11 6
40 40
3 34 21 38 36 7 33 39 26 15 2 13 22 20 5 25 10 12 30 35 0 31 24 17 11 37 32 18 9 28 6 16 23 27 1 4 8 14 19 29
40 40
18 34 29 31 22 3...

output:

dd180566-1d37-PIPE-b85d-c176ae85727d
8 25000
28 28 28 28
85 8d 99 8e 93 9c 83 9d 89 a9 86 8a a8 ac 9e 81 ab af 84 88 94 9b 98 90 ae aa 96 91 ad 95 97 80 87 8c 9a 9f 8b 92 82 8f 
00000202 0000005b 00000112 00000297 000001a5 000002ca 00000290 00000018 00000007 000000da 00000274 00000199 000002b7 00000...

input:

dd180566-1d37-PIPE-b85d-c176ae85727d
8 25000
28 28 28 28
85 8d 99 8e 93 9c 83 9d 89 a9 86 8a a8 ac 9e 81 ab af 84 88 94 9b 98 90 ae aa 96 91 ad 95 97 80 87 8c 9a 9f 8b 92 82 8f 
00000202 0000005b 00000112 00000297 000001a5 000002ca 00000290 00000018 00000007 000000da 00000274 00000199 000002b7 00000...

output:

4468cc07-dabe-OUTPUT-ba95-7ddd49645c94
8

result:

ok Correct, m = 8

Test #4:

score: 5
Accepted
time: 1669ms = 1668ms + 1ms
memory: 6512kb,3844kb

input:

2dc2b1d4-8de2-INPUT-bcd3-aa55b691fdb3
1
2
10 7
6 9 4 2 1 5 7
10 10
6 9 4 2 0 1 5 7 3 8

output:

dd180566-1d37-PIPE-b85d-c176ae85727d
5 2
7 6 4 2
8f 80 8d 8b 88 8c 8e 
000001be 000000d2 00000059 000001d2 000001c8 000001f6 
0003b9c9 00011882 00027ec8 000428a6 
88 8a 
a a a a
8f 80 8d 8b 89 88 8c 8e 8a 81 
000001be 000000d2 00000059 000001dc 0000001e 000001c8 000001f6 00000294 0000018a 00000046 
...

input:

dd180566-1d37-PIPE-b85d-c176ae85727d
5 2
7 6 4 2
8f 80 8d 8b 88 8c 8e 
000001be 000000d2 00000059 000001d2 000001c8 000001f6 
0003b9c9 00011882 00027ec8 000428a6 
88 8a 
a a a a
8f 80 8d 8b 89 88 8c 8e 8a 81 
000001be 000000d2 00000059 000001dc 0000001e 000001c8 000001f6 00000294 0000018a 00000046 
...

output:

4468cc07-dabe-OUTPUT-ba95-7ddd49645c94
5

result:

ok Correct, m = 5

Test #5:

score: 5
Accepted
time: 2263ms = 2262ms + 1ms
memory: 10028kb,5488kb

input:

2dc2b1d4-8de2-INPUT-bcd3-aa55b691fdb3
1
100000
10 10
4 8 3 7 1 0 2 5 6 9
10 10
3 7 9 4 5 6 0 1 8 2
10 10
9 3 6 1 0 4 2 7 8 5
10 10
2 8 6 3 1 5 0 4 9 7
10 10
1 7 5 3 4 0 6 9 8 2
10 10
2 1 0 7 5 9 3 6 4 8
10 10
5 2 9 3 6 0 1 7 8 4
10 10
3 6 8 2 1 5 9 7 4 0
10 10
6 4 2 8 3 0 7 1 9 5
10 10
9 2 6 0 4 7 1...

output:

dd180566-1d37-PIPE-b85d-c176ae85727d
5 100000
a a a a
8d 81 8a 8e 88 89 8b 8c 8f 80 
00000042 00000044 00000186 00000296 000001b0 00000011 000001d4 000001fe 000001be 000000d2 
00026e36 00027566 00033fa0 00067f01 0003bf64 0001d27e 00042e8e 00047c42 0003b9b2 000117f4 
8b 88 8b 8d 8a 8b 88 89 8d 88 
a ...

input:

dd180566-1d37-PIPE-b85d-c176ae85727d
5 100000
a a a a
8d 81 8a 8e 88 89 8b 8c 8f 80 
00000042 00000044 00000186 00000296 000001b0 00000011 000001d4 000001fe 000001be 000000d2 
00026e36 00027566 00033fa0 00067f01 0003bf64 0001d27e 00042e8e 00047c42 0003b9b2 000117f4 
8b 88 8b 8d 8a 8b 88 89 8d 88 
a ...

output:

4468cc07-dabe-OUTPUT-ba95-7ddd49645c94
5

result:

ok Correct, m = 5

Test #6:

score: 5
Accepted
time: 2073ms = 2072ms + 1ms
memory: 4736kb,5468kb

input:

2dc2b1d4-8de2-INPUT-bcd3-aa55b691fdb3
1
128929
10 10
4 8 3 7 1 0 2 5 6 9
10 9
8 0 6 7 5 2 4 3 1
10 8
5 9 3 8 2 6 7 1
10 10
0 1 4 5 7 2 9 8 6 3
10 7
1 3 5 0 2 4 8
10 7
2 4 7 6 1 9 0
10 9
5 9 6 3 1 4 7 0 8
10 9
1 5 4 6 8 0 9 2 3
10 7
7 4 6 9 2 8 0
10 10
8 4 6 5 0 9 2 3 1 7
10 9
0 9 6 4 2 3 1 8 7
10 10...

output:

dd180566-1d37-PIPE-b85d-c176ae85727d
5 128929
a a a a
8d 81 8a 8e 88 89 8b 8c 8f 80 
00000042 00000044 00000186 00000296 000001b0 00000011 000001d4 000001fe 000001be 000000d2 
00026e36 00027566 00033fa0 00067f01 0003bf64 0001d27e 00042e8e 00047c42 0003b9b2 000117f4 
8b 88 8b 8d 8a 8b 88 89 8d 88 
9 ...

input:

dd180566-1d37-PIPE-b85d-c176ae85727d
5 128929
a a a a
8d 81 8a 8e 88 89 8b 8c 8f 80 
00000042 00000044 00000186 00000296 000001b0 00000011 000001d4 000001fe 000001be 000000d2 
00026e36 00027566 00033fa0 00067f01 0003bf64 0001d27e 00042e8e 00047c42 0003b9b2 000117f4 
8b 88 8b 8d 8a 8b 88 89 8d 88 
9 ...

output:

4468cc07-dabe-OUTPUT-ba95-7ddd49645c94
5

result:

ok Correct, m = 5

Test #7:

score: 0
Wrong Answer
time: 2039ms = 2038ms + 1ms

input:

2dc2b1d4-8de2-INPUT-bcd3-aa55b691fdb3
1
44333
40 40
12 4 16 7 26 21 10 20 0 32 15 3 33 37 23 8 34 38 13 1 29 18 17 25 39 35 31 24 36 28 30 9 14 5 19 22 2 27 11 6
40 31
10 24 13 28 30 27 31 29 20 37 34 35 19 36 25 12 21 9 0 32 22 26 4 38 3 17 2 23 33 16 15
40 23
6 8 19 2 3 24 25 7 23 12 0 13 31 17 39...

output:

64be09ab-d709-ERROR-82bc-c23f6124dd26
Wrong Answer [4]

input:

64be09ab-d709-ERROR-82bc-c23f6124dd26
Wrong Answer [4]

output:

64be09ab-d709-ERROR-82bc-c23f6124dd26
Wrong Answer [4]

result:

wrong answer Wrong Answer [4]

Subtask #2:

score: 0
Wrong Answer

Test #8:

score: 64
Acceptable Answer
time: 1873ms = 1872ms + 1ms
memory: 3492kb,3996kb

input:

2dc2b1d4-8de2-INPUT-bcd3-aa55b691fdb3
2
2
40 40
0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39
40 40
0 3 1 5 7 9 6 4 2 10 8 23 21 25 27 29 26 24 22 30 28 13 11 15 17 19 16 14 12 20 18 33 31 35 37 39 36 34 32 38

output:

dd180566-1d37-PIPE-b85d-c176ae85727d
5 2
28 28 28 28
89 88 8b 8a 8d 8c 8f 8e 81 80 83 82 85 84 87 86 99 98 9b 9a 9d 9c 9f 9e 91 90 93 92 95 94 97 96 a9 a8 ab aa ad ac af ae 
0000001e 000001c9 000001d0 0000018a 00000058 000001fe 000001ce 00000292 0000004e 000000ee 00000297 000001a6 0000021e 000002a0 ...

input:

dd180566-1d37-PIPE-b85d-c176ae85727d
5 2
28 28 28 28
89 88 8b 8a 8d 8c 8f 8e 81 80 83 82 85 84 87 86 99 98 9b 9a 9d 9c 9f 9e 91 90 93 92 95 94 97 96 a9 a8 ab aa ad ac af ae 
0000001e 000001c9 000001d0 0000018a 00000058 000001fe 000001ce 00000292 0000004e 000000ee 00000297 000001a6 0000021e 000002a0 ...

output:

4468cc07-dabe-OUTPUT-ba95-7ddd49645c94
5

result:

points 0.67368421050 Incorrect, m = 5

Test #9:

score: 64
Acceptable Answer
time: 1814ms = 1813ms + 1ms
memory: 3464kb,4284kb

input:

2dc2b1d4-8de2-INPUT-bcd3-aa55b691fdb3
2
2
40 7
6 9 4 2 1 5 7
40 10
6 9 4 2 0 1 5 7 3 8

output:

dd180566-1d37-PIPE-b85d-c176ae85727d
5 2
7 6 4 2
8f 80 8d 8b 88 8c 8e 
000001be 000000d2 00000059 000001d2 000001c8 000001f6 
0003b9c9 00011882 00027ec8 000428a6 
88 8a 
a 9 7 5
8f 80 8d 8b 89 88 8c 8e 8a 81 
000001be 000000d2 00000059 000001dc 0000001e 000001c8 000001f6 00000294 0000018a 
0003b9c9 ...

input:

dd180566-1d37-PIPE-b85d-c176ae85727d
5 2
7 6 4 2
8f 80 8d 8b 88 8c 8e 
000001be 000000d2 00000059 000001d2 000001c8 000001f6 
0003b9c9 00011882 00027ec8 000428a6 
88 8a 
a 9 7 5
8f 80 8d 8b 89 88 8c 8e 8a 81 
000001be 000000d2 00000059 000001dc 0000001e 000001c8 000001f6 00000294 0000018a 
0003b9c9 ...

output:

4468cc07-dabe-OUTPUT-ba95-7ddd49645c94
5

result:

points 0.67368421050 Incorrect, m = 5

Test #10:

score: 38
Acceptable Answer
time: 2242ms = 2241ms + 1ms

input:

2dc2b1d4-8de2-INPUT-bcd3-aa55b691fdb3
2
25000
40 40
8 20 9 10 28 26 23 38 21 15 0 12 24 5 17 33 19 27 16 35 36 1 13 39 6 25 2 7 22 3 32 29 14 31 34 30 18 4 37 11
40 40
22 39 8 4 38 5 24 12 20 33 15 37 28 0 19 36 13 26 25 34 27 35 14 16 18 10 3 7 23 29 9 31 1 30 17 2 21 32 11 6
40 40
23 7 33 4 16 15 ...

output:

dd180566-1d37-PIPE-b85d-c176ae85727d
9 25000
28 28 28 28
81 9d 80 83 95 93 9e af 9c 86 89 85 91 8c 98 a8 9a 92 99 aa ad 88 84 ae 8f 90 8b 8e 9f 8a a9 94 87 96 ab 97 9b 8d ac 82 
00000040 00000006 000000ee 000002ac 0000016f 00000197 00000025 0000000d 000002c2 00000270 0000002a 0000021b 0000011c 00000...

input:

dd180566-1d37-PIPE-b85d-c176ae85727d
9 25000
28 28 28 28
81 9d 80 83 95 93 9e af 9c 86 89 85 91 8c 98 a8 9a 92 99 aa ad 88 84 ae 8f 90 8b 8e 9f 8a a9 94 87 96 ab 97 9b 8d ac 82 
00000040 00000006 000000ee 000002ac 0000016f 00000197 00000025 0000000d 000002c2 00000270 0000002a 0000021b 0000011c 00000...

output:

4468cc07-dabe-OUTPUT-ba95-7ddd49645c94
9

result:

points 0.40 Incorrect, m = 9

Test #11:

score: 0
Wrong Answer
time: 1765ms = 1765ms + 0ms

input:

2dc2b1d4-8de2-INPUT-bcd3-aa55b691fdb3
2
10
100000 100000
30835 54902 6031 39780 48892 41112 10655 59793 82131 11690 46738 17357 71191 42943 59375 29187 13113 60681 52635 78884 28768 26173 64156 46178 687 70180 721 91640 72042 76284 56999 69796 75841 24470 47874 87966 9206 57028 69773 82741 61206 949...

output:

64be09ab-d709-ERROR-82bc-c23f6124dd26
Wrong Answer [4]

input:

64be09ab-d709-ERROR-82bc-c23f6124dd26
Wrong Answer [4]

output:

64be09ab-d709-ERROR-82bc-c23f6124dd26
Wrong Answer [4]

result:

wrong answer Wrong Answer [4]