# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
38492 | 2018-01-04T10:05:34 Z | alenam0161 | 결혼 문제 (IZhO14_marriage) | C++14 | 133 ms | 133104 KB |
#include <bits/stdc++.h> using namespace std; const int N = 3e2+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; } 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; for(int l=1;l<=n;++l) for(int r=l;r<=n;++r){ 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++; } cout<<ans<<endl; return 0; }
Compilation message
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 0 ms | 2032 KB | Output is correct |
2 | Correct | 0 ms | 2032 KB | Output is correct |
3 | Correct | 0 ms | 2032 KB | Output is correct |
4 | Correct | 0 ms | 2032 KB | Output is correct |
5 | Correct | 0 ms | 2032 KB | Output is correct |
6 | Correct | 0 ms | 2032 KB | Output is correct |
7 | Correct | 0 ms | 2032 KB | Output is correct |
8 | Correct | 0 ms | 2032 KB | Output is correct |
9 | Correct | 0 ms | 2032 KB | Output is correct |
10 | Correct | 0 ms | 2032 KB | Output is correct |
11 | Correct | 0 ms | 2032 KB | Output is correct |
12 | Correct | 0 ms | 2032 KB | Output is correct |
13 | Correct | 0 ms | 2032 KB | Output is correct |
14 | Correct | 0 ms | 2032 KB | Output is correct |
15 | Correct | 0 ms | 2032 KB | Output is correct |
16 | Correct | 0 ms | 2032 KB | Output is correct |
17 | Correct | 0 ms | 2032 KB | Output is correct |
18 | Correct | 0 ms | 2032 KB | Output is correct |
19 | Correct | 133 ms | 2032 KB | Output is correct |
20 | Correct | 39 ms | 2032 KB | Output is correct |
21 | Correct | 6 ms | 2032 KB | Output is correct |
22 | Correct | 19 ms | 2032 KB | Output is correct |
23 | Correct | 96 ms | 2032 KB | Output is correct |
24 | Correct | 59 ms | 2032 KB | Output is correct |
25 | Runtime error | 3 ms | 133104 KB | Execution killed because of forbidden syscall gettid (186) |
26 | Runtime error | 3 ms | 133104 KB | Execution killed because of forbidden syscall gettid (186) |
27 | Runtime error | 0 ms | 2032 KB | Execution killed with signal 11 (could be triggered by violating memory limits) |
28 | Runtime error | 3 ms | 2032 KB | Execution killed with signal 11 (could be triggered by violating memory limits) |
29 | Runtime error | 0 ms | 2164 KB | Execution killed with signal 11 (could be triggered by violating memory limits) |
30 | Runtime error | 0 ms | 2164 KB | Execution killed with signal 11 (could be triggered by violating memory limits) |
31 | Runtime error | 0 ms | 2032 KB | Execution killed with signal 11 (could be triggered by violating memory limits) |
32 | Runtime error | 0 ms | 2032 KB | Execution killed with signal 11 (could be triggered by violating memory limits) |
33 | Runtime error | 0 ms | 2032 KB | Execution killed with signal 11 (could be triggered by violating memory limits) |
34 | Runtime error | 0 ms | 2032 KB | Execution killed with signal 11 (could be triggered by violating memory limits) |
35 | Runtime error | 3 ms | 2296 KB | Execution killed with signal 11 (could be triggered by violating memory limits) |
36 | Runtime error | 6 ms | 2296 KB | Execution killed with signal 11 (could be triggered by violating memory limits) |
37 | Runtime error | 0 ms | 2032 KB | Execution killed with signal 11 (could be triggered by violating memory limits) |
38 | Runtime error | 0 ms | 2164 KB | Execution killed with signal 11 (could be triggered by violating memory limits) |
39 | Runtime error | 0 ms | 2032 KB | Execution killed with signal 11 (could be triggered by violating memory limits) |
40 | Runtime error | 0 ms | 2032 KB | Execution killed with signal 11 (could be triggered by violating memory limits) |
41 | Runtime error | 0 ms | 2032 KB | Execution killed with signal 11 (could be triggered by violating memory limits) |
42 | Runtime error | 0 ms | 2032 KB | Execution killed with signal 11 (could be triggered by violating memory limits) |
43 | Runtime error | 0 ms | 2032 KB | Execution killed with signal 11 (could be triggered by violating memory limits) |
44 | Runtime error | 0 ms | 2032 KB | Execution killed with signal 11 (could be triggered by violating memory limits) |
45 | Runtime error | 0 ms | 2032 KB | Execution killed with signal 11 (could be triggered by violating memory limits) |
46 | Runtime error | 0 ms | 2032 KB | Execution killed with signal 11 (could be triggered by violating memory limits) |
47 | Runtime error | 0 ms | 2032 KB | Execution killed with signal 11 (could be triggered by violating memory limits) |
48 | Runtime error | 0 ms | 2032 KB | Execution killed with signal 11 (could be triggered by violating memory limits) |
49 | Runtime error | 0 ms | 2032 KB | Execution killed with signal 11 (could be triggered by violating memory limits) |
50 | Runtime error | 0 ms | 2032 KB | Execution killed with signal 11 (could be triggered by violating memory limits) |