Submission #171029

#TimeUsernameProblemLanguageResultExecution timeMemory
171029juggernaut결혼 문제 (IZhO14_marriage)C++14
36 / 100
3 ms888 KiB
//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[51]; vector<vector<int>>g(51); bool used[51]; 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 (stderr)

marriage.cpp:29:6: warning: ISO C++ forbids declaration of 'main' with no type [-Wreturn-type]
 main(){
      ^
marriage.cpp: In function 'int main()':
marriage.cpp:30:10: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
     scanf("%lld%lld%lld",&n,&m,&k);
     ~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~
marriage.cpp:32:14: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
         scanf("%lld%lld",&x,&y);
         ~~~~~^~~~~~~~~~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...