# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
171030 | 2019-12-27T05:46:36 Z | juggernaut | 결혼 문제 (IZhO14_marriage) | C++14 | 1500 ms | 5496 KB |
//Just try and the idea will come! #include<bits/stdc++.h> #define int long long int using namespace std; int n,m,k,x,y,cnt,mt[100001]; vector<vector<int>>g(100001); bool used[100001]; bool kuhn(int v){ if(used[v]||v<x||v>y)return false; used[v]=true; for(int to:g[v]){ if(mt[to]==0||kuhn(mt[to])){ mt[to]=v; return true; } } return false; } bool check(int l,int r){ for(int i=1;i<=n;i++)mt[i]=0; for(int i=1;i<=n;i++){ for(int j=1;j<=n;j++)used[j]=false; kuhn(i); } int c=0; for(int i=1;i<=n;i++)if(mt[i])c++; return c==m; } main(){ scanf("%lld%lld%lld",&n,&m,&k); while(k--){ scanf("%lld%lld",&x,&y); g[x].push_back(y); } for(x=1;x<=n;x++) for(y=x;y<=n;y++)cnt+=check(x,y); printf("%lld",cnt); }
Compilation message
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 4 ms | 2680 KB | Output is correct |
2 | Correct | 4 ms | 2680 KB | Output is correct |
3 | Correct | 4 ms | 2680 KB | Output is correct |
4 | Correct | 4 ms | 2680 KB | Output is correct |
5 | Correct | 5 ms | 2680 KB | Output is correct |
6 | Correct | 5 ms | 2684 KB | Output is correct |
7 | Correct | 4 ms | 2680 KB | Output is correct |
8 | Correct | 4 ms | 2680 KB | Output is correct |
9 | Correct | 4 ms | 2676 KB | Output is correct |
10 | Correct | 4 ms | 2680 KB | Output is correct |
11 | Correct | 4 ms | 2680 KB | Output is correct |
12 | Correct | 4 ms | 2680 KB | Output is correct |
13 | Correct | 4 ms | 2680 KB | Output is correct |
14 | Correct | 4 ms | 2680 KB | Output is correct |
15 | Correct | 4 ms | 2680 KB | Output is correct |
16 | Correct | 5 ms | 2656 KB | Output is correct |
17 | Correct | 5 ms | 2680 KB | Output is correct |
18 | Correct | 5 ms | 2680 KB | Output is correct |
19 | Correct | 152 ms | 2680 KB | Output is correct |
20 | Correct | 75 ms | 2680 KB | Output is correct |
21 | Correct | 43 ms | 2808 KB | Output is correct |
22 | Correct | 56 ms | 2680 KB | Output is correct |
23 | Correct | 114 ms | 2740 KB | Output is correct |
24 | Correct | 89 ms | 2680 KB | Output is correct |
25 | Execution timed out | 1557 ms | 2936 KB | Time limit exceeded |
26 | Execution timed out | 1577 ms | 2808 KB | Time limit exceeded |
27 | Execution timed out | 1574 ms | 2680 KB | Time limit exceeded |
28 | Execution timed out | 1552 ms | 2680 KB | Time limit exceeded |
29 | Execution timed out | 1582 ms | 2812 KB | Time limit exceeded |
30 | Execution timed out | 1552 ms | 2808 KB | Time limit exceeded |
31 | Execution timed out | 1563 ms | 3684 KB | Time limit exceeded |
32 | Execution timed out | 1570 ms | 2936 KB | Time limit exceeded |
33 | Execution timed out | 1571 ms | 2680 KB | Time limit exceeded |
34 | Execution timed out | 1553 ms | 2784 KB | Time limit exceeded |
35 | Execution timed out | 1539 ms | 4600 KB | Time limit exceeded |
36 | Execution timed out | 1554 ms | 4344 KB | Time limit exceeded |
37 | Execution timed out | 1557 ms | 3704 KB | Time limit exceeded |
38 | Execution timed out | 1560 ms | 4984 KB | Time limit exceeded |
39 | Execution timed out | 1554 ms | 2808 KB | Time limit exceeded |
40 | Execution timed out | 1566 ms | 3064 KB | Time limit exceeded |
41 | Execution timed out | 1547 ms | 3320 KB | Time limit exceeded |
42 | Execution timed out | 1562 ms | 3576 KB | Time limit exceeded |
43 | Execution timed out | 1547 ms | 3832 KB | Time limit exceeded |
44 | Execution timed out | 1562 ms | 4600 KB | Time limit exceeded |
45 | Execution timed out | 1575 ms | 3832 KB | Time limit exceeded |
46 | Execution timed out | 1565 ms | 5368 KB | Time limit exceeded |
47 | Execution timed out | 1564 ms | 5240 KB | Time limit exceeded |
48 | Execution timed out | 1560 ms | 5112 KB | Time limit exceeded |
49 | Execution timed out | 1558 ms | 5496 KB | Time limit exceeded |
50 | Execution timed out | 1577 ms | 3064 KB | Time limit exceeded |