답안 #277800

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
277800 2020-08-21T07:26:38 Z AKaan37 Amusement Park (CEOI19_amusementpark) C++17
19 / 100
3000 ms 12160 KB
//Bismillahirrahmanirrahim
//█▀█─█──█──█▀█─█─█
//█▄█─█──█──█▄█─█▄█
//█─█─█▄─█▄─█─█─█─█

#include <bits/stdc++.h>

using namespace std;

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

#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 = 500005;
const lo mod = 1000000007;

int n,m,b[li],a[li],k,flag,t,vis[li],x[li],y[li];
int cev;
string s;
vector<int> v[li];

inline void f(int sira,int mask){
	if(sira==m){
		FOR vis[i]=0;
		FOR v[i].clear();
		int say=0;
		for(int i=0;i<m;i++){
			if((mask&(1ll<<i))==0){vis[y[i]]++;v[x[i]].pb(y[i]);}
			else{vis[x[i]]++;v[y[i]].pb(x[i]);say++;}
		}
		queue<int> q;
		FOR{
			if(vis[i]==0)q.push(i);
		}
		int cevv=0;
		while(q.size()){
			int node=q.front();
			q.pop();
			cevv++;
			for(int i=0;i<(int)v[node].size();i++){
				int go=v[node][i];
				if(vis[go]==1)q.push(go);
				vis[go]--;
			}
		}
		if(cevv==n)cev+=say;
		return ;
	}
	f(sira+1,mask);
	f(sira+1,(mask|(1<<sira)));
}

main(void){
	scanf("%lld %lld",&n,&m);
	for(int i=0;i<m;i++){
		scanf("%lld %lld",&x[i],&y[i]);
	}
	f(0,0);
	printf("%lld\n",cev);
	return 0;
}

Compilation message

amusementpark.cpp:66:10: warning: ISO C++ forbids declaration of 'main' with no type [-Wreturn-type]
   66 | main(void){
      |          ^
amusementpark.cpp: In function 'int main()':
amusementpark.cpp:67:7: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
   67 |  scanf("%lld %lld",&n,&m);
      |  ~~~~~^~~~~~~~~~~~~~~~~~~
amusementpark.cpp:69:8: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
   69 |   scanf("%lld %lld",&x[i],&y[i]);
      |   ~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~
# 결과 실행 시간 메모리 Grader output
1 Correct 8 ms 12032 KB Output is correct
2 Correct 8 ms 12120 KB Output is correct
3 Correct 8 ms 12032 KB Output is correct
4 Correct 9 ms 12032 KB Output is correct
5 Correct 8 ms 12032 KB Output is correct
6 Correct 8 ms 12032 KB Output is correct
7 Correct 9 ms 12032 KB Output is correct
8 Correct 8 ms 12032 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 8 ms 12032 KB Output is correct
2 Correct 8 ms 12120 KB Output is correct
3 Correct 8 ms 12032 KB Output is correct
4 Correct 9 ms 12032 KB Output is correct
5 Correct 8 ms 12032 KB Output is correct
6 Correct 8 ms 12032 KB Output is correct
7 Correct 9 ms 12032 KB Output is correct
8 Correct 8 ms 12032 KB Output is correct
9 Correct 9 ms 12032 KB Output is correct
10 Correct 9 ms 12160 KB Output is correct
11 Correct 9 ms 12032 KB Output is correct
12 Correct 8 ms 12032 KB Output is correct
13 Correct 10 ms 12032 KB Output is correct
14 Correct 8 ms 12032 KB Output is correct
15 Correct 8 ms 12032 KB Output is correct
16 Correct 8 ms 12064 KB Output is correct
17 Correct 8 ms 12032 KB Output is correct
18 Correct 8 ms 12032 KB Output is correct
19 Correct 9 ms 12032 KB Output is correct
20 Correct 8 ms 12032 KB Output is correct
21 Correct 9 ms 12160 KB Output is correct
22 Correct 9 ms 12032 KB Output is correct
23 Correct 9 ms 12032 KB Output is correct
24 Correct 15 ms 12032 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 8 ms 12032 KB Output is correct
2 Correct 8 ms 12120 KB Output is correct
3 Correct 8 ms 12032 KB Output is correct
4 Correct 9 ms 12032 KB Output is correct
5 Correct 8 ms 12032 KB Output is correct
6 Correct 8 ms 12032 KB Output is correct
7 Correct 9 ms 12032 KB Output is correct
8 Correct 8 ms 12032 KB Output is correct
9 Correct 9 ms 12032 KB Output is correct
10 Correct 9 ms 12160 KB Output is correct
11 Correct 9 ms 12032 KB Output is correct
12 Correct 8 ms 12032 KB Output is correct
13 Correct 10 ms 12032 KB Output is correct
14 Correct 8 ms 12032 KB Output is correct
15 Correct 8 ms 12032 KB Output is correct
16 Correct 8 ms 12064 KB Output is correct
17 Correct 8 ms 12032 KB Output is correct
18 Correct 8 ms 12032 KB Output is correct
19 Correct 9 ms 12032 KB Output is correct
20 Correct 8 ms 12032 KB Output is correct
21 Correct 9 ms 12160 KB Output is correct
22 Correct 9 ms 12032 KB Output is correct
23 Correct 9 ms 12032 KB Output is correct
24 Correct 15 ms 12032 KB Output is correct
25 Correct 8 ms 12032 KB Output is correct
26 Correct 8 ms 12032 KB Output is correct
27 Correct 9 ms 12032 KB Output is correct
28 Correct 9 ms 12032 KB Output is correct
29 Correct 16 ms 12032 KB Output is correct
30 Correct 68 ms 12032 KB Output is correct
31 Correct 550 ms 12128 KB Output is correct
32 Correct 8 ms 12032 KB Output is correct
33 Correct 9 ms 12032 KB Output is correct
34 Correct 10 ms 12032 KB Output is correct
35 Correct 28 ms 12032 KB Output is correct
36 Correct 262 ms 12032 KB Output is correct
37 Execution timed out 3037 ms 12032 KB Time limit exceeded
38 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 8 ms 12032 KB Output is correct
2 Correct 8 ms 12120 KB Output is correct
3 Correct 8 ms 12032 KB Output is correct
4 Correct 9 ms 12032 KB Output is correct
5 Correct 8 ms 12032 KB Output is correct
6 Correct 8 ms 12032 KB Output is correct
7 Correct 9 ms 12032 KB Output is correct
8 Correct 8 ms 12032 KB Output is correct
9 Correct 9 ms 12032 KB Output is correct
10 Correct 9 ms 12160 KB Output is correct
11 Correct 9 ms 12032 KB Output is correct
12 Correct 8 ms 12032 KB Output is correct
13 Correct 10 ms 12032 KB Output is correct
14 Correct 8 ms 12032 KB Output is correct
15 Correct 8 ms 12032 KB Output is correct
16 Correct 8 ms 12064 KB Output is correct
17 Correct 8 ms 12032 KB Output is correct
18 Correct 8 ms 12032 KB Output is correct
19 Correct 9 ms 12032 KB Output is correct
20 Correct 8 ms 12032 KB Output is correct
21 Correct 9 ms 12160 KB Output is correct
22 Correct 9 ms 12032 KB Output is correct
23 Correct 9 ms 12032 KB Output is correct
24 Correct 15 ms 12032 KB Output is correct
25 Correct 8 ms 12032 KB Output is correct
26 Correct 8 ms 12032 KB Output is correct
27 Correct 9 ms 12032 KB Output is correct
28 Correct 9 ms 12032 KB Output is correct
29 Correct 16 ms 12032 KB Output is correct
30 Correct 68 ms 12032 KB Output is correct
31 Correct 550 ms 12128 KB Output is correct
32 Correct 8 ms 12032 KB Output is correct
33 Correct 9 ms 12032 KB Output is correct
34 Correct 10 ms 12032 KB Output is correct
35 Correct 28 ms 12032 KB Output is correct
36 Correct 262 ms 12032 KB Output is correct
37 Execution timed out 3037 ms 12032 KB Time limit exceeded
38 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 8 ms 12032 KB Output is correct
2 Correct 8 ms 12120 KB Output is correct
3 Correct 8 ms 12032 KB Output is correct
4 Correct 9 ms 12032 KB Output is correct
5 Correct 8 ms 12032 KB Output is correct
6 Correct 8 ms 12032 KB Output is correct
7 Correct 9 ms 12032 KB Output is correct
8 Correct 8 ms 12032 KB Output is correct
9 Correct 9 ms 12032 KB Output is correct
10 Correct 9 ms 12160 KB Output is correct
11 Correct 9 ms 12032 KB Output is correct
12 Correct 8 ms 12032 KB Output is correct
13 Correct 10 ms 12032 KB Output is correct
14 Correct 8 ms 12032 KB Output is correct
15 Correct 8 ms 12032 KB Output is correct
16 Correct 8 ms 12064 KB Output is correct
17 Correct 8 ms 12032 KB Output is correct
18 Correct 8 ms 12032 KB Output is correct
19 Correct 9 ms 12032 KB Output is correct
20 Correct 8 ms 12032 KB Output is correct
21 Correct 9 ms 12160 KB Output is correct
22 Correct 9 ms 12032 KB Output is correct
23 Correct 9 ms 12032 KB Output is correct
24 Correct 15 ms 12032 KB Output is correct
25 Correct 8 ms 12032 KB Output is correct
26 Correct 8 ms 12032 KB Output is correct
27 Correct 9 ms 12032 KB Output is correct
28 Correct 9 ms 12032 KB Output is correct
29 Correct 16 ms 12032 KB Output is correct
30 Correct 68 ms 12032 KB Output is correct
31 Correct 550 ms 12128 KB Output is correct
32 Correct 8 ms 12032 KB Output is correct
33 Correct 9 ms 12032 KB Output is correct
34 Correct 10 ms 12032 KB Output is correct
35 Correct 28 ms 12032 KB Output is correct
36 Correct 262 ms 12032 KB Output is correct
37 Execution timed out 3037 ms 12032 KB Time limit exceeded
38 Halted 0 ms 0 KB -