답안 #341169

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
341169 2020-12-29T04:57:06 Z beksultan04 결혼 문제 (IZhO14_marriage) C++14
22 / 100
1500 ms 4844 KB
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define pii pair<int,int>
#define OK puts("OK");
#define NO puts("NO");
#define YES puts("YES");
#define fr first
#define sc second
#define ret return
#define scanl(a) scanf("%lld",&a);
#define scanll(a,b) scanf("%lld %lld",&a, &b);
#define scanlll(a,b,c) scanf("%lld %lld %lld",&a,&b,&c);
#define scan1(a) scanf("%d",&a);
#define scan2(a,b) scanf("%d %d",&a, &b);
#define scan3(a,b,c) scanf("%d %d %d",&a,&b,&c);
#define all(s) s.begin(),s.end()
#define allr(s) s.rbegin(),s.rend()
#define pb push_back
#define sz(v) (int)v.size()
#define endi puts("");
#define eps 1e-12
const int N = 1e5+12;
const ll INF=1e15+7;
vector <int> g[N];
int vis[N],m,n,ans,l;
bool is(){
    int i;
    for (i=1;i<=m;++i){
        if (vis[i]==0)ret 0;
    }
    ret 1;
}
bool an[1001][1001];
void dfs(int x){
    if (is()){
        if (an[l][x] == 0){
            ans++;
        }
        an[l][x]=1;
    }
    if (x > n)ret ;
    int i;
    for (i=0;i<g[x].size();++i){
        vis[g[x][i]]++;
        dfs(x+1);
        vis[g[x][i]]--;
    }

}

main(){
    int i,k,j;
    scan3(n,m,k)
    while (k-- ){
        int x,y;
        scan2(x,y)
        g[x].pb(y);
    }
    for (i=1;i<=n;++i){
        l=i;
        dfs(i);
    }
    cout <<ans;

}









Compilation message

marriage.cpp: In function 'void dfs(int)':
marriage.cpp:44:15: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   44 |     for (i=0;i<g[x].size();++i){
      |              ~^~~~~~~~~~~~
marriage.cpp: At global scope:
marriage.cpp:52:6: warning: ISO C++ forbids declaration of 'main' with no type [-Wreturn-type]
   52 | main(){
      |      ^
marriage.cpp: In function 'int main()':
marriage.cpp:53:13: warning: unused variable 'j' [-Wunused-variable]
   53 |     int i,k,j;
      |             ^
marriage.cpp:16:27: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
   16 | #define scan3(a,b,c) scanf("%d %d %d",&a,&b,&c);
      |                      ~~~~~^~~~~~~~~~~~~~~~~~~~~
marriage.cpp:54:5: note: in expansion of macro 'scan3'
   54 |     scan3(n,m,k)
      |     ^~~~~
marriage.cpp:15:25: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
   15 | #define scan2(a,b) scanf("%d %d",&a, &b);
      |                    ~~~~~^~~~~~~~~~~~~~~~
marriage.cpp:57:9: note: in expansion of macro 'scan2'
   57 |         scan2(x,y)
      |         ^~~~~
# 결과 실행 시간 메모리 Grader output
1 Correct 3 ms 2668 KB Output is correct
2 Incorrect 2 ms 2668 KB Output isn't correct
3 Incorrect 3 ms 2668 KB Output isn't correct
4 Incorrect 2 ms 2668 KB Output isn't correct
5 Incorrect 2 ms 2668 KB Output isn't correct
6 Incorrect 2 ms 2668 KB Output isn't correct
7 Execution timed out 1573 ms 2668 KB Time limit exceeded
8 Correct 2 ms 2668 KB Output is correct
9 Correct 2 ms 2668 KB Output is correct
10 Correct 2 ms 2668 KB Output is correct
11 Correct 2 ms 2668 KB Output is correct
12 Correct 2 ms 2668 KB Output is correct
13 Incorrect 2 ms 2668 KB Output isn't correct
14 Execution timed out 1593 ms 2668 KB Time limit exceeded
15 Correct 844 ms 2860 KB Output is correct
16 Incorrect 2 ms 2668 KB Output isn't correct
17 Incorrect 62 ms 2796 KB Output isn't correct
18 Incorrect 5 ms 2668 KB Output isn't correct
19 Execution timed out 1589 ms 2668 KB Time limit exceeded
20 Execution timed out 1599 ms 2668 KB Time limit exceeded
21 Correct 6 ms 2668 KB Output is correct
22 Execution timed out 1579 ms 2668 KB Time limit exceeded
23 Execution timed out 1565 ms 2668 KB Time limit exceeded
24 Execution timed out 1575 ms 2668 KB Time limit exceeded
25 Execution timed out 1561 ms 2796 KB Time limit exceeded
26 Execution timed out 1600 ms 2668 KB Time limit exceeded
27 Correct 2 ms 2668 KB Output is correct
28 Execution timed out 1600 ms 2668 KB Time limit exceeded
29 Execution timed out 1600 ms 2796 KB Time limit exceeded
30 Execution timed out 1600 ms 2796 KB Time limit exceeded
31 Execution timed out 1577 ms 3052 KB Time limit exceeded
32 Execution timed out 1549 ms 2796 KB Time limit exceeded
33 Correct 2 ms 2668 KB Output is correct
34 Execution timed out 1582 ms 2668 KB Time limit exceeded
35 Execution timed out 1594 ms 3308 KB Time limit exceeded
36 Execution timed out 1548 ms 3180 KB Time limit exceeded
37 Execution timed out 1591 ms 3180 KB Time limit exceeded
38 Execution timed out 1587 ms 3564 KB Time limit exceeded
39 Execution timed out 1535 ms 2796 KB Time limit exceeded
40 Correct 7 ms 3052 KB Output is correct
41 Execution timed out 1579 ms 2924 KB Time limit exceeded
42 Execution timed out 1567 ms 3820 KB Time limit exceeded
43 Execution timed out 1592 ms 3820 KB Time limit exceeded
44 Execution timed out 1583 ms 3948 KB Time limit exceeded
45 Incorrect 17 ms 3308 KB Output isn't correct
46 Execution timed out 1578 ms 3692 KB Time limit exceeded
47 Execution timed out 1589 ms 4844 KB Time limit exceeded
48 Execution timed out 1587 ms 4844 KB Time limit exceeded
49 Execution timed out 1548 ms 3820 KB Time limit exceeded
50 Execution timed out 1527 ms 2796 KB Time limit exceeded