# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
38495 | 2018-01-04T10:11:04 Z | alenam0161 | 결혼 문제 (IZhO14_marriage) | C++14 | 189 ms | 3124 KB |
#include <bits/stdc++.h> using namespace std; const int N = 1e3+7; vector<int> g[N],g1[N]; int n,m,k; bool used[N]; int ma[N]; bool try_khun(int v){ if(used[v]==true)return false; used[v]=true; for(auto to:g[v]){ if(ma[to]==-1||try_khun(ma[to])){ ma[to]=v; return true; } } return false; } /* how=0; memset(ma,-1,sizeof(ma)); for(int j=l;j<=r;++j){ memset(used,0,sizeof(used)); how+=try_khun(j); } if(how==m)ans++; */ int main(){ memset(ma,-1,sizeof(ma)); scanf("%d%d%d",&n,&m,&k); for(int i=1;i<=k;++i){ int u,v; scanf("%d%d",&v,&u); g[v].push_back(u); g1[u].push_back(v); } int how=0; long long ans=0; int l=1; for(int i=1;i<=n-m+1;++i){ if(try_khun(i))how++; while(how==m){ l++; how=0; memset(ma,-1,sizeof(ma)); for(int j=l;j<=i;++j){ memset(used,0,sizeof(used)); how+=try_khun(j); } } ans+=l-1; } cout<<ans<<endl; return 0; }
Compilation message
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Incorrect | 0 ms | 2068 KB | Output isn't correct |
2 | Incorrect | 0 ms | 2068 KB | Output isn't correct |
3 | Incorrect | 0 ms | 2068 KB | Output isn't correct |
4 | Incorrect | 0 ms | 2068 KB | Output isn't correct |
5 | Incorrect | 0 ms | 2068 KB | Output isn't correct |
6 | Incorrect | 0 ms | 2068 KB | Output isn't correct |
7 | Incorrect | 0 ms | 2068 KB | Output isn't correct |
8 | Correct | 0 ms | 2068 KB | Output is correct |
9 | Correct | 0 ms | 2068 KB | Output is correct |
10 | Correct | 0 ms | 2068 KB | Output is correct |
11 | Incorrect | 0 ms | 2068 KB | Output isn't correct |
12 | Correct | 0 ms | 2068 KB | Output is correct |
13 | Correct | 0 ms | 2068 KB | Output is correct |
14 | Incorrect | 0 ms | 2068 KB | Output isn't correct |
15 | Incorrect | 0 ms | 2068 KB | Output isn't correct |
16 | Incorrect | 0 ms | 2068 KB | Output isn't correct |
17 | Incorrect | 0 ms | 2068 KB | Output isn't correct |
18 | Incorrect | 0 ms | 2068 KB | Output isn't correct |
19 | Incorrect | 0 ms | 2068 KB | Output isn't correct |
20 | Incorrect | 0 ms | 2068 KB | Output isn't correct |
21 | Correct | 0 ms | 2068 KB | Output is correct |
22 | Incorrect | 0 ms | 2068 KB | Output isn't correct |
23 | Incorrect | 0 ms | 2068 KB | Output isn't correct |
24 | Incorrect | 0 ms | 2068 KB | Output isn't correct |
25 | Incorrect | 13 ms | 2200 KB | Output isn't correct |
26 | Incorrect | 33 ms | 2068 KB | Output isn't correct |
27 | Correct | 0 ms | 2068 KB | Output is correct |
28 | Incorrect | 0 ms | 2068 KB | Output isn't correct |
29 | Incorrect | 189 ms | 2200 KB | Output isn't correct |
30 | Incorrect | 136 ms | 2200 KB | Output isn't correct |
31 | Incorrect | 13 ms | 2596 KB | Output isn't correct |
32 | Incorrect | 0 ms | 2200 KB | Output isn't correct |
33 | Correct | 0 ms | 2068 KB | Output is correct |
34 | Incorrect | 0 ms | 2068 KB | Output isn't correct |
35 | Incorrect | 133 ms | 3124 KB | Output isn't correct |
36 | Incorrect | 119 ms | 3124 KB | Output isn't correct |
37 | Runtime error | 0 ms | 2068 KB | Execution killed with signal 11 (could be triggered by violating memory limits) |
38 | Runtime error | 19 ms | 2860 KB | Execution killed with signal 11 (could be triggered by violating memory limits) |
39 | Runtime error | 0 ms | 2068 KB | Execution killed with signal 11 (could be triggered by violating memory limits) |
40 | Runtime error | 0 ms | 2068 KB | Execution killed with signal 11 (could be triggered by violating memory limits) |
41 | Runtime error | 0 ms | 2068 KB | Execution killed with signal 11 (could be triggered by violating memory limits) |
42 | Runtime error | 0 ms | 2068 KB | Execution killed with signal 11 (could be triggered by violating memory limits) |
43 | Runtime error | 0 ms | 2068 KB | Execution killed with signal 11 (could be triggered by violating memory limits) |
44 | Runtime error | 0 ms | 2200 KB | Execution killed with signal 11 (could be triggered by violating memory limits) |
45 | Runtime error | 0 ms | 2068 KB | Execution killed with signal 11 (could be triggered by violating memory limits) |
46 | Runtime error | 0 ms | 2068 KB | Execution killed with signal 11 (could be triggered by violating memory limits) |
47 | Runtime error | 0 ms | 2068 KB | Execution killed with signal 11 (could be triggered by violating memory limits) |
48 | Runtime error | 0 ms | 2068 KB | Execution killed with signal 11 (could be triggered by violating memory limits) |
49 | Runtime error | 0 ms | 2068 KB | Execution killed with signal 11 (could be triggered by violating memory limits) |
50 | Runtime error | 0 ms | 2068 KB | Execution killed with signal 11 (could be triggered by violating memory limits) |