Submission #704147

#TimeUsernameProblemLanguageResultExecution timeMemory
704147karrigan스파이 (JOI13_spy)C++14
100 / 100
388 ms36184 KiB
#include<bits/stdc++.h> using namespace std; int tme=0; int in[2009]; int out[2009]; int a[2009]; int b[2009]; int num[2009][2009]; int dp[2009][2009];; int cal(int i,int j){ if (!i||!j)return 0; if (num[i][j])return dp[i][j]; num[i][j]=1; return dp[i][j]+=cal(i,b[j])+cal(a[i],j)-cal(a[i],b[j]); } int main() { ios_base::sync_with_stdio(false); cin.tie(0); int r1=0,r2=0; int n,m; cin>>n>>m; for (int i=1;i<=n;i++){ cin>>a[i]>>b[i]; } for (int i=1;i<=m;i++){ int x,y; cin>>x>>y; dp[x][y]++; } for (int i=1;i<=n;i++){ cout<<cal(i,i)<<'\n'; } }

Compilation message (stderr)

spy.cpp: In function 'int main()':
spy.cpp:20:9: warning: unused variable 'r1' [-Wunused-variable]
   20 |     int r1=0,r2=0;
      |         ^~
spy.cpp:20:14: warning: unused variable 'r2' [-Wunused-variable]
   20 |     int r1=0,r2=0;
      |              ^~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...