/**
* author: Haunted_Cpp
**/
/***************** [LIBRARY PROTOCOL] ****************/
#include<bits/stdc++.h>
using namespace std;
/********************* [CONSTANTS] *******************/
#define INF 1e9
#define F first
#define S second
#define PB push_back
#define MP make_pair
typedef long ld;
typedef long long lld;
typedef pair<int,int>ii;
vector<int>dr={+1,-1,+0,+0,+1,-1,-1,+1};
vector<int>dc={+0,+0,+1,-1,+1,-1,+1,-1};
/******************** [FUNCTIONS] ********************/
int N,A=0;
set<ii>cantUse;
void solve(int S,unordered_set<int>ans){
if(S==N+1){
for(auto itF:ans){
for(auto itS:ans){
if(cantUse.find({itF,itS})!=cantUse.end())return;
}
}
A++;
return;
}
solve(S+1,ans);
ans.insert(S);
solve(S+1,ans);
}
/*********************** [MAIN] **********************/
int main(){
ios::sync_with_stdio(0);cin.tie(0);cout.tie(0);
int M;cin>>N>>M;
for(int i=0;i<M;i++){
int u,v;cin>>u>>v;
cantUse.insert({u,v});
}
solve(1,unordered_set<int>());
cout<<A<<'\n';
return 0;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
5 ms |
256 KB |
Output is correct |
2 |
Correct |
5 ms |
384 KB |
Output is correct |
3 |
Correct |
947 ms |
480 KB |
Output is correct |
4 |
Correct |
963 ms |
504 KB |
Output is correct |
5 |
Correct |
969 ms |
504 KB |
Output is correct |
6 |
Execution timed out |
1029 ms |
504 KB |
Time limit exceeded |
7 |
Execution timed out |
1065 ms |
504 KB |
Time limit exceeded |
8 |
Execution timed out |
1081 ms |
504 KB |
Time limit exceeded |
9 |
Execution timed out |
1094 ms |
384 KB |
Time limit exceeded |
10 |
Execution timed out |
1088 ms |
424 KB |
Time limit exceeded |