답안 #278166

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
278166 2020-08-21T11:05:10 Z AKaan37 Amusement Park (CEOI19_amusementpark) C++17
0 / 100
1 ms 256 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 = 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<PII> v[li];
vector<int> vv;

inline void check(){
	FOR vis[i]=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;
			cevap+=v[node][j].se;
		}
		vis[node]=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});
		v[y].pb({x,1});
	}
	//~ 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:48:10: warning: ISO C++ forbids declaration of 'main' with no type [-Wreturn-type]
   48 | main(void){
      |          ^
amusementpark.cpp: In function 'int main()':
amusementpark.cpp:49:7: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
   49 |  scanf("%lld %lld",&n,&m);
      |  ~~~~~^~~~~~~~~~~~~~~~~~~
amusementpark.cpp:52:8: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
   52 |   scanf("%lld %lld",&x,&y);
      |   ~~~~~^~~~~~~~~~~~~~~~~~~
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 256 KB Output is correct
2 Correct 0 ms 256 KB Output is correct
3 Incorrect 1 ms 256 KB Output isn't correct
4 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 256 KB Output is correct
2 Correct 0 ms 256 KB Output is correct
3 Incorrect 1 ms 256 KB Output isn't correct
4 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 256 KB Output is correct
2 Correct 0 ms 256 KB Output is correct
3 Incorrect 1 ms 256 KB Output isn't correct
4 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 256 KB Output is correct
2 Correct 0 ms 256 KB Output is correct
3 Incorrect 1 ms 256 KB Output isn't correct
4 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 256 KB Output is correct
2 Correct 0 ms 256 KB Output is correct
3 Incorrect 1 ms 256 KB Output isn't correct
4 Halted 0 ms 0 KB -