Submission #278183

# Submission time Handle Problem Language Result Execution time Memory
278183 2020-08-21T11:11:33 Z AKaan37 Amusement Park (CEOI19_amusementpark) C++17
42 / 100
3000 ms 227808 KB
//Bismillahirrahmanirrahim
//█▀█─█──█──█▀█─█─█
//█▄█─█──█──█▄█─█▄█
//█─█─█▄─█▄─█─█─█─█

#include <bits/stdc++.h>

using namespace std;

typedef long long lo;
typedef pair< lo,lo > PII;
typedef pair< lo,PII > PIII;

#define fi first
#define se second
#define mp make_pair
#define endl "\n"
#define int long long
#define pb push_back
#define fio() ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL)
#define FOR for(int i=1;i<=n;i++)
#define mid ((start+end)/2)
#define ort ((bas+son)/2)

const lo inf = 1000000000000000000;
const lo KOK = 100000;
const lo LOG = 30;
const lo li = 15;
const lo mod = 1000000007;

int n,m,b[li],a[li],k,flag,t,vis[li],say=1,cevap;
int cev=1;
string s;
vector<PIII> v[li];
map<int,int> mpp;
vector<int> vv;

inline void check(){
	FOR vis[i]=0;
	int mask=0;
	int tut=0;
	for(int i=0;i<n;i++){
		int node=vv[i];
		
		for(int j=0;j<(int)v[node].size();j++){
			if(vis[v[node][j].fi])continue;
			tut+=v[node][j].se.fi;
			if(v[node][j].se.fi==1)mask|=(1ll<<v[node][j].se.se);
		}
		vis[node]=1;
	}
	if(mpp[mask]==0)cevap+=tut;
	mpp[mask]=1;
}

main(void){
	scanf("%lld %lld",&n,&m);
	for(int i=0;i<m;i++){
		int x,y;
		scanf("%lld %lld",&x,&y);
		v[x].pb({y,{0,i}});
		v[y].pb({x,{1,i}});
	}
	//~ printf("%lld\n",cev);
	FOR vv.pb(i);
	FOR{
		cev*=i;
	}
	while(say<=cev){
		say++;
		//~ cout<<say<<" : : "<<cev<<endl;
		check();
		next_permutation(vv.begin(),vv.end());
	}
	printf("%lld\n",cevap);
	return 0;
}

Compilation message

amusementpark.cpp:56:10: warning: ISO C++ forbids declaration of 'main' with no type [-Wreturn-type]
   56 | main(void){
      |          ^
amusementpark.cpp: In function 'int main()':
amusementpark.cpp:57:7: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
   57 |  scanf("%lld %lld",&n,&m);
      |  ~~~~~^~~~~~~~~~~~~~~~~~~
amusementpark.cpp:60:8: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
   60 |   scanf("%lld %lld",&x,&y);
      |   ~~~~~^~~~~~~~~~~~~~~~~~~
# Verdict Execution time Memory Grader output
1 Correct 1 ms 256 KB Output is correct
2 Correct 1 ms 256 KB Output is correct
3 Correct 0 ms 256 KB Output is correct
4 Correct 1 ms 256 KB Output is correct
5 Correct 1 ms 384 KB Output is correct
6 Correct 1 ms 256 KB Output is correct
7 Correct 1 ms 256 KB Output is correct
8 Correct 1 ms 256 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 256 KB Output is correct
2 Correct 1 ms 256 KB Output is correct
3 Correct 0 ms 256 KB Output is correct
4 Correct 1 ms 256 KB Output is correct
5 Correct 1 ms 384 KB Output is correct
6 Correct 1 ms 256 KB Output is correct
7 Correct 1 ms 256 KB Output is correct
8 Correct 1 ms 256 KB Output is correct
9 Correct 1 ms 256 KB Output is correct
10 Correct 1 ms 384 KB Output is correct
11 Correct 1 ms 256 KB Output is correct
12 Correct 1 ms 256 KB Output is correct
13 Correct 1 ms 256 KB Output is correct
14 Correct 1 ms 384 KB Output is correct
15 Correct 0 ms 256 KB Output is correct
16 Correct 0 ms 256 KB Output is correct
17 Correct 1 ms 256 KB Output is correct
18 Correct 1 ms 256 KB Output is correct
19 Correct 1 ms 384 KB Output is correct
20 Correct 1 ms 256 KB Output is correct
21 Correct 1 ms 256 KB Output is correct
22 Correct 1 ms 384 KB Output is correct
23 Correct 1 ms 384 KB Output is correct
24 Correct 1 ms 372 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 256 KB Output is correct
2 Correct 1 ms 256 KB Output is correct
3 Correct 0 ms 256 KB Output is correct
4 Correct 1 ms 256 KB Output is correct
5 Correct 1 ms 384 KB Output is correct
6 Correct 1 ms 256 KB Output is correct
7 Correct 1 ms 256 KB Output is correct
8 Correct 1 ms 256 KB Output is correct
9 Correct 1 ms 256 KB Output is correct
10 Correct 1 ms 384 KB Output is correct
11 Correct 1 ms 256 KB Output is correct
12 Correct 1 ms 256 KB Output is correct
13 Correct 1 ms 256 KB Output is correct
14 Correct 1 ms 384 KB Output is correct
15 Correct 0 ms 256 KB Output is correct
16 Correct 0 ms 256 KB Output is correct
17 Correct 1 ms 256 KB Output is correct
18 Correct 1 ms 256 KB Output is correct
19 Correct 1 ms 384 KB Output is correct
20 Correct 1 ms 256 KB Output is correct
21 Correct 1 ms 256 KB Output is correct
22 Correct 1 ms 384 KB Output is correct
23 Correct 1 ms 384 KB Output is correct
24 Correct 1 ms 372 KB Output is correct
25 Correct 1 ms 256 KB Output is correct
26 Correct 2 ms 256 KB Output is correct
27 Correct 2 ms 384 KB Output is correct
28 Correct 2 ms 372 KB Output is correct
29 Correct 2 ms 384 KB Output is correct
30 Correct 3 ms 512 KB Output is correct
31 Correct 3 ms 640 KB Output is correct
32 Correct 4 ms 256 KB Output is correct
33 Correct 7 ms 380 KB Output is correct
34 Correct 10 ms 384 KB Output is correct
35 Correct 13 ms 556 KB Output is correct
36 Correct 15 ms 1024 KB Output is correct
37 Correct 18 ms 1792 KB Output is correct
38 Correct 25 ms 2808 KB Output is correct
39 Correct 36 ms 376 KB Output is correct
40 Correct 59 ms 376 KB Output is correct
41 Correct 85 ms 504 KB Output is correct
42 Correct 92 ms 632 KB Output is correct
43 Correct 111 ms 2040 KB Output is correct
44 Correct 147 ms 3632 KB Output is correct
45 Correct 165 ms 7672 KB Output is correct
46 Correct 204 ms 14456 KB Output is correct
47 Correct 248 ms 23032 KB Output is correct
48 Correct 34 ms 376 KB Output is correct
49 Correct 65 ms 632 KB Output is correct
50 Correct 63 ms 632 KB Output is correct
51 Correct 66 ms 652 KB Output is correct
52 Correct 380 ms 368 KB Output is correct
53 Correct 546 ms 376 KB Output is correct
54 Correct 739 ms 760 KB Output is correct
55 Correct 919 ms 2296 KB Output is correct
56 Correct 1199 ms 11896 KB Output is correct
57 Correct 1451 ms 30112 KB Output is correct
58 Correct 1873 ms 64588 KB Output is correct
59 Correct 2304 ms 126248 KB Output is correct
60 Correct 2977 ms 227808 KB Output is correct
61 Correct 360 ms 376 KB Output is correct
62 Correct 628 ms 1144 KB Output is correct
63 Correct 640 ms 1228 KB Output is correct
64 Correct 653 ms 1184 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 256 KB Output is correct
2 Correct 1 ms 256 KB Output is correct
3 Correct 0 ms 256 KB Output is correct
4 Correct 1 ms 256 KB Output is correct
5 Correct 1 ms 384 KB Output is correct
6 Correct 1 ms 256 KB Output is correct
7 Correct 1 ms 256 KB Output is correct
8 Correct 1 ms 256 KB Output is correct
9 Correct 1 ms 256 KB Output is correct
10 Correct 1 ms 384 KB Output is correct
11 Correct 1 ms 256 KB Output is correct
12 Correct 1 ms 256 KB Output is correct
13 Correct 1 ms 256 KB Output is correct
14 Correct 1 ms 384 KB Output is correct
15 Correct 0 ms 256 KB Output is correct
16 Correct 0 ms 256 KB Output is correct
17 Correct 1 ms 256 KB Output is correct
18 Correct 1 ms 256 KB Output is correct
19 Correct 1 ms 384 KB Output is correct
20 Correct 1 ms 256 KB Output is correct
21 Correct 1 ms 256 KB Output is correct
22 Correct 1 ms 384 KB Output is correct
23 Correct 1 ms 384 KB Output is correct
24 Correct 1 ms 372 KB Output is correct
25 Correct 1 ms 256 KB Output is correct
26 Correct 2 ms 256 KB Output is correct
27 Correct 2 ms 384 KB Output is correct
28 Correct 2 ms 372 KB Output is correct
29 Correct 2 ms 384 KB Output is correct
30 Correct 3 ms 512 KB Output is correct
31 Correct 3 ms 640 KB Output is correct
32 Correct 4 ms 256 KB Output is correct
33 Correct 7 ms 380 KB Output is correct
34 Correct 10 ms 384 KB Output is correct
35 Correct 13 ms 556 KB Output is correct
36 Correct 15 ms 1024 KB Output is correct
37 Correct 18 ms 1792 KB Output is correct
38 Correct 25 ms 2808 KB Output is correct
39 Correct 36 ms 376 KB Output is correct
40 Correct 59 ms 376 KB Output is correct
41 Correct 85 ms 504 KB Output is correct
42 Correct 92 ms 632 KB Output is correct
43 Correct 111 ms 2040 KB Output is correct
44 Correct 147 ms 3632 KB Output is correct
45 Correct 165 ms 7672 KB Output is correct
46 Correct 204 ms 14456 KB Output is correct
47 Correct 248 ms 23032 KB Output is correct
48 Correct 34 ms 376 KB Output is correct
49 Correct 65 ms 632 KB Output is correct
50 Correct 63 ms 632 KB Output is correct
51 Correct 66 ms 652 KB Output is correct
52 Correct 380 ms 368 KB Output is correct
53 Correct 546 ms 376 KB Output is correct
54 Correct 739 ms 760 KB Output is correct
55 Correct 919 ms 2296 KB Output is correct
56 Correct 1199 ms 11896 KB Output is correct
57 Correct 1451 ms 30112 KB Output is correct
58 Correct 1873 ms 64588 KB Output is correct
59 Correct 2304 ms 126248 KB Output is correct
60 Correct 2977 ms 227808 KB Output is correct
61 Correct 360 ms 376 KB Output is correct
62 Correct 628 ms 1144 KB Output is correct
63 Correct 640 ms 1228 KB Output is correct
64 Correct 653 ms 1184 KB Output is correct
65 Execution timed out 3044 ms 6200 KB Time limit exceeded
66 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 256 KB Output is correct
2 Correct 1 ms 256 KB Output is correct
3 Correct 0 ms 256 KB Output is correct
4 Correct 1 ms 256 KB Output is correct
5 Correct 1 ms 384 KB Output is correct
6 Correct 1 ms 256 KB Output is correct
7 Correct 1 ms 256 KB Output is correct
8 Correct 1 ms 256 KB Output is correct
9 Correct 1 ms 256 KB Output is correct
10 Correct 1 ms 384 KB Output is correct
11 Correct 1 ms 256 KB Output is correct
12 Correct 1 ms 256 KB Output is correct
13 Correct 1 ms 256 KB Output is correct
14 Correct 1 ms 384 KB Output is correct
15 Correct 0 ms 256 KB Output is correct
16 Correct 0 ms 256 KB Output is correct
17 Correct 1 ms 256 KB Output is correct
18 Correct 1 ms 256 KB Output is correct
19 Correct 1 ms 384 KB Output is correct
20 Correct 1 ms 256 KB Output is correct
21 Correct 1 ms 256 KB Output is correct
22 Correct 1 ms 384 KB Output is correct
23 Correct 1 ms 384 KB Output is correct
24 Correct 1 ms 372 KB Output is correct
25 Correct 1 ms 256 KB Output is correct
26 Correct 2 ms 256 KB Output is correct
27 Correct 2 ms 384 KB Output is correct
28 Correct 2 ms 372 KB Output is correct
29 Correct 2 ms 384 KB Output is correct
30 Correct 3 ms 512 KB Output is correct
31 Correct 3 ms 640 KB Output is correct
32 Correct 4 ms 256 KB Output is correct
33 Correct 7 ms 380 KB Output is correct
34 Correct 10 ms 384 KB Output is correct
35 Correct 13 ms 556 KB Output is correct
36 Correct 15 ms 1024 KB Output is correct
37 Correct 18 ms 1792 KB Output is correct
38 Correct 25 ms 2808 KB Output is correct
39 Correct 36 ms 376 KB Output is correct
40 Correct 59 ms 376 KB Output is correct
41 Correct 85 ms 504 KB Output is correct
42 Correct 92 ms 632 KB Output is correct
43 Correct 111 ms 2040 KB Output is correct
44 Correct 147 ms 3632 KB Output is correct
45 Correct 165 ms 7672 KB Output is correct
46 Correct 204 ms 14456 KB Output is correct
47 Correct 248 ms 23032 KB Output is correct
48 Correct 34 ms 376 KB Output is correct
49 Correct 65 ms 632 KB Output is correct
50 Correct 63 ms 632 KB Output is correct
51 Correct 66 ms 652 KB Output is correct
52 Correct 380 ms 368 KB Output is correct
53 Correct 546 ms 376 KB Output is correct
54 Correct 739 ms 760 KB Output is correct
55 Correct 919 ms 2296 KB Output is correct
56 Correct 1199 ms 11896 KB Output is correct
57 Correct 1451 ms 30112 KB Output is correct
58 Correct 1873 ms 64588 KB Output is correct
59 Correct 2304 ms 126248 KB Output is correct
60 Correct 2977 ms 227808 KB Output is correct
61 Correct 360 ms 376 KB Output is correct
62 Correct 628 ms 1144 KB Output is correct
63 Correct 640 ms 1228 KB Output is correct
64 Correct 653 ms 1184 KB Output is correct
65 Execution timed out 3044 ms 6200 KB Time limit exceeded
66 Halted 0 ms 0 KB -