0_0_38792223_3847.cpp: In function 'int main()':
0_0_38792223_3847.cpp:12:1: error: expected primary-expression before '}' token
12 | }
| ^
0_0_38792223_3847.cpp:12:2: error: expected '}' at end of input
12 | }
| ^
0_0_38792223_3847.cpp:11:43: note: to match this '{'
11 | {int n,m;while(scanf("%d%d",&n,&m) != EOF){memset(bef,0,sizeof(bef));for(int i=0; i<n; i++)for(int j=0; j<n; j++){scanf("%d",&mp[i][j]);}while(m--){int a,b;scanf("%d%d",&a,&b);bef[b]|=(1<<a);}for(int i=0; i<(1<<n); i++)for(int j=0; j<n; j++)dp[i][j] = inf;dp[1][0] = 0;for(int state = 1 ; state < (1<<n); state++){for(int i=0; i<n; i++) // 用过的{if(!(state & (1<<i)))continue;if(dp[state][i] == inf)continue;for(int j=0; j<n; j++){if(mp[i][j] == -1 || (state&(1<<j))>0 || bef[j] != (state&bef[j]))continue;int nsta = state | (1<<j);dp[nsta][j] = min(dp[nsta][j], dp[state][i] + mp[i][j]);}}}int ans = inf;for(int i=0; i<n; i++){ans = min(ans, dp[(1<<n)-1][i]);}if(ans == inf){puts("-1");}elseprintf("%d\n",ans);}return 0;
| ^
0_0_38792223_3847.cpp:12:2: error: expected '}' at end of input
12 | }
| ^
0_0_38792223_3847.cpp:11:1: note: to match this '{'
11 | {int n,m;while(scanf("%d%d",&n,&m) != EOF){memset(bef,0,sizeof(bef));for(int i=0; i<n; i++)for(int j=0; j<n; j++){scanf("%d",&mp[i][j]);}while(m--){int a,b;scanf("%d%d",&a,&b);bef[b]|=(1<<a);}for(int i=0; i<(1<<n); i++)for(int j=0; j<n; j++)dp[i][j] = inf;dp[1][0] = 0;for(int state = 1 ; state < (1<<n); state++){for(int i=0; i<n; i++) // 用过的{if(!(state & (1<<i)))continue;if(dp[state][i] == inf)continue;for(int j=0; j<n; j++){if(mp[i][j] == -1 || (state&(1<<j))>0 || bef[j] != (state&bef[j]))continue;int nsta = state | (1<<j);dp[nsta][j] = min(dp[nsta][j], dp[state][i] + mp[i][j]);}}}int ans = inf;for(int i=0; i<n; i++){ans = min(ans, dp[(1<<n)-1][i]);}if(ans == inf){puts("-1");}elseprintf("%d\n",ans);}return 0;
| ^
|