답안 #341181

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
341181 2020-12-29T05:12:29 Z beksultan04 결혼 문제 (IZhO14_marriage) C++14
14 / 100
1500 ms 5612 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=1e9+7;
vector <int> g[N],v;
int m,n,ans,l;
bool vis[N],bb[1001][1001];

int rec(int x,int mn,int mx){
    if (x > m){
        int ans=0;
        if (bb[mn][mx] == 0)ans=1;
        bb[mn][mx] = 1;
        ret ans;

    }
    int i,ans=0;
    for (i=0;i<g[x].size();++i){
        if (vis[g[x][i]] == 0){
            vis[g[x][i]]=1;
            v.pb(g[x][i]);
            ans += rec(x+1,min(mn,g[x][i]),max(mx,g[x][i]));
            v.pop_back();
            vis[g[x][i]]=0;
        }
    }
    ret ans;
}

main(){
    int i,k,j,cnt=0;
    scan3(n,m,k)
    while (k-- ){
        int x,y;
        scan2(x,y)
        g[y].pb(x);
    }
    cout <<rec(1,INF,0);
}









Compilation message

marriage.cpp: In function 'int rec(int, int, int)':
marriage.cpp:38:15: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   38 |     for (i=0;i<g[x].size();++i){
      |              ~^~~~~~~~~~~~
marriage.cpp: At global scope:
marriage.cpp:50:6: warning: ISO C++ forbids declaration of 'main' with no type [-Wreturn-type]
   50 | main(){
      |      ^
marriage.cpp: In function 'int main()':
marriage.cpp:51:9: warning: unused variable 'i' [-Wunused-variable]
   51 |     int i,k,j,cnt=0;
      |         ^
marriage.cpp:51:13: warning: unused variable 'j' [-Wunused-variable]
   51 |     int i,k,j,cnt=0;
      |             ^
marriage.cpp:51:15: warning: unused variable 'cnt' [-Wunused-variable]
   51 |     int i,k,j,cnt=0;
      |               ^~~
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:52:5: note: in expansion of macro 'scan3'
   52 |     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:55:9: note: in expansion of macro 'scan2'
   55 |         scan2(x,y)
      |         ^~~~~
# 결과 실행 시간 메모리 Grader output
1 Incorrect 2 ms 2668 KB Output isn't correct
2 Incorrect 2 ms 2668 KB Output isn't correct
3 Incorrect 2 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 1592 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 Incorrect 201 ms 2796 KB Output isn't correct
15 Correct 19 ms 2668 KB Output is correct
16 Incorrect 2 ms 2668 KB Output isn't correct
17 Incorrect 2 ms 2668 KB Output isn't correct
18 Incorrect 2 ms 2668 KB Output isn't correct
19 Execution timed out 1599 ms 2668 KB Time limit exceeded
20 Execution timed out 1549 ms 2796 KB Time limit exceeded
21 Execution timed out 1598 ms 2668 KB Time limit exceeded
22 Incorrect 2 ms 2668 KB Output isn't correct
23 Execution timed out 1579 ms 2668 KB Time limit exceeded
24 Execution timed out 1596 ms 2668 KB Time limit exceeded
25 Execution timed out 1581 ms 2796 KB Time limit exceeded
26 Execution timed out 1554 ms 2668 KB Time limit exceeded
27 Execution timed out 1583 ms 2668 KB Time limit exceeded
28 Incorrect 2 ms 2668 KB Output isn't correct
29 Execution timed out 1595 ms 2668 KB Time limit exceeded
30 Execution timed out 1544 ms 2668 KB Time limit exceeded
31 Execution timed out 1590 ms 3052 KB Time limit exceeded
32 Execution timed out 1594 ms 2796 KB Time limit exceeded
33 Correct 2 ms 2668 KB Output is correct
34 Incorrect 4 ms 2668 KB Output isn't correct
35 Execution timed out 1590 ms 3180 KB Time limit exceeded
36 Execution timed out 1590 ms 3180 KB Time limit exceeded
37 Execution timed out 1564 ms 3200 KB Time limit exceeded
38 Execution timed out 1561 ms 3308 KB Time limit exceeded
39 Runtime error 24 ms 5612 KB Execution killed with signal 11 (could be triggered by violating memory limits)
40 Execution timed out 1597 ms 2796 KB Time limit exceeded
41 Execution timed out 1593 ms 3052 KB Time limit exceeded
42 Execution timed out 1542 ms 2924 KB Time limit exceeded
43 Execution timed out 1589 ms 3052 KB Time limit exceeded
44 Execution timed out 1537 ms 3436 KB Time limit exceeded
45 Execution timed out 1595 ms 3180 KB Time limit exceeded
46 Execution timed out 1599 ms 3436 KB Time limit exceeded
47 Execution timed out 1549 ms 3436 KB Time limit exceeded
48 Execution timed out 1596 ms 3436 KB Time limit exceeded
49 Execution timed out 1596 ms 3436 KB Time limit exceeded
50 Runtime error 24 ms 5612 KB Execution killed with signal 11 (could be triggered by violating memory limits)