Submission #146313

# Submission time Handle Problem Language Result Execution time Memory
146313 2019-08-23T12:36:20 Z MvC Genetics (BOI18_genetics) C++11
46 / 100
2000 ms 22904 KB
#pragma GCC target("avx2")
#pragma GCC optimization("O3")
#pragma GCC optimization("unroll-loops")
#include<bits/stdc++.h>
//#include "boxes.h"
#define rc(x) return cout<<x<<endl,0
#define pb push_back
#define mkp make_pair
#define in insert
#define er erase
#define fd find
#define fr first
#define sc second
typedef long long ll;
typedef long double ld;
const ll INF=0x3f3f3f3f3f3f3f3f;
const ll llinf=(1LL<<62);
const int inf=(1<<30);
const int nmax=5e3+50;
const int mod=1e9+7;
using namespace std;
int n,m,k,i,j,bl,nr,t,x,y;
char a[nmax][nmax];
bitset<4105>bs[nmax];
vector<int>rad;
int main()
{
	//freopen("sol.in","r",stdin);
	//freopen("sol.out","w",stdout);
	mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
	ios_base::sync_with_stdio(false);cin.tie(0);cerr.tie(0);cout.tie(0);
	cin>>n>>m>>k;
	for(i=1;i<=n;i++)for(j=1;j<=m;j++)cin>>a[i][j];
	if(n<=100 && m<=100)
	{
		for(i=1;i<=n;i++)
		{
			bl=0;
			for(j=1;j<=n;j++)
			{
				if(i==j)continue;
				nr=0;
				for(t=1;t<=m;t++)if(a[i][t]!=a[j][t])nr++;
				if(nr!=k)
				{
					bl=1;
					break;
				}
			}
			if(!bl)rc(i);
		}
	}
	for(i=1;i<=n;i++)
	{
		for(j=1;j<=m;j++)
		{
			if(a[i][j]=='C')bs[i][j]=1;
		}
	}
	for(i=1;i<=n;i++)rad.pb(i);
	shuffle(rad.begin(),rad.end(),rng);
	for(i=0;i<n;i++)
	{
		x=rad[i];
		bl=0;
		for(j=0;j<n;j++)
		{
			y=rad[j];
			if(x==y)continue;
			nr=(bs[x]^bs[y]).count();
			if(nr!=k)
			{
				bl=1;
				break;
			}
		}
		if(!bl)rc(x);
	}
	return 0;
}

Compilation message

genetics.cpp:2:0: warning: ignoring #pragma GCC optimization [-Wunknown-pragmas]
 #pragma GCC optimization("O3")
 
genetics.cpp:3:0: warning: ignoring #pragma GCC optimization [-Wunknown-pragmas]
 #pragma GCC optimization("unroll-loops")
# Verdict Execution time Memory Grader output
1 Correct 5 ms 632 KB Output is correct
2 Correct 5 ms 760 KB Output is correct
3 Correct 5 ms 376 KB Output is correct
4 Correct 5 ms 632 KB Output is correct
5 Correct 5 ms 760 KB Output is correct
6 Correct 5 ms 760 KB Output is correct
7 Correct 5 ms 504 KB Output is correct
8 Correct 5 ms 376 KB Output is correct
9 Correct 5 ms 632 KB Output is correct
10 Correct 6 ms 760 KB Output is correct
11 Correct 5 ms 632 KB Output is correct
12 Correct 7 ms 760 KB Output is correct
13 Correct 5 ms 760 KB Output is correct
14 Correct 5 ms 760 KB Output is correct
15 Correct 5 ms 760 KB Output is correct
16 Correct 5 ms 760 KB Output is correct
17 Correct 5 ms 376 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 99 ms 8568 KB Output is correct
2 Correct 94 ms 10104 KB Output is correct
3 Correct 420 ms 9848 KB Output is correct
4 Correct 66 ms 6136 KB Output is correct
5 Correct 242 ms 10232 KB Output is correct
6 Correct 133 ms 10104 KB Output is correct
7 Correct 81 ms 4472 KB Output is correct
8 Correct 65 ms 4472 KB Output is correct
9 Correct 79 ms 9720 KB Output is correct
10 Correct 88 ms 9720 KB Output is correct
11 Correct 167 ms 8696 KB Output is correct
12 Correct 208 ms 8696 KB Output is correct
13 Correct 131 ms 8696 KB Output is correct
14 Correct 77 ms 7544 KB Output is correct
15 Correct 191 ms 7672 KB Output is correct
16 Correct 316 ms 8424 KB Output is correct
17 Correct 167 ms 9852 KB Output is correct
18 Correct 291 ms 9848 KB Output is correct
19 Correct 130 ms 9720 KB Output is correct
20 Correct 122 ms 9592 KB Output is correct
21 Correct 85 ms 9976 KB Output is correct
22 Correct 550 ms 9720 KB Output is correct
23 Correct 73 ms 9720 KB Output is correct
24 Correct 108 ms 9720 KB Output is correct
25 Correct 272 ms 9724 KB Output is correct
26 Correct 84 ms 9720 KB Output is correct
27 Correct 332 ms 9828 KB Output is correct
28 Correct 143 ms 9592 KB Output is correct
29 Correct 345 ms 9848 KB Output is correct
30 Correct 60 ms 10108 KB Output is correct
31 Correct 63 ms 10232 KB Output is correct
32 Correct 74 ms 10104 KB Output is correct
33 Correct 5 ms 376 KB Output is correct
34 Correct 5 ms 760 KB Output is correct
35 Correct 4 ms 376 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 99 ms 8568 KB Output is correct
2 Correct 94 ms 10104 KB Output is correct
3 Correct 420 ms 9848 KB Output is correct
4 Correct 66 ms 6136 KB Output is correct
5 Correct 242 ms 10232 KB Output is correct
6 Correct 133 ms 10104 KB Output is correct
7 Correct 81 ms 4472 KB Output is correct
8 Correct 65 ms 4472 KB Output is correct
9 Correct 79 ms 9720 KB Output is correct
10 Correct 88 ms 9720 KB Output is correct
11 Correct 167 ms 8696 KB Output is correct
12 Correct 208 ms 8696 KB Output is correct
13 Correct 131 ms 8696 KB Output is correct
14 Correct 77 ms 7544 KB Output is correct
15 Correct 191 ms 7672 KB Output is correct
16 Correct 316 ms 8424 KB Output is correct
17 Correct 167 ms 9852 KB Output is correct
18 Correct 291 ms 9848 KB Output is correct
19 Correct 130 ms 9720 KB Output is correct
20 Correct 122 ms 9592 KB Output is correct
21 Correct 85 ms 9976 KB Output is correct
22 Correct 550 ms 9720 KB Output is correct
23 Correct 73 ms 9720 KB Output is correct
24 Correct 108 ms 9720 KB Output is correct
25 Correct 272 ms 9724 KB Output is correct
26 Correct 84 ms 9720 KB Output is correct
27 Correct 332 ms 9828 KB Output is correct
28 Correct 143 ms 9592 KB Output is correct
29 Correct 345 ms 9848 KB Output is correct
30 Correct 60 ms 10108 KB Output is correct
31 Correct 63 ms 10232 KB Output is correct
32 Correct 74 ms 10104 KB Output is correct
33 Correct 5 ms 376 KB Output is correct
34 Correct 5 ms 760 KB Output is correct
35 Correct 4 ms 376 KB Output is correct
36 Correct 508 ms 20088 KB Output is correct
37 Correct 366 ms 22776 KB Output is correct
38 Correct 479 ms 22220 KB Output is correct
39 Correct 827 ms 19324 KB Output is correct
40 Correct 1431 ms 22740 KB Output is correct
41 Correct 337 ms 11512 KB Output is correct
42 Correct 232 ms 11640 KB Output is correct
43 Correct 291 ms 19192 KB Output is correct
44 Correct 711 ms 22776 KB Output is correct
45 Correct 512 ms 22776 KB Output is correct
46 Correct 482 ms 22904 KB Output is correct
47 Correct 914 ms 20052 KB Output is correct
48 Correct 413 ms 19960 KB Output is correct
49 Correct 650 ms 17272 KB Output is correct
50 Correct 926 ms 17272 KB Output is correct
51 Correct 480 ms 19320 KB Output is correct
52 Correct 1670 ms 22200 KB Output is correct
53 Correct 875 ms 22456 KB Output is correct
54 Correct 299 ms 22136 KB Output is correct
55 Correct 286 ms 22136 KB Output is correct
56 Correct 336 ms 22264 KB Output is correct
57 Correct 1948 ms 22264 KB Output is correct
58 Correct 850 ms 22268 KB Output is correct
59 Correct 422 ms 22264 KB Output is correct
60 Correct 365 ms 22392 KB Output is correct
61 Correct 681 ms 22140 KB Output is correct
62 Correct 682 ms 22008 KB Output is correct
63 Correct 687 ms 22236 KB Output is correct
64 Correct 1209 ms 22264 KB Output is correct
65 Correct 609 ms 22136 KB Output is correct
66 Correct 661 ms 22264 KB Output is correct
67 Correct 450 ms 22264 KB Output is correct
68 Correct 372 ms 22264 KB Output is correct
69 Correct 695 ms 22264 KB Output is correct
70 Execution timed out 2071 ms 22264 KB Time limit exceeded
71 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 5 ms 632 KB Output is correct
2 Correct 5 ms 760 KB Output is correct
3 Correct 5 ms 376 KB Output is correct
4 Correct 5 ms 632 KB Output is correct
5 Correct 5 ms 760 KB Output is correct
6 Correct 5 ms 760 KB Output is correct
7 Correct 5 ms 504 KB Output is correct
8 Correct 5 ms 376 KB Output is correct
9 Correct 5 ms 632 KB Output is correct
10 Correct 6 ms 760 KB Output is correct
11 Correct 5 ms 632 KB Output is correct
12 Correct 7 ms 760 KB Output is correct
13 Correct 5 ms 760 KB Output is correct
14 Correct 5 ms 760 KB Output is correct
15 Correct 5 ms 760 KB Output is correct
16 Correct 5 ms 760 KB Output is correct
17 Correct 5 ms 376 KB Output is correct
18 Correct 99 ms 8568 KB Output is correct
19 Correct 94 ms 10104 KB Output is correct
20 Correct 420 ms 9848 KB Output is correct
21 Correct 66 ms 6136 KB Output is correct
22 Correct 242 ms 10232 KB Output is correct
23 Correct 133 ms 10104 KB Output is correct
24 Correct 81 ms 4472 KB Output is correct
25 Correct 65 ms 4472 KB Output is correct
26 Correct 79 ms 9720 KB Output is correct
27 Correct 88 ms 9720 KB Output is correct
28 Correct 167 ms 8696 KB Output is correct
29 Correct 208 ms 8696 KB Output is correct
30 Correct 131 ms 8696 KB Output is correct
31 Correct 77 ms 7544 KB Output is correct
32 Correct 191 ms 7672 KB Output is correct
33 Correct 316 ms 8424 KB Output is correct
34 Correct 167 ms 9852 KB Output is correct
35 Correct 291 ms 9848 KB Output is correct
36 Correct 130 ms 9720 KB Output is correct
37 Correct 122 ms 9592 KB Output is correct
38 Correct 85 ms 9976 KB Output is correct
39 Correct 550 ms 9720 KB Output is correct
40 Correct 73 ms 9720 KB Output is correct
41 Correct 108 ms 9720 KB Output is correct
42 Correct 272 ms 9724 KB Output is correct
43 Correct 84 ms 9720 KB Output is correct
44 Correct 332 ms 9828 KB Output is correct
45 Correct 143 ms 9592 KB Output is correct
46 Correct 345 ms 9848 KB Output is correct
47 Correct 60 ms 10108 KB Output is correct
48 Correct 63 ms 10232 KB Output is correct
49 Correct 74 ms 10104 KB Output is correct
50 Correct 5 ms 376 KB Output is correct
51 Correct 5 ms 760 KB Output is correct
52 Correct 4 ms 376 KB Output is correct
53 Correct 508 ms 20088 KB Output is correct
54 Correct 366 ms 22776 KB Output is correct
55 Correct 479 ms 22220 KB Output is correct
56 Correct 827 ms 19324 KB Output is correct
57 Correct 1431 ms 22740 KB Output is correct
58 Correct 337 ms 11512 KB Output is correct
59 Correct 232 ms 11640 KB Output is correct
60 Correct 291 ms 19192 KB Output is correct
61 Correct 711 ms 22776 KB Output is correct
62 Correct 512 ms 22776 KB Output is correct
63 Correct 482 ms 22904 KB Output is correct
64 Correct 914 ms 20052 KB Output is correct
65 Correct 413 ms 19960 KB Output is correct
66 Correct 650 ms 17272 KB Output is correct
67 Correct 926 ms 17272 KB Output is correct
68 Correct 480 ms 19320 KB Output is correct
69 Correct 1670 ms 22200 KB Output is correct
70 Correct 875 ms 22456 KB Output is correct
71 Correct 299 ms 22136 KB Output is correct
72 Correct 286 ms 22136 KB Output is correct
73 Correct 336 ms 22264 KB Output is correct
74 Correct 1948 ms 22264 KB Output is correct
75 Correct 850 ms 22268 KB Output is correct
76 Correct 422 ms 22264 KB Output is correct
77 Correct 365 ms 22392 KB Output is correct
78 Correct 681 ms 22140 KB Output is correct
79 Correct 682 ms 22008 KB Output is correct
80 Correct 687 ms 22236 KB Output is correct
81 Correct 1209 ms 22264 KB Output is correct
82 Correct 609 ms 22136 KB Output is correct
83 Correct 661 ms 22264 KB Output is correct
84 Correct 450 ms 22264 KB Output is correct
85 Correct 372 ms 22264 KB Output is correct
86 Correct 695 ms 22264 KB Output is correct
87 Execution timed out 2071 ms 22264 KB Time limit exceeded
88 Halted 0 ms 0 KB -