F.A.Q
Hand In Hand
Online Acmers
Problem Archive
Realtime Judge Status
Authors Ranklist
 
     C/C++/Java Exams     
ACM Steps
Go to Job
Contest LiveCast
ICPC@China
Best Coder beta
VIP | STD Contests
    DIY | Web-DIY beta
Author ID 
Password 
 Register new ID

View Compilation Error

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;
      | ^


Hangzhou Dianzi University Online Judge 3.0
Copyright © 2005-2024 HDU ACM Team. All Rights Reserved.
Designer & Developer : Wang Rongtao LinLe GaoJie GanLu
Total 0.000000(s) query 1, Server time : 2024-11-23 04:55:23, Gzip enabled